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