ajmyrvold@violet.waterloo.edu (Alan Myrvold) (07/19/88)
Perhaps the net isn't the best place to air frustrations about bugs, - but - try this in Turbo C version 1.5 : printf("%14.12f\n",1.0e-12); I'd be very happy to hear from anyone for whom this works. (It worked in version 1.0). Alan Myrvold ajmyrvold@violet.waterloo.edu
ralf@b.gp.cs.cmu.edu (Ralf Brown) (07/20/88)
In article <7841@watdragon.waterloo.edu> ajmyrvold@violet.waterloo.edu (Alan Myrvold) writes: }Perhaps the net isn't the best place to air frustrations about bugs, - but - }try this in Turbo C version 1.5 : } } printf("%14.12f\n",1.0e-12); } }I'd be very happy to hear from anyone for whom this works. }(It worked in version 1.0). printf() is obviously truncating the value at the last place. Since the floating point numbers are stored in binary, 1.0e-12 is not an even number, and thus cannot be represented exactly (much like 1/3 in decimal). Using printf("%34.32f\n",1.0e-12); the result is 0.00000000000099999999999999998000 which yields 0.000000000000 when truncated to twelve decimal places. It is quite likely that the 1.0 compiler produced a value for the number that had the low bit of the mantissa set, while the 1.5 version produces a value with the low bit cleared. Having the low bit set should be enough to bump the value over 1.0e-12, which would then give the result you expected. -- {harvard,uunet,ucbvax}!b.gp.cs.cmu.edu!ralf -=-=- AT&T: (412)268-3053 (school) ARPA: RALF@B.GP.CS.CMU.EDU |"Tolerance means excusing the mistakes others make. FIDO: Ralf Brown at 129/31 | Tact means not noticing them." --Arthur Schnitzler BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA -=-=- DISCLAIMER? I claimed something?