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: 6753 Reporter: furuse Status: closed (set by @xavierleroy on 2016-12-07T10:49:10Z) Resolution: fixed Priority: normal Severity: major Version: 4.02.1 Target version: 4.02.2+dev / +rc1 Fixed in version: 4.02.2+dev / +rc1 Category: otherlibs Monitored by:@gasche@hcarty
Bug description
Big_int.mod_big_int returns always 0 or positive, as stated in its document, i.e. (-5) mod 3 = 1 in Big_int.
However, in Num, the results are unstable:
mod_num (num_of_big_int (big_int_of_int (-5)) (num_of_big_int (big_int_of_int 3)) returns -2, probably because -5 and 3 are represented as Int (-5) and Int 3.
It's worse than you think: there are 9 cases to test (for a and b each being one of Int, Big_int, Ratio).
See the attached test file:
When a and b are both positive, all is well.
When a is negative the Int/Int case is wrong.
When b is negative, the Ratio/* and */Ratio cases are wrong.
Original bug ID: 6753
Reporter: furuse
Status: closed (set by @xavierleroy on 2016-12-07T10:49:10Z)
Resolution: fixed
Priority: normal
Severity: major
Version: 4.02.1
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.02.2+dev / +rc1
Category: otherlibs
Monitored by: @gasche @hcarty
Bug description
Big_int.mod_big_int returns always 0 or positive, as stated in its document, i.e. (-5) mod 3 = 1 in Big_int.
However, in Num, the results are unstable:
mod_num (num_of_big_int (big_int_of_int (-5)) (num_of_big_int (big_int_of_int 3)) returns -2, probably because -5 and 3 are represented as Int (-5) and Int 3.
mod_num (Big_int (big_int_of_int (-5)) (Big_int (big_int_of_int 3)) returns 1.
Well, mod_num saids nothing about its results in details so it is not strictly a bug but this should be filed at least.
File attachments
The text was updated successfully, but these errors were encountered: