Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
sinh not too accurate for numbers approaching -1 or 1 #484
A 5th degree Taylor expansion for sinh, as currently used by mathjs, isn’t very accurate when you get away from zero. For instance, with x = 0.99, it has an error of ~1.87e-4 (according to Wolfram Alpha).
As an alternative, you could use the degree 17 Taylor expansion the way the GNU Scientific Library does for the range [-1, 1], or you could e.g. use a Chebyshev series expansion.
Also, it probably makes sense to defer to the native Math.sinh function if it is defined. (Part of ECMAScript 6.)
I've fixed this in the