Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!im4u!rutgers!dayton!rosevax!rose3!starfire!merlyn From: merlyn@starfire.UUCP (Brian Westley) Newsgroups: comp.lang.c Subject: + != + (floating point) Message-ID: <133@starfire.UUCP> Date: Mon, 20-Apr-87 23:37:50 EST Article-I.D.: starfire.133 Posted: Mon Apr 20 23:37:50 1987 Date-Received: Thu, 23-Apr-87 04:57:05 EST Organization: Starfire Consultings Services, Mpls., MN Lines: 26 Summary: int + int != float + float Adding my $.02 about this whole order of evaluation to-do; 1) C allows the compiler to rearrange expressions involving communative & associative operators (+*^&| etc) 2) C, unfortunately, lumped both kinds of + together (integer add, float add). Integer addition is communative & associative. Floating addition is communative, but NOT associative. C 'defines' it to be something it isn't. I would prefer a compiler that doesn't perform associative transformations with operators that aren't associative. (For all you people about to yell "parentheses affect precidence, not order of evaluation", just consider (a%b)%c vs. a%(b%c) - if the %'s were +'s, the expression can be rearranged, but as written, it cannot, since % isn't associative or communative). 3) Does the proposed standard consider floating + to be associative? I hope it doesn't, since it isn't, C history notwithstanding. It probably does, though. +(We must be upward compatible with past errors). 4) Of course, (f1 + f2 + f3) should be rearrange-able, simple left-to-right associativity should be 'weaker'. 5) The same holds for most floating operations. ---- Merlyn Leroy ..rutgers!dayton!rosevax!rose3!starfire!merlyn