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

%intoffloat inconsistency #6739

Open
mununki opened this issue Apr 21, 2024 · 0 comments
Open

%intoffloat inconsistency #6739

mununki opened this issue Apr 21, 2024 · 0 comments

Comments

@mununki
Copy link
Member

mununki commented Apr 21, 2024

let i0 = (22130921800000. -. 0.)->Belt.Float.toInt
let i1 = (22130921800000.)->Belt.Float.toInt

generates

var i0 = 22130921800000 - 0 | 0; // -1044676288
var i1 = 2147483647; // max value of Int32

i1 is converted from Int32.of_float by the lam optimization, which seems to result in a platform-dependent value. How about treating it the same as i0 instead?

var i0 = 22130921800000 - 0 | 0; // -1044676288
var i1 = 22130921800000 | 0; // -1044676288
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

1 participant