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

Big_int shifting and eq_big_int problems #5262

Closed
vicuna opened this issue May 6, 2011 · 0 comments
Closed

Big_int shifting and eq_big_int problems #5262

vicuna opened this issue May 6, 2011 · 0 comments
Labels

Comments

@vicuna
Copy link

vicuna commented May 6, 2011

Original bug ID: 5262
Reporter: edmcman
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.0
Fixed in version: 3.12.1+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

Taking a small, positive integer < 2^n and shifting it to the right by n bits should result in 0. When using Big_ints, the resulting value v has the following properties: (string_of_big_int v) = "0" but (eq_big_int v zero_big_int) = false.

See the sample program:

open Big_int

let x = big_int_of_int 12;;
let sign = shift_right_big_int x 31;;

Printf.printf "sign: %s; sign==0: %b\n" (string_of_big_int sign) (eq_big_int sign zero_big_int);;

For me, this program displays: sign: 0; sign==0: false

I expect it to display: sign: 0; sign==0: true

@vicuna vicuna closed this as completed Sep 25, 2012
@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