IRIS floating point read error

Glenn Randers-Pehrson, WMB glennrp at BRL.ARPA
Sat Feb 27 00:07:18 AEST 1988


caution:

The FORTRAN READ statement can produce erroneous results when using
the IRIS floating point board, viz:

Script started on Fri Feb 26 08:37:42 1988
taurus.brl.mil> cat bug75.f
      program bug75
      character*4 temp
      temp='  75'
      read(temp,'(f4.0)')value
      ivalue=ifix(value)
      write(*,*)' value=',value,', ivalue=',ivalue
      end
taurus.brl.mil> f77 bug75.f         # not using the floating point board
taurus.brl.mil> a.out               # answer is correct
  value=+7.500000E+01, ivalue=75
taurus.brl.mil> f77 -Zf bug75.f     #  using the floating point board
taurus.brl.mil> a.out               # answer is wrong
  value=+7.499999E+01, ivalue=74
taurus.brl.mil> f77 -Zf -ZF+F bug75.f #  using fp board and accurate divide
taurus.brl.mil> a.out                 # answer is still wrong
  value=+7.499999E+01, ivalue=74
taurus.brl.mil> 
script done on Fri Feb 26 08:38:57 1988

Please don't send flames about the program.  I know and you know that
ivalue=nint(value) or ivalue=ifix(value+.5) will work properly in all cases.
But sometime you might inherit a program containing coding as above, as I
did, and be baffled for a while.

The example above was run on an IRIS 2500 Turbo, with Rev C FP1 board,
running release GL2-W3.5rl. I got the same results on a 3130 and a 3030..

Glenn Randers-Pehrson <glennrp at brl.arpa>



More information about the Comp.sys.sgi mailing list