On 2014/08/12 08:59:52, Yang wrote:
On 2014/08/11 20:04:35, Raymond Toy wrote:
> Looks good, but I have one last comment.
>
>
https://codereview.chromium.org/457643002/diff/1/test/mjsunit/es6/math-log1p.js
> File test/mjsunit/es6/math-log1p.js (right):
>
>
https://codereview.chromium.org/457643002/diff/1/test/mjsunit/es6/math-log1p.js#newcode20
> test/mjsunit/es6/math-log1p.js:20:
> On 2014/08/11 07:51:06, Yang wrote:
> > On 2014/08/08 17:32:16, Raymond Toy wrote:
> > > Although not part of the CL, I noticed this. I think this test
should
avoid
> > > testing down to 0.1, where log(x+1) and log1p(x) are supposed to be
> different.
> > > Based on the comments from fdlibm log1p(x) = log(1+x) when x > 2^53.
Then
> > your
> > > delta should be zero, or at least closer to 1.1e-16 (float epsilon).
> >
> > Done.
>
> Why 1e2 and not 2^53?. It's obviously true for x > 2^53 that 1+x = x so
log1p(x)
> == log(1+x). In fact, testing a few random values quickly finds, for
example,
>
> x = 203.02512450909163d0
> log(1+x) = 5.318243145619017d0
> log1p(x) = 5.318243145619018d0
>
> (Both log and log1p used fdlibm algorithm)
>
> So, what is the intent of this test? That log1p is close to log(1+x)?
If so,
you
> should say so in a comment, and describe why 1e-14 is a good threshold
for
this.
I see. The original implementation did not have high accuracy as goal. The
test
is more of a sanity check: for reasonably large numbers, log1p(x) should
stay
reasonably close to log(1+x), with "reasonably" being 1E-14. Obviously,
now
that
we have a more accurate implementation, that test can be made more
strict. I
changed it to x > 1E16.
I think you should have added a comment for the test that log1p(x) =
log(1+x)
for x > 2^53 (or 1e16). 1e16 now looks like some random number without
explanation of why.
I'm also curious if log1p(x) really is equal to log(1+x) so that the
threshold
of 1e-16 could actually be 0. But that's for another day.
https://codereview.chromium.org/457643002/
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.