This repository was archived by the owner on Apr 28, 2025. It is now read-only.
File tree 2 files changed +15
-3
lines changed
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 {
151
151
panic!( f) ;
152
152
}
153
153
} ;
154
+ ( $result: expr, $expected: expr, ulp: $ulps: expr) => {
155
+ if !$crate:: WithinUlps :: within_ulps( $result, $expected, $ulps) {
156
+ panic!( "{:?} != {:?}" , $result, $expected) ;
157
+ }
158
+ }
154
159
}
155
160
156
161
pub trait Toward : Sized {
Original file line number Diff line number Diff line change 1
1
#![ cfg( test) ]
2
2
3
3
use libm:: * ;
4
+ use libm_test:: assert_approx_eq;
5
+
4
6
#[ test]
5
7
fn remquo_q_overflow ( ) {
6
8
// 0xc000000000000001, 0x04c0000000000004
@@ -349,14 +351,19 @@ fn y1f_2002() {
349
351
fn fma_segfault_bug ( ) {
350
352
// An attempt to substract with overflow was causing a segfault
351
353
// on FMA for these inputs:
352
- assert_eq ! (
354
+ assert_approx_eq ! (
353
355
fma(
354
356
-0.0000000000000002220446049250313 ,
355
357
-0.0000000000000002220446049250313 ,
356
358
-0.0000000000000002220446049250313
357
359
) ,
358
- -0.00000000000000022204460492503126
360
+ -0.00000000000000022204460492503126 ,
361
+ ulp: 0
359
362
) ;
360
363
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
+ ) ;
362
369
}
You can’t perform that action at this time.
0 commit comments