This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/gfortran] Fix handling of subnormal numbers
Steve Kargl wrote:
> What are your expectation for NEAREST(NEAREST(0.,1.), 1.)?
> Before you answer, consider FRACTION(NEAREST(0.,1.)).
Well, if the target has subnormals, I don't think it's defined, as there is no
model representation for subnormals. Both FRACTION(NEAREST(0.,1.)) == 0. (a
model number) and 0.00....001 with the minimum exponent (a subnormal) look
like reasonable defintions.
NEAREST(NEAREST(0.,1.),1.)) equals a number with the binary mantissa
0.00....0010 and minimum exponent (again, if there are subnormals on the
target), applying NEAREST a third time would yield 0.00....0011 etc. See note
13.15 in the F2K standard, NEAREST is really special.
- Tobi