Skip Menu |

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

Report information
The Basics
Id: 104644
Status: new
Priority: 0/
Queue: Math-Trig

Owner: Nobody in particular
Requestors: pjacklam [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Subject: Poor numerical accuracy in sinh()
Download (untitled) / with headers
text/plain 228b
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
Download (untitled) / with headers
text/plain 162b
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
Download (untitled) / with headers
text/plain 542b
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 is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to