This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,11 @@ macro_rules! assert_approx_eq {
151151 panic!( f) ;
152152 }
153153 } ;
154+ ( $result: expr, $expected: expr, ulp: $ulps: expr) => {
155+ if !$crate:: WithinUlps :: within_ulps( $result, $expected, $ulps) {
156+ panic!( "{:?} != {:?}" , $result, $expected) ;
157+ }
158+ }
154159}
155160
156161pub trait Toward : Sized {
Original file line number Diff line number Diff line change 11#![ cfg( test) ]
22
33use libm:: * ;
4+ use libm_test:: assert_approx_eq;
5+
46#[ test]
57fn remquo_q_overflow ( ) {
68 // 0xc000000000000001, 0x04c0000000000004
@@ -349,14 +351,19 @@ fn y1f_2002() {
349351fn fma_segfault_bug ( ) {
350352 // An attempt to substract with overflow was causing a segfault
351353 // on FMA for these inputs:
352- assert_eq ! (
354+ assert_approx_eq ! (
353355 fma(
354356 -0.0000000000000002220446049250313 ,
355357 -0.0000000000000002220446049250313 ,
356358 -0.0000000000000002220446049250313
357359 ) ,
358- -0.00000000000000022204460492503126
360+ -0.00000000000000022204460492503126 ,
361+ ulp: 0
359362 ) ;
360363
361- assert_eq ! ( fma( -0.992 , -0.992 , -0.992 ) , -0.00793599999988632 ) ;
364+ assert_approx_eq ! (
365+ fma( -0.992 , -0.992 , -0.992 ) ,
366+ -0.00793599999988632 ,
367+ ulp: 0
368+ ) ;
362369}
You can’t perform that action at this time.
0 commit comments