Skip to content

Commit 84eecd7

Browse files
committed
fix bigint_utils.compare
1 parent 5e963cd commit 84eecd7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jscomp/ml/bigint_utils.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ let compare s0 s1 =
6262
| _ ->
6363
(* If both numbers are either negative or positive, compare their lengths. *)
6464
let len0, len1 = (String.length s0, String.length s1) in
65-
if len0 = len1 then String.compare s0 s1 (* If lengths are equal, compare the strings directly. *)
65+
if len0 = len1 then
66+
if is_neg s0 then String.compare s1 s0 else String.compare s0 s1 (* If lengths are equal, compare the strings directly. *)
6667
else if len0 > len1 then
6768
if is_neg s0 then -1 else 1 (* A longer s0 means it's larger unless it's negative. *)
6869
else (* len0 < len1 *)

0 commit comments

Comments
 (0)