Skip to content
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

Evaluate returns double instead int #16

Open
fiFoFy opened this issue Apr 9, 2021 · 3 comments
Open

Evaluate returns double instead int #16

fiFoFy opened this issue Apr 9, 2021 · 3 comments

Comments

@fiFoFy
Copy link

fiFoFy commented Apr 9, 2021

When the number greater then 2147483647 in Dart I get double value.

Example:

2147483647 (JS) -> 2147483647 (Dart)
2147483648 (JS) -> 2147483648.0 (Dart)
@ekibun
Copy link
Owner

ekibun commented Apr 13, 2021

In quickjs, integer larger than 2147483647 is stored in double
please see https://262.ecma-international.org/5.1/#sec-8.5
and https://bellard.org/quickjs/quickjs.html#Numbers

@fiFoFy
Copy link
Author

fiFoFy commented Apr 14, 2021

It may make sense to somehow change this behavior, because it is logical that the int in Javascript is compatible with int in Dart? It turns out that depending on the size of the number, we have to interpret the result differently.

For example: If the user is using the package built_value then this behavior creates problems (I know how to solve it with built_value, but it is unexpected behavior).

@ekibun
Copy link
Owner

ekibun commented Apr 15, 2021

I do not know what behavior you want. Is there any problem that using num type in package built_value?

Currently type wrapper cannot tell whether the passed js float point value is integer or not.

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

No branches or pull requests

2 participants