Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!mit-eddie!uw-beaver!ubc-vision!ubc-cs!manis From: manis@ubc-cs.UUCP (Vincent Manis) Newsgroups: comp.lang.c Subject: Re: + != + (floating point) Message-ID: <1285@ubc-cs.UUCP> Date: Thu, 23-Apr-87 12:22:14 EST Article-I.D.: ubc-cs.1285 Posted: Thu Apr 23 12:22:14 1987 Date-Received: Sat, 25-Apr-87 14:57:37 EST References: <133@starfire.UUCP> Reply-To: manis@ubc-cs.UUCP (Vincent Manis) Organization: UBC Department of Computer Science Lines: 32 In article <133@starfire.UUCP> merlyn@starfire.UUCP (Brian Westley) writes: >Integer addition is communative [sic] & associative. Floating addition is >communative, but NOT associative. >Merlyn Leroy ..rutgers!dayton!rosevax!rose3!starfire!merlyn This statement is flat-out wrong. On a machine with 16-bit ints 32767 + (-2) + 1 and 32767 + 1 + (-2) may lead to different results. It so happens that both will "work" on some machines with 2's complement, but 2's complement is only mandated by the Draft Standard (according to Harbison and Steele) for unsigned, not signed, ints. Even on some 2's complement machines, such as the IBM 370, there are modes in which the second expression will cause a fault (though fixed overflow checking is generally disabled). ----- Vincent Manis {seismo,uw-beaver}!ubc-vision!ubc-cs!manis Dept. of Computer Science manis@cs.ubc.cdn Univ. of British Columbia manis%ubc.csnet@csnet-relay.arpa Vancouver, B.C. V6T 1W5 manis@ubc.csnet (604) 228-6770 or 228-3061 "Long live the ideals of Marxism-Lennonism! May the thoughts of Groucho and John guide us in word, thought, and deed!"