From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,a9f32f7699236ef1 X-Google-Attributes: gidfac41,public X-Google-Thread: 103d24,a9f32f7699236ef1 X-Google-Attributes: gid103d24,public X-Google-Thread: 103376,7fb761492573daee X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,a9f32f7699236ef1 X-Google-Attributes: gid10db24,public From: jerpat@iastate.edu (Jeremiah S Patterson) Subject: Re: Which first-course languages? (was: What schools use Eiffel (was: No top schools use Ada)) ? Date: 1995/04/21 Message-ID: #1/1 X-Deja-AN: 101368922 references: <3mq0jd$r10@kaiwan009.kaiwan.com> <3mrg2c$onn@disunms.epfl.ch> <3n33ej$2h7@theopolis.orl.mmc.com> <3n35ja$6u3@theopolis.orl.mmc.com> organization: Iowa State University, Ames, Iowa newsgroups: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.scheme Date: 1995-04-21T00:00:00+00:00 List-Id: In dewar@cs.nyu.edu (Robert Dewar) writes: >"found that they were comparing floating-point numbers for equality" >it is a common myth that this is a bad programming practice. In fact many >numerical algorithms involve perfectly legitimate tests for equality if >they know that they are running on reasonable floating-point hardware. >For example, a Newton-Raphson iteration for square root will converge >exactly on almost any reasonable fpt hardware. >It is perhaps a safe rule for people using floating-point who don't know >what they are doing (a common case), to avoid comparing fpt numbers for >equality, but please let's make sure that we don't end up with idiotic >rules that forbid this critically useful operation (IEEE fpt includes >equality for a reason, indeed all the operations defined by 754 are >useful, you should hestitate before declarting them useless). >So, while I am all in favor of an undergraduate curriculum including >discussion of underlying architectures in some considerable details >(including interrupts, registers, caches, data representation etc.) >I sure hope that a course in this area does not pass on the incorrect >advice to never compare fpt for equality. I agree to an extent...I think that stduents must be taught the "dangers" of testing for fpt equality. I think students need to learn that they can "control" the accuracy of floating point numbers using multiplication and rounding then division rather than a free-for-all, no questions asked equality check (which, even on good systems, may blow up after a fifth or sixth operation) That's my 2 cents worth! Jerry __________________________________________________________________________ Jeremiah S Patterson _/_/_/_/ \_\_\_\_ Larch 1357 Cunningham _/ _/_/_/ _/_/_/_/_/ \_ \_\_\_ \_\_\_ Ames, IA 50013 _/ _/ _/ _/ _/ _/ \_\_\_\_ \_ \_ jerpat@iastate.edu _/ _/_/_/ _/ _/ \_ \_\_\_ \_\_\_ _/_/_/_/ \_\_\_\_ jerpat@cs.iastate.edu "Where dreams are in big-O notation" -- __________________________________________________________________________ Jeremiah S Patterson _/_/_/_/ \_\_\_\_ Larch 1357 Cunningham _/ _/_/_/ _/_/_/_/_/ \_ \_\_\_ \_\_\_ Ames, IA 50013 _/ _/ _/ _/ _/ _/ \_\_\_\_ \_ \_ jerpat@iastate.edu _/ _/_/_/ _/ _/ \_ \_\_\_ \_\_\_ _/_/_/_/ \_\_\_\_ jerpat@cs.iastate.edu "Where dreams are in big-O notation"