-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ES6 Math Functions #29623
Comments
Can you recommend a polyfill for IE11?
If the implementation of the other 'intrinsics' on the VM is a guide, this is quite a lot of effort. To make these operations 'mesh' nicely with the surrounding arithmetic requires some work to be done for each architecture. imul and clz32 do not really make sense on the Dart VM.
|
Right now, Since ES6 version of JS Math is supported in all major browsers (except IE11), I think that support of these functions in Dart could be expected by developers. Of course, it doesn't have to precisely follow ECMA semantics: In terms of implementation, these functions could be grouped in two categories: Mathematical
For these, ECMAScript 6.0 spec says that they're implementation-dependent (as are regular trigonometric functions):
Other
Speaking of polyfills, there're simple examples on MDN, but they don't follow native behavior in some cases. |
Any update on this? |
@lrhn Can we consider adding these functions to |
Adding top-level functions is something that can technically be breaking, especially if they're lower-cased. The names are rather unique, and it requires importing Otherwise I'm fine with it, except for |
FFI is not yet at the stage where we can bind to these functions efficiently (at the same level of efficiency as |
JS runtime may still benefit from using sdk/sdk/lib/_internal/js_runtime/lib/js_number.dart Lines 533 to 536 in f8b2d9e
|
ECMAScript 6 has some new Math functions:
It would be great to have those exposed in
dart:math
, especially given that all modern browsers already support them (only IE11 needs polyfill).The text was updated successfully, but these errors were encountered: