Changed to a more efficient implementation.
This commit is contained in:
parent
6cc9a26a2d
commit
3141acf674
2 changed files with 4 additions and 16 deletions
|
|
@ -147,18 +147,12 @@ pub fn gt(x: f32, y: f32) -> bool { return x > y; }
|
|||
|
||||
#[inline(always)]
|
||||
pub fn fmax(x: f32, y: f32) -> f32 {
|
||||
if x.is_NaN() { y }
|
||||
else if y.is_NaN() { x }
|
||||
else if x > y { x }
|
||||
else { y }
|
||||
if x >= y || y.is_NaN() { x } else { y }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn fmin(x: f32, y: f32) -> f32 {
|
||||
if x.is_NaN() { y }
|
||||
else if y.is_NaN() { x }
|
||||
else if x < y { x }
|
||||
else { y }
|
||||
if x <= y || y.is_NaN() { x } else { y }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -172,18 +172,12 @@ pub fn gt(x: f64, y: f64) -> bool { return x > y; }
|
|||
|
||||
#[inline(always)]
|
||||
pub fn fmax(x: f64, y: f64) -> f64 {
|
||||
if x.is_NaN() { y }
|
||||
else if y.is_NaN() { x }
|
||||
else if x > y { x }
|
||||
else { y }
|
||||
if x >= y || y.is_NaN() { x } else { y }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn fmin(x: f64, y: f64) -> f64 {
|
||||
if x.is_NaN() { y }
|
||||
else if y.is_NaN() { x }
|
||||
else if x < y { x }
|
||||
else { y }
|
||||
if x <= y || y.is_NaN() { x } else { y }
|
||||
}
|
||||
|
||||
// FIXME (#1999): add is_normal, is_subnormal, and fpclassify
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue