Path: utzoo!attcan!uunet!ncrlnk!ncrcae!ece-csc!ncsuvx!gatech!bloom-beacon!apple!amdahl!pacbell!well!rchrd From: rchrd@well.UUCP (Richard Friedman) Newsgroups: comp.lang.fortran Subject: Re: CDC FORTRAN trivia questions Keywords: arithmetic if logical Message-ID: <7622@well.UUCP> Date: 10 Nov 88 18:09:20 GMT References: <1196@helios.ee.lbl.gov> <3616@s.cc.purdue.edu> <7523@ut-emx.UUCP> <3622@s.cc.purdue.edu> <7693@boring.cwi.nl> <3627@s.cc.purdue.edu> <2183@tekcae.CAX.TEK.COM> <7588@well.UUCP> <7709@boring.cwi.nl> Reply-To: rchrd@well.UUCP (Richard Friedman) Organization: RCHRD 2855 Telegraph #415 Berkeley CA 94705 Lines: 21 In article <7709@boring.cwi.nl> dik@cwi.nl (Dik T. Winter) writes: > floating-point and integer arithmetic do not generate -0, >if the input operands do not contain -0. But otherwise they can be generated. >E.g. truncating a negative floating point value to integer (if between -1.0 >and 0.0). Also overflowing integer multiply (which is really a special case >of floating-point multiply) can return -0. Most compilers compensate >for this by adding +0 to the result, which turns -0 to +0. >-- >dik t. winter, cwi, amsterdam, nederland Yes, but the math library was written in COMPASS and early versions were not very careful about propagating -0 thru sign extension under special cases, usually resulting from scaling exponents. In general the code compiled by FTN did a good job avoiding -0 but the library could not be trusted. -- ...Richard Friedman [rchrd] Berkeley, CA. rchrd@well.uucp -or- {ucbvax,lll-lcc,pacbell,hplabs}!well!rchrd