@@ -441,6 +441,7 @@ macro_rules! rem_impl_integer {
441
441
442
442
rem_impl_integer ! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
443
443
444
+ #[ cfg( not( stage0) ) ]
444
445
macro_rules! rem_impl_float {
445
446
( $( $t: ty) * ) => ( $(
446
447
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -455,8 +456,48 @@ macro_rules! rem_impl_float {
455
456
) * )
456
457
}
457
458
459
+ #[ cfg( not( stage0) ) ]
458
460
rem_impl_float ! { f32 f64 }
459
461
462
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
463
+ #[ cfg( stage0) ]
464
+ impl Rem for f32 {
465
+ type Output = f32 ;
466
+
467
+ // The builtin f32 rem operator is broken when targeting
468
+ // MSVC; see comment in std::f32::floor.
469
+ // FIXME: See also #27859.
470
+ #[ inline]
471
+ #[ cfg( target_env = "msvc" ) ]
472
+ fn rem ( self , other : f32 ) -> f32 {
473
+ ( self as f64 ) . rem ( other as f64 ) as f32
474
+ }
475
+
476
+ #[ inline]
477
+ #[ cfg( not( target_env = "msvc" ) ) ]
478
+ fn rem ( self , other : f32 ) -> f32 {
479
+ extern { fn fmodf ( a : f32 , b : f32 ) -> f32 ; }
480
+ unsafe { fmodf ( self , other) }
481
+ }
482
+ }
483
+
484
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
485
+ #[ cfg( stage0) ]
486
+ impl Rem for f64 {
487
+ type Output = f64 ;
488
+
489
+ #[ inline]
490
+ fn rem ( self , other : f64 ) -> f64 {
491
+ extern { fn fmod ( a : f64 , b : f64 ) -> f64 ; }
492
+ unsafe { fmod ( self , other) }
493
+ }
494
+ }
495
+
496
+ #[ cfg( stage0) ]
497
+ forward_ref_binop ! { impl Rem , rem for f64 , f64 }
498
+ #[ cfg( stage0) ]
499
+ forward_ref_binop ! { impl Rem , rem for f32 , f32 }
500
+
460
501
/// The `Neg` trait is used to specify the functionality of unary `-`.
461
502
///
462
503
/// # Examples
0 commit comments