@@ -86,8 +86,6 @@ delegate!(
86
86
fn erfc( n: c_float) -> c_float = c_float_utils:: erfc,
87
87
fn exp_m1( n: c_float) -> c_float = c_float_utils:: exp_m1,
88
88
fn abs_sub( a: c_float, b: c_float) -> c_float = c_float_utils:: abs_sub,
89
- fn fmax( a: c_float, b: c_float) -> c_float = c_float_utils:: fmax,
90
- fn fmin( a: c_float, b: c_float) -> c_float = c_float_utils:: fmin,
91
89
fn next_after( x: c_float, y: c_float) -> c_float = c_float_utils:: next_after,
92
90
fn frexp( n: c_float, value: & mut c_int) -> c_float = c_float_utils:: frexp,
93
91
fn hypot( x: c_float, y: c_float) -> c_float = c_float_utils:: hypot,
@@ -147,6 +145,22 @@ pub fn ge(x: f32, y: f32) -> bool { return x >= y; }
147
145
#[ inline( always) ]
148
146
pub fn gt ( x : f32 , y : f32 ) -> bool { return x > y; }
149
147
148
+ #[ inline( always) ]
149
+ pub fn fmax ( x : f32 , y : f32 ) -> f32 {
150
+ if x. is_NaN ( ) { y }
151
+ else if y. is_NaN ( ) { x }
152
+ else if x > y { x }
153
+ else { y }
154
+ }
155
+
156
+ #[ inline( always) ]
157
+ pub fn fmin ( x : f32 , y : f32 ) -> f32 {
158
+ if x. is_NaN ( ) { y }
159
+ else if y. is_NaN ( ) { x }
160
+ else if x < y { x }
161
+ else { y }
162
+ }
163
+
150
164
151
165
// FIXME (#1999): replace the predicates below with llvm intrinsics or
152
166
// calls to the libmath macros in the rust runtime for performance.
0 commit comments