You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 3586 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
I've run across some odd problems with the Big_int module where some
expressions seem to evaluate to odd values. Here is some code that
demonstrates this problem:
(***********************************)
#load "nums.cma";;
open Big_int;;
let pow_of_two = power_int_positive_int 2;;
let pow13 bi = power_big_int_positive_int bi 13;;
(* This works fine )
string_of_big_int (pow13 (pow_of_two 51));;
(
Original bug ID: 3586
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
I've run across some odd problems with the Big_int module where some
expressions seem to evaluate to odd values. Here is some code that
demonstrates this problem:
(***********************************)
#load "nums.cma";;
open Big_int;;
let pow_of_two = power_int_positive_int 2;;
let pow13 bi = power_big_int_positive_int bi 13;;
(* This works fine )
string_of_big_int (pow13 (pow_of_two 51));;
(
- : string =
"38272525864510487788655081260950309410329935801733327822136058989190002
861848048793862592256319392263154317107227530633921701753935367770195646
260767912323717284188541295913442384799112073398408183808"
*)
(* This fails )
string_of_big_int (pow13 (pow_of_two 52));;
(
- : string = "0"
*)
(* This equivalent computation works )
string_of_big_int (pow_of_two (52 * 13));;
(
- : string =
"31352853188206991596466242568970493468942283408779942151893859523944450
344425921571932235576376846141976016574240793095308658076823853277344273
4168210737755891992072530296122920016274326105279759841755136"
*)
(* However, while it is converting to "0", it is not equal to 0 )
eq_big_int (pow13 (pow_of_two 52)) zero_big_int;;
(
- : bool = false
*)
(* But it's not 2^676 either... *)
eq_big_int (pow13 (pow_of_two 52)) (pow_of_two (52 * 13));;
(*
- : bool = false
*)
(* And just a bit more information )
lt_big_int (pow13 (pow_of_two 52)) unit_big_int;;
gt_big_int (pow13 (pow_of_two 52)) zero_big_int;;
(
*)
(***********************************)
A quick check reveals that (pow13 (pow_of_two x)) shows this problem
for x = 37, 42, 47, and 52-63 (0 <= x <= 100).
This problem occurs on both 3.08.0 under Mac OS X on a G4, and 3.08.1
under Linux on a P4. Let me know if you need any more information.
William D. Neumann
"You've got Rita Marlowe in the palm of your hand."
"Palm of my hand? You haven't seen Rita Marlowe..."
The text was updated successfully, but these errors were encountered: