On Thu, Apr 07, 2005 at 01:10:49PM -0400, Geert Bosch wrote:
> 
> On Apr 7, 2005, at 10:12, Steve Kargl wrote:
> 
> >On Thu, Apr 07, 2005 at 08:08:15AM -0400, Geert Bosch wrote:
> >>As far as I can seem from this patch, it rounds incorrectly.
> >>This is a problem with the library version as well, I believe.
> >>
> >
> >Which library?
> 
> libgfortran, or whatever is used to implement NINT and DNINT.
> 
> Here's an example:
>       program main
>       real x, y
>       x = 8388609.0
>       y = 0.4999999701976776123046875
>       print *, 'nint (', x, ') =', nint (x)
>       print *, 'nint ( y ) =', nint (y), ', where y < 0.5 = ', y < 0.5
>       end
> 
> output is
>  nint (   8388609.     ) =     8388610
>  nint ( y ) =           1 , where y < 0.5 =  T

Try -fdump-parse-tree.  You've given more digits in y than
its precision.  This is permitted by the standard.  It appears
the gfortran frontend is taking y = 0.499999 and the closest
representable nubmer is y = 0.5.

-- 
Steve

Reply via email to