File tree 4 files changed +310
-61
lines changed
4 files changed +310
-61
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ pub struct TestCase<Op: MathOp> {
18
18
}
19
19
20
20
impl < Op : MathOp > TestCase < Op > {
21
- #[ expect( dead_code) ]
22
21
fn append_inputs ( v : & mut Vec < Self > , l : & [ Op :: RustArgs ] ) {
23
22
v. extend ( l. iter ( ) . copied ( ) . map ( |input| Self {
24
23
input,
@@ -458,7 +457,18 @@ fn frexpf_cases() -> Vec<TestCase<op::frexpf::Routine>> {
458
457
}
459
458
460
459
fn hypot_cases ( ) -> Vec < TestCase < op:: hypot:: Routine > > {
461
- vec ! [ ]
460
+ let mut v = vec ! [ ] ;
461
+ TestCase :: append_inputs (
462
+ & mut v,
463
+ & [
464
+ // Cases that can overflow exponent if wrapping arithmetic is not used
465
+ ( hf64 ! ( "-0x1.800f800f80100p+1023" ) , hf64 ! ( "0x1.8354835473720p+996" ) ) ,
466
+ ( hf64 ! ( "0x1.201b201b201c0p+0" ) , hf64 ! ( "0x1.b028b028b02a0p-1" ) ) ,
467
+ ( hf64 ! ( "-0x1.e538e538e564p+980" ) , hf64 ! ( "-0x1.c4dfc4dfc508p+983" ) ) ,
468
+ ( hf64 ! ( "-0x1.2f22e4f77aa58p+983" ) , hf64 ! ( "-0x1.44c9f5524c8ccp+980" ) ) ,
469
+ ] ,
470
+ ) ;
471
+ v
462
472
}
463
473
464
474
fn hypotf_cases ( ) -> Vec < TestCase < op:: hypotf:: Routine > > {
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
48
48
49
49
// Operations that aren't required to be exact, but our implementations are.
50
50
Bn :: Cbrt => 0 ,
51
+ Bn :: Hypot if ctx. fn_ident == Id :: Hypot => 0 ,
51
52
52
53
// Bessel functions have large inaccuracies.
53
54
Bn :: J0 | Bn :: J1 | Bn :: Y0 | Bn :: Y1 | Bn :: Jn | Bn :: Yn => 8_000_000 ,
@@ -100,6 +101,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
100
101
Id :: Cbrt => ulp = 2 ,
101
102
// FIXME(#401): musl has an incorrect result here.
102
103
Id :: Fdim => ulp = 2 ,
104
+ Id :: Hypot => ulp = 1 ,
103
105
Id :: Sincosf => ulp = 500 ,
104
106
Id :: Tgamma => ulp = 20 ,
105
107
_ => ( ) ,
Original file line number Diff line number Diff line change 8
8
) ]
9
9
#![ cfg_attr( f128_enabled, feature( f128) ) ]
10
10
#![ cfg_attr( f16_enabled, feature( f16) ) ]
11
+ #![ allow( internal_features) ]
11
12
#![ allow( clippy:: assign_op_pattern) ]
12
13
#![ allow( clippy:: deprecated_cfg_attr) ]
13
14
#![ allow( clippy:: eq_op) ]
You can’t perform that action at this time.
0 commit comments