@@ -921,9 +921,18 @@ fn test_algebraic() {
921921 let a: f32 = 123.0 ;
922922 let b: f32 = 456.0 ;
923923
924- assert_approx_eq ! ( a. algebraic_add( b) , a + b, 1e-3 ) ;
925- assert_approx_eq ! ( a. algebraic_sub( b) , a - b, 1e-3 ) ;
926- assert_approx_eq ! ( a. algebraic_mul( b) , a * b, 1e-1 ) ;
927- assert_approx_eq ! ( a. algebraic_div( b) , a / b, 1e-4 ) ;
928- assert_approx_eq ! ( a. algebraic_rem( b) , a % b, 1e-4 ) ;
924+ // Check that individual operations match their primitive counterparts.
925+ //
926+ // This is a check of current implementations and does NOT imply any form of
927+ // guarantee about future behavior. The compiler reserves the right to make
928+ // these operations inexact matches in the future.
929+ let eps_add = if cfg ! ( miri) { 1e-3 } else { 0.0 } ;
930+ let eps_mul = if cfg ! ( miri) { 1e-1 } else { 0.0 } ;
931+ let eps_div = if cfg ! ( miri) { 1e-4 } else { 0.0 } ;
932+
933+ assert_approx_eq ! ( a. algebraic_add( b) , a + b, eps_add) ;
934+ assert_approx_eq ! ( a. algebraic_sub( b) , a - b, eps_add) ;
935+ assert_approx_eq ! ( a. algebraic_mul( b) , a * b, eps_mul) ;
936+ assert_approx_eq ! ( a. algebraic_div( b) , a / b, eps_div) ;
937+ assert_approx_eq ! ( a. algebraic_rem( b) , a % b, eps_div) ;
929938}
0 commit comments