@@ -216,63 +216,6 @@ impl Float for f32 {
216216 ( mantissa as u64 , exponent, sign)
217217 }
218218
219- /// Rounds towards minus infinity.
220- #[ inline]
221- fn floor ( self ) -> f32 {
222- return floorf ( self ) ;
223-
224- // On MSVC LLVM will lower many math intrinsics to a call to the
225- // corresponding function. On MSVC, however, many of these functions
226- // aren't actually available as symbols to call, but rather they are all
227- // `static inline` functions in header files. This means that from a C
228- // perspective it's "compatible", but not so much from an ABI
229- // perspective (which we're worried about).
230- //
231- // The inline header functions always just cast to a f64 and do their
232- // operation, so we do that here as well, but only for MSVC targets.
233- //
234- // Note that there are many MSVC-specific float operations which
235- // redirect to this comment, so `floorf` is just one case of a missing
236- // function on MSVC, but there are many others elsewhere.
237- #[ cfg( target_env = "msvc" ) ]
238- fn floorf ( f : f32 ) -> f32 { ( f as f64 ) . floor ( ) as f32 }
239- #[ cfg( not( target_env = "msvc" ) ) ]
240- fn floorf ( f : f32 ) -> f32 { unsafe { intrinsics:: floorf32 ( f) } }
241- }
242-
243- /// Rounds towards plus infinity.
244- #[ inline]
245- fn ceil ( self ) -> f32 {
246- return ceilf ( self ) ;
247-
248- // see notes above in `floor`
249- #[ cfg( target_env = "msvc" ) ]
250- fn ceilf ( f : f32 ) -> f32 { ( f as f64 ) . ceil ( ) as f32 }
251- #[ cfg( not( target_env = "msvc" ) ) ]
252- fn ceilf ( f : f32 ) -> f32 { unsafe { intrinsics:: ceilf32 ( f) } }
253- }
254-
255- /// Rounds to nearest integer. Rounds half-way cases away from zero.
256- #[ inline]
257- fn round ( self ) -> f32 {
258- unsafe { intrinsics:: roundf32 ( self ) }
259- }
260-
261- /// Returns the integer part of the number (rounds towards zero).
262- #[ inline]
263- fn trunc ( self ) -> f32 {
264- unsafe { intrinsics:: truncf32 ( self ) }
265- }
266-
267- /// The fractional part of the number, satisfying:
268- ///
269- /// ```
270- /// let x = 1.65f32;
271- /// assert!(x == x.trunc() + x.fract())
272- /// ```
273- #[ inline]
274- fn fract ( self ) -> f32 { self - self . trunc ( ) }
275-
276219 /// Computes the absolute value of `self`. Returns `Float::nan()` if the
277220 /// number is `Float::nan()`.
278221 #[ inline]
@@ -308,14 +251,6 @@ impl Float for f32 {
308251 self < 0.0 || ( 1.0 / self ) == Float :: neg_infinity ( )
309252 }
310253
311- /// Fused multiply-add. Computes `(self * a) + b` with only one rounding
312- /// error. This produces a more accurate result with better performance than
313- /// a separate multiplication operation followed by an add.
314- #[ inline]
315- fn mul_add ( self , a : f32 , b : f32 ) -> f32 {
316- unsafe { intrinsics:: fmaf32 ( self , a, b) }
317- }
318-
319254 /// Returns the reciprocal (multiplicative inverse) of the number.
320255 #[ inline]
321256 fn recip ( self ) -> f32 { 1.0 / self }
@@ -325,81 +260,6 @@ impl Float for f32 {
325260 unsafe { intrinsics:: powif32 ( self , n) }
326261 }
327262
328- #[ inline]
329- fn powf ( self , n : f32 ) -> f32 {
330- return powf ( self , n) ;
331-
332- // see notes above in `floor`
333- #[ cfg( target_env = "msvc" ) ]
334- fn powf ( f : f32 , n : f32 ) -> f32 { ( f as f64 ) . powf ( n as f64 ) as f32 }
335- #[ cfg( not( target_env = "msvc" ) ) ]
336- fn powf ( f : f32 , n : f32 ) -> f32 { unsafe { intrinsics:: powf32 ( f, n) } }
337- }
338-
339- #[ inline]
340- fn sqrt ( self ) -> f32 {
341- if self < 0.0 {
342- NAN
343- } else {
344- unsafe { intrinsics:: sqrtf32 ( self ) }
345- }
346- }
347-
348- #[ inline]
349- fn rsqrt ( self ) -> f32 { self . sqrt ( ) . recip ( ) }
350-
351- /// Returns the exponential of the number.
352- #[ inline]
353- fn exp ( self ) -> f32 {
354- return expf ( self ) ;
355-
356- // see notes above in `floor`
357- #[ cfg( target_env = "msvc" ) ]
358- fn expf ( f : f32 ) -> f32 { ( f as f64 ) . exp ( ) as f32 }
359- #[ cfg( not( target_env = "msvc" ) ) ]
360- fn expf ( f : f32 ) -> f32 { unsafe { intrinsics:: expf32 ( f) } }
361- }
362-
363- /// Returns 2 raised to the power of the number.
364- #[ inline]
365- fn exp2 ( self ) -> f32 {
366- unsafe { intrinsics:: exp2f32 ( self ) }
367- }
368-
369- /// Returns the natural logarithm of the number.
370- #[ inline]
371- fn ln ( self ) -> f32 {
372- return logf ( self ) ;
373-
374- // see notes above in `floor`
375- #[ cfg( target_env = "msvc" ) ]
376- fn logf ( f : f32 ) -> f32 { ( f as f64 ) . ln ( ) as f32 }
377- #[ cfg( not( target_env = "msvc" ) ) ]
378- fn logf ( f : f32 ) -> f32 { unsafe { intrinsics:: logf32 ( f) } }
379- }
380-
381- /// Returns the logarithm of the number with respect to an arbitrary base.
382- #[ inline]
383- fn log ( self , base : f32 ) -> f32 { self . ln ( ) / base. ln ( ) }
384-
385- /// Returns the base 2 logarithm of the number.
386- #[ inline]
387- fn log2 ( self ) -> f32 {
388- unsafe { intrinsics:: log2f32 ( self ) }
389- }
390-
391- /// Returns the base 10 logarithm of the number.
392- #[ inline]
393- fn log10 ( self ) -> f32 {
394- return log10f ( self ) ;
395-
396- // see notes above in `floor`
397- #[ cfg( target_env = "msvc" ) ]
398- fn log10f ( f : f32 ) -> f32 { ( f as f64 ) . log10 ( ) as f32 }
399- #[ cfg( not( target_env = "msvc" ) ) ]
400- fn log10f ( f : f32 ) -> f32 { unsafe { intrinsics:: log10f32 ( f) } }
401- }
402-
403263 /// Converts to degrees, assuming the number is in radians.
404264 #[ inline]
405265 fn to_degrees ( self ) -> f32 { self * ( 180.0f32 / consts:: PI ) }
0 commit comments