Skip to content

Commit e727703

Browse files
committed
Revert "remove canonicalization"
This reverts commit 0416cf4.
1 parent 4393bca commit e727703

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

libm/src/math/generic/fmaximum.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ use crate::support::Float;
1313

1414
#[inline]
1515
pub fn fmaximum<F: Float>(x: F, y: F) -> F {
16-
if x.is_nan() {
16+
let res = if x.is_nan() {
1717
x
1818
} else if y.is_nan() {
1919
y
2020
} else if x > y || (y.biteq(F::NEG_ZERO) && x.is_sign_positive()) {
2121
x
2222
} else {
2323
y
24-
}
24+
};
25+
26+
// Canonicalize
27+
res * F::ONE
2528
}

libm/src/math/generic/fmaximum_num.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ use crate::support::Float;
1515

1616
#[inline]
1717
pub fn fmaximum_num<F: Float>(x: F, y: F) -> F {
18-
if x > y || y.is_nan() {
18+
let res = if x > y || y.is_nan() {
1919
x
2020
} else if y > x || x.is_nan() {
2121
y
2222
} else if x.is_sign_positive() {
2323
x
2424
} else {
2525
y
26-
}
26+
};
27+
28+
// Canonicalize
29+
res * F::ONE
2730
}

libm/src/math/generic/fminimum.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ use crate::support::Float;
1313

1414
#[inline]
1515
pub fn fminimum<F: Float>(x: F, y: F) -> F {
16-
if x.is_nan() {
16+
let res = if x.is_nan() {
1717
x
1818
} else if y.is_nan() {
1919
y
2020
} else if x < y || (x.biteq(F::NEG_ZERO) && y.is_sign_positive()) {
2121
x
2222
} else {
2323
y
24-
}
24+
};
25+
26+
// Canonicalize
27+
res * F::ONE
2528
}

libm/src/math/generic/fminimum_num.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ use crate::support::Float;
1515

1616
#[inline]
1717
pub fn fminimum_num<F: Float>(x: F, y: F) -> F {
18-
if x > y || x.is_nan() {
18+
let res = if x > y || x.is_nan() {
1919
y
2020
} else if y > x || y.is_nan() {
2121
x
2222
} else if x.is_sign_positive() {
2323
y
2424
} else {
2525
x
26-
}
26+
};
27+
28+
// Canonicalize
29+
res * F::ONE
2730
}

0 commit comments

Comments
 (0)