fix(es/minifier): Fix comparison of -0.0 (#9012)

**Related issue:**

 - Closes #9007
This commit is contained in:
Donny/강동윤 2024-06-02 12:10:55 +09:00 committed by GitHub
parent d44ec65e36
commit 8a29577cc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -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()

View File

@ -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))

View File

@ -0,0 +1 @@
console.log(-0), console.log(-0), console.log(0), console.log(0);