Comment #4 on issue 3266 by [email protected]: Numeric issues in hyperbolic
functions
http://code.google.com/p/v8/issues/detail?id=3266
I think atanh(x) = 1/2*log((1-x)/(1+x)) = 1/2 * log(1-2*x/(1+x)) =
1/2*log1p(-2*x/(1+x)) is slightly better. Only one evaluation of log1p
needed.
Doesn't your asinh formula have issues with very small x? log(x + x*l(x))
is approximately log(x+1) which loses if x is very small. I guess you would
use log1p(x) in this case, once you picked the region where this is
applicable.
My approach would be the following algorithm.
asinh(-x) = -asinh(x)
asinh(x) = log(1+x) = log1p(x) for msall x where 1+x^2 = 1 so that
x+sqrt(1+x^2) = x + 1.
asinh(x) = log(2*x) = log(2) + log(x) for large x where 1+x^2 = x^2 so
that x+sqrt(1+x^2) = x + sqrt(x^2) = 2*x.
asinh(x) = log(x+sqrt(1+x^2)) otherwise.
acosh(x) = log(x+sqrt(x^2-1)) = log(x-sqrt(x-1)*sqrt(x+1)) is probably good
enough everywhere except for large x. In that case, we do the same as for
asinh(x) and get acosh(x) = log(x+sqrt(x^2-1)) = log(x + x) + log(2) +
log(x), which is used when x^2 - 1 = x^2.
I doubt that these algorithms achieve an error of < 1ulp, but maybe 2-3
ulp. In any case, I think these are better than the current algorithms.
These are accurate for small x and don't overflow prematurely.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
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.