This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with nearest(tiny(o),-1.0)/2.0


On Tue, Apr 04, 2006 at 11:57:12AM +0200, Dominique Dhumieres wrote:
> The following program
> 
> program chop
>   real o, t, td, tu, x, y
>   o = 1.
>   t = tiny(o)
>   td = nearest(t,-1.0)
>   x = td/2.0
>   y = nearest(tiny(o),-1.0)/2.0
>   print *, x, y, x - y
> end program chop
> 
> gives
> 
>   5.8774718E-39  5.8774704E-39  1.4012985E-45
> 

This appears to be a problem with the constant folding
of nearest() in simplify.c.  I believe this problem
will be observed only iin situations where subnormal numbers
occur (ie., in the above corner case).  There is a TODO
to use newer MPFR functions, but this would require people
to upgrade to 2.2.0.  I'll investigate this weekend.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]