Skip to content

sinh not too accurate for numbers approaching -1 or 1 #484

@jrus

Description

@jrus

I left a comment on the relevant pull request, but I figured I should make a separate issue, in case nobody sees that one. Ping @pavpanchekha.

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions