Path: utzoo!attcan!uunet!mcvax!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.lang.fortran Subject: Re: CDC FORTRAN trivia questions Keywords: arithmetic if logical Message-ID: <7709@boring.cwi.nl> Date: 8 Nov 88 16:34:34 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> Organization: CWI, Amsterdam Lines: 16 In article <7588@well.UUCP> rchrd@well.UUCP (Richard Friedman) writes: > The comment was made that CDC hardware prevented -0 from being > generated. This was/is true, but there were times the FTN4 and > FTN5 math library routines would (for specific arguments) return -0. > This was a hard error to find, but eventually it got corrected. > Not exactly true; 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 INTERNET : dik@cwi.nl BITNET/EARN: dik@mcvax