We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e963cd commit 84eecd7Copy full SHA for 84eecd7
jscomp/ml/bigint_utils.ml
@@ -62,7 +62,8 @@ let compare s0 s1 =
62
| _ ->
63
(* If both numbers are either negative or positive, compare their lengths. *)
64
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. *)
+ 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. *)
67
else if len0 > len1 then
68
if is_neg s0 then -1 else 1 (* A longer s0 means it's larger unless it's negative. *)
69
else (* len0 < len1 *)
0 commit comments