Skip to content
This repository has been archived by the owner on Jun 5, 2022. It is now read-only.

Add more ES6 functions #19

Closed
wants to merge 2 commits into from

Conversation

minoki
Copy link

@minoki minoki commented Mar 3, 2018

Add more ES6 functions, expanding #18. They include:

  • hyperbolic functions and inverses of them
    • acosh, asinh, atanh
    • cosh, sinh, tanh
  • variants of exponential function and logarithms
    • expm1
    • log1p, log10, log2
  • cbrt
  • clz32
  • hypot
  • hypot3
  • sign

Polyfills are provided for the old browesers, but they use naive method for calculation, and subject to loss of precision and undue overflow. People who mind numeric precision should load a better polyfill. (Maybe this should be documented?)

Among Math functions added in ES6, Math.fround is left out, because I think it is of little value without a type like Float32.

matthewleon and others added 2 commits November 20, 2017 14:09
The polyfills use naive method for calculation,
and subject to loss of precision and undue overflow.

If you want precision on old browsers, you should load a better polyfill beforehand.
@athanclark
Copy link

Anyone know if this will ever be accepted? @minoki @garyb

@JamieBallingall JamieBallingall mentioned this pull request Aug 11, 2021
@JordanMartinez
Copy link
Contributor

I'm taking a look at this now. Since this is a core library, how does this affect other backends? If this would potentially be forcing JS-specific stuff onto other backends, then this should be exported as a separate library.

For the polyfill issue, one could use a similar approach to what was decided in purescript-contrib/purescript-arraybuffer#34 (comment)

@JordanMartinez
Copy link
Contributor

Actually, based on the discussion in #31, this should be ported to purescript-numbers / purescript-int where applicable. I'll close this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants