-
Notifications
You must be signed in to change notification settings - Fork 464
lsr(-123, 0) not equiv. to -123 >>> 0 #7222
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
Comments
i think these #7171 enhancements will fix what ever issue we are having here. But i found an inconstency from OCaml Lib here.
|
So it's not a bug because JS converts it to an unsigned 32-bit integer before shifting.
However, in JS, @cometkim if our goal is to match javascript, should we change the implementation of bitwise to match the javascript? |
We can discuss it further at rescript-lang/rfcs#1, but as already mentioned it is not the current goal. One day we might be able to treat int32 like a specialized second-class citizen, but the migration path won't be simple. |
That explains it. Sometimes we forget how crazy JS can be. Maybe a heads up is enough when documenting |
While converting a JS program to rescript I discovered that
lsr(-123,0)
is compiled to just-123
which is not equivalent to-123 >>> 0
. I wonder if this is a bug?https://rescript-lang.org/try?version=v11.1.4&module=esmodule&code=DYUwLgBAHhC8HAM4CcAUBaAjAJgMwBoAGASgChRIBPOCAUmQEMB3VAIizwgD4eJDWypAFKIAdMAD2Ac1QxY8SsSA
The text was updated successfully, but these errors were encountered: