[PATCH/gfortran] Chop bits of subnormal numbers
Steve Kargl
sgk@troutmask.apl.washington.edu
Sun May 22 16:41:00 GMT 2005
On Mon, May 09, 2005 at 05:20:38PM +0200, Tobias Schl?ter wrote:
> Steve Kargl wrote:
> > I've updated the patch to chop the bits on the absolute
> > value, and then set the sign if need be.
> >
> > Bubblestrapped and reg. tested onn i386-*-freebsd.
> >
> > OK for mainline?
>
> This is ok, but I'd prefer if a testcase went along with it. Something like
> if (tiny(x)/2. /= tiny(x)/2. - (nearest(tiny(x),1.) - tiny(x)))/2.) &
> call abort
> should do the trick. (The idea is to change the digit that gets chopped off
> when we go from normalized to subnormal numbers, I'm not sure if I got it
> right, though). I'll have a go at fixing NEAREST for subnormals now.
>
I've come up with the following test case.
! { dg-do run }
! { dg-options "-Wno-underflow" }
! Check that the chopping of bits of subnormal numbers works.
!
program chop
real x
x = 1.
if (tiny(x)/2. /= tiny(x)/2. - (nearest(tiny(x),1.) - tiny(x))/2.) then
call abort
end if
end program chop
I usually do not do FP comparison as in the IF() statement above.
Tobi, do you see any problems with the testcase.
--
Steve
More information about the Fortran
mailing list