Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!ut-sally!ut-ngp!infotel!pollux!bobkat!m5d From: m5d@bobkat.UUCP Newsgroups: comp.lang.c Subject: Re: C and Floating Point Message-ID: <843@bobkat.UUCP> Date: Tue, 7-Apr-87 09:23:28 EST Article-I.D.: bobkat.843 Posted: Tue Apr 7 09:23:28 1987 Date-Received: Sat, 11-Apr-87 00:31:56 EST References: <15958@sun.uucp> <5716@brl-smoke.ARPA> <14680@cca.CCA.COM> Reply-To: m5d@bobkat.UUCP (Mike McNally (Man Insane)) Organization: Digital Lynx, Inc; Dallas, TX Lines: 30 Keywords: C Fortran Floating Point In article <14680@cca.CCA.COM> g-rh@CCA.CCA.COM.UUCP (Richard Harter) writes: > >Doug, much as we all respect your knowledge of C and Unix, this >just doesn't wash. The essence of the problem is that floating point >arithmetic is commutative but not associative. From a mathematicians >viewpoint 'x + y + z', where x, y, and z are floating point numbers >and '+' is floating point addition, is not well defined. I repeat, >NOT WELL DEFINED. ... > >Richard Harter, SMDS Inc. [Disclaimers not permitted by company policy.] Not well defined for floating point (machine) arithmetic, but perfectly well defined for abstract real numbers. When a math guy writes down an equation on the blackboard, he thinks in terms of real numbers, not floating point. When he decides to incorporate the equation into a computer program, he is then faced with the problem of the discrete nature of all machine arithmetic. If he is using FORTRAN, he will know that parentheses have a certain meaning. He writes code accordingly. If he is using, C, he writes code accordingly, perhaps by breaking expressions into lists of simple expressions. I think this is directly analogous to the problem of developing a sorting algorithm on paper, then implementing it: if it is done in LISP, it will be very different from an implementation in C. -- Mike McNally, mercifully employed at Digital Lynx --- Where Plano Road the Mighty Flood of Forest Lane doth meet, And Garland fair, whose perfumed air flows soft about my feet... uucp: {texsun,killer,infotel}!pollux!bobkat!m5d (214) 238-7474