This queue is for tickets about the Math-Trig CPAN distribution.

Report information
The Basics
Id:
104644
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
peter.john.acklam [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Poor numerical accuracy in sinh()
When x ā‰ˆ 0, sinh(x) ā‰ˆ x. The following should return approximately 1e-16, but it returns 0: $ perl -MMath::Trig -wle 'print sinh(1e-16)' 0 Python gets it right ā€¦ $ python3 -c 'import math; print(math.sinh(1e-16))' 1e-16
The same goes for tanh(). $ perl -MMath::Trig -wle 'print tanh(1e-16)' 0 Again, Python gets it right: $ python3 -c 'import math; print(math.tanh(1e-16))' 1e-16
asinh() has the same problem: $ perl -MMath::Trig -wle 'print asinh(1e-18)' 0 $ python3 -c 'import math; print(math.asinh(1e-18))' 1e-18 as does atanh(): $ perl -MMath::Trig -wle 'print atanh(1e-18)' 0 $ python3 -c 'import math; print(math.atanh(1e-18))' 1e-18 All of the functions sinh(), asinh(), tan(), and atanh() are approximately equal to x, when x is close to zero. It seems that with Math::Trig, these functions return zero even in cases where a more accurate result is well within the numerical range supported by Perl scalars.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.