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

int64_of_big_int fails on negative values that fit in 32-bits #4804

Closed
vicuna opened this issue May 22, 2009 · 1 comment
Closed

int64_of_big_int fails on negative values that fit in 32-bits #4804

vicuna opened this issue May 22, 2009 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented May 22, 2009

Original bug ID: 4804
Reporter: davidgay
Status: closed (set by @xavierleroy on 2009-05-24T19:49:59Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.0
Fixed in version: 3.11.1+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

The following code:
open Big_int

let x = minus_big_int (power_int_positive_int 2 31)
let y = int64_of_big_int x

;;

Printf.printf "%s %Ld\n" (string_of_big_int x) y

produces

$ ocaml nums.cma foo.ml
Exception: Failure "int64_of_big_int".

Additional information

Seems to affect values between -2^31 and -2^32

@vicuna
Copy link
Author

vicuna commented May 24, 2009

Comment author: @xavierleroy

Fixed in 3.11 bugfix branch. Will go in 3.11.1.

@vicuna vicuna closed this as completed May 24, 2009
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant