Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/tests/lib/libm



On Wed, Jan 21, 2015 at 10:09:55PM +0900, Tetsuya Isaki wrote:
> At Wed, 15 Oct 2014 19:48:53 +0100,
> David Laight wrote:
> > > 
> > > Log Message:
> > > In the exp2_values test case, provide separate expected return values
> > > for the float case, reflecting the actual exp2f() argument value after
> > > rounding to float precision.  Fixes PR lib/49256.  Thanks to Makoto
> > > Kamada and Tetsuya Isaki for the analysis.
> > 
> > The reason I left the tests failing is that the results should be more
> > accurate than the values that are actually returned.
> > 
> > Changing the 'expected' values so that the tests pass is just wrong.
...
> > I think the values ought to be accurate to one or two counts on the lsb
> > of the mantissa.
> 
> It is not an acuuracy problem of result, is an implicit type cast
> problem of argument.
> 
> exp2()'s argument is double and exp2f()'s is float.
> 
> As you know,
> exp2(7.7) means exp2((double)7.7) and
> exp2f(7.7) means exp2f((float)7.7).
> 
> (double)7.7 = 0x1.ecccccccccccdp+2 in "%a" format
> (float)7.7  = 0x1.ecccccp+2 in "%a" format

I'd forgetten to allow for that difference, and the change didn't
mention it either.
I'd expect (double)exp2f(f) to differ from exp2((double)f) by only
1 or 2 counts in the mantissa. You definitely want to use the
lattet calculation to get the check value.

It is 'interesting' that (float)7.7 gets truncated rather than
rounded. I'd expect 7.7f to be 0x1eccccdp+2, which would bring
the result into the old bounds.

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index