mirror of
https://github.com/swc-project/swc.git
synced 2024-11-23 00:32:15 +03:00
fix(es/minifier): Fix comparison of -0.0
(#9012)
**Related issue:** - Closes #9007
This commit is contained in:
parent
d44ec65e36
commit
8a29577cc5
@ -760,12 +760,12 @@ impl Visit for SuperFinder {
|
||||
}
|
||||
|
||||
fn cmp_num(a: f64, b: f64) -> Ordering {
|
||||
if a == -0.0 && b == 0.0 {
|
||||
return Ordering::Greater;
|
||||
if a == 0.0 && a.is_sign_negative() && b == 0.0 && b.is_sign_positive() {
|
||||
return Ordering::Less;
|
||||
}
|
||||
|
||||
if a == 0.0 && b == -0.0 {
|
||||
return Ordering::Less;
|
||||
if a == 0.0 && a.is_sign_positive() && b == 0.0 && b.is_sign_negative() {
|
||||
return Ordering::Greater;
|
||||
}
|
||||
|
||||
a.partial_cmp(&b).unwrap()
|
||||
|
@ -0,0 +1,4 @@
|
||||
console.log(Math.min(-0, 0))
|
||||
console.log(Math.min(0, -0))
|
||||
console.log(Math.max(-0, 0))
|
||||
console.log(Math.max(0, -0))
|
@ -0,0 +1 @@
|
||||
console.log(-0), console.log(-0), console.log(0), console.log(0);
|
Loading…
Reference in New Issue
Block a user