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: 109fba,dad65365cb2b3396 X-Google-Attributes: gid109fba,public X-Google-Thread: fac41,dad65365cb2b3396 X-Google-Attributes: gidfac41,public X-Google-Thread: 1014db,dad65365cb2b3396 X-Google-Attributes: gid1014db,public X-Google-Thread: 106c43,dad65365cb2b3396 X-Google-Attributes: gid106c43,public X-Google-Thread: 103376,dad65365cb2b3396 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: The disturbing myth of Eiffel portability Date: 1996/11/19 Message-ID: #1/1 X-Deja-AN: 197573656 references: <3294e64b.74799475@news2.ibm.net> <56t1m4$nis@bcrkh13.bnr.ca> organization: New York University newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.c,comp.lang.c++,comp.lang.object Date: 1996-11-19T00:00:00+00:00 List-Id: Kaz says "Any computer scientist worth his salt knows that floating point numbers are only approximations of real quantities. Well written numerical analysis code takes this into consideration, and can be made portable. You cannot expect bit for bit equality from portable floating point code, but you can write the program in such a way that it will produce well-behaved approximations, and so that it will produce better and better approximations on more and more capable numerical processors. The fact is that forcing each implementation of a language to do floating point math precisely the same way is completey impractical, because it would impose a *huge* performance hit which is often not acceptable in number crunching." Many computer scientists have this view of floating-point, but at least in the IEEE world, this is an incorrect view. IEEE arithmetic is NOT an approximation of real arithmetic, but rather an EXACT implementation of a very well defined arithmetic, whose axioms are well understood. The idea that it is wrong to test for exact equality is quite incorrect, there are many algorithms where it is perfectly legitimate to test for exact equality if you know you are dealing with IEEE arithmetic. This *huge* performance hit occurs on fewer and fewer machines, nearly all machines now support IEEE arithmetic, and the decision to require this semantis in Java represents a final nail in the coffin for weird (and often badly designed) non-IEEE arithmetic systems.