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

Fix intDiv for bigints by not using floats #2

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

MonoidMusician
Copy link

I tested that this agrees with behavior of the JS Prelude for negative integers

unfortunately both purerl and purescript-backend-erl will optimize to regular Erlang div (in different scenarios, since backend-erl does optimizations), so the correctness of this FFI implementation ends up not mattering much

(how I found the bigint bug was by disabling the optimization)

Proof that this works for bigints:

3> 80126697530880000000000 / 55319040000000000.
1448446.9999999998
4> intDiv(80126697530880000000000, 55319040000000000).
1448447

Agrees with behavior of JS Prelude for negative integers
@nwolverson nwolverson merged commit 162e9d2 into purerl:master Apr 5, 2024
1 check failed
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

Successfully merging this pull request may close these issues.

2 participants