@@ -2,11 +2,11 @@ pub mod gen;
2
2
#[ cfg( feature = "test-multiprecision" ) ]
3
3
pub mod mpfloat;
4
4
mod num_traits;
5
- mod special_case ;
5
+ mod precision ;
6
6
mod test_traits;
7
7
8
8
pub use num_traits:: { Float , Hex , Int } ;
9
- pub use special_case :: { MaybeOverride , SpecialCase } ;
9
+ pub use precision :: { MaybeOverride , SpecialCase , multiprec_allowed_ulp , musl_allowed_ulp } ;
10
10
pub use test_traits:: { CheckBasis , CheckCtx , CheckOutput , GenerateInput , TupleCall } ;
11
11
12
12
/// Result type for tests is usually from `anyhow`. Most times there is no success value to
@@ -16,59 +16,6 @@ pub type TestResult<T = (), E = anyhow::Error> = Result<T, E>;
16
16
// List of all files present in libm's source
17
17
include ! ( concat!( env!( "OUT_DIR" ) , "/all_files.rs" ) ) ;
18
18
19
- /// Default ULP allowed to differ from musl (note that musl itself may not be accurate).
20
- const MUSL_DEFAULT_ULP : u32 = 2 ;
21
-
22
- /// Default ULP allowed to differ from multiprecision (i.e. infinite) results.
23
- const MULTIPREC_DEFAULT_ULP : u32 = 1 ;
24
-
25
- /// ULP allowed to differ from muls results.
26
- ///
27
- /// Note that these results were obtained using 400,000,000 rounds of random inputs, which
28
- /// is not a value used by default.
29
- pub fn musl_allowed_ulp ( name : & str ) -> u32 {
30
- // Consider overrides xfail
31
- match name {
32
- #[ cfg( x86_no_sse) ]
33
- "asinh" | "asinhf" => 6 ,
34
- "lgamma" | "lgamma_r" | "lgammaf" | "lgammaf_r" => 400 ,
35
- "tanh" | "tanhf" => 4 ,
36
- "tgamma" => 20 ,
37
- "j0" | "j0f" | "j1" | "j1f" => {
38
- // Results seem very target-dependent
39
- if cfg ! ( target_arch = "x86_64" ) { 4000 } else { 800_000 }
40
- }
41
- "jn" | "jnf" => 1000 ,
42
- "sincosf" => 500 ,
43
- #[ cfg( not( target_pointer_width = "64" ) ) ]
44
- "exp10" => 4 ,
45
- #[ cfg( not( target_pointer_width = "64" ) ) ]
46
- "exp10f" => 4 ,
47
- _ => MUSL_DEFAULT_ULP ,
48
- }
49
- }
50
-
51
- /// ULP allowed to differ from multiprecision results.
52
- pub fn multiprec_allowed_ulp ( name : & str ) -> u32 {
53
- // Consider overrides xfail
54
- match name {
55
- "asinh" | "asinhf" => 2 ,
56
- "acoshf" => 4 ,
57
- "atanh" | "atanhf" => 2 ,
58
- "exp10" | "exp10f" => 3 ,
59
- "j0" | "j0f" | "j1" | "j1f" => {
60
- // Results seem very target-dependent
61
- if cfg ! ( target_arch = "x86_64" ) { 4000 } else { 800_000 }
62
- }
63
- "jn" | "jnf" => 1000 ,
64
- "lgamma" | "lgammaf" | "lgamma_r" | "lgammaf_r" => 16 ,
65
- "sinh" | "sinhf" => 2 ,
66
- "tanh" | "tanhf" => 2 ,
67
- "tgamma" => 20 ,
68
- _ => MULTIPREC_DEFAULT_ULP ,
69
- }
70
- }
71
-
72
19
/// Return the unsuffixed version of a function name; e.g. `abs` and `absf` both return `abs`,
73
20
/// `lgamma_r` and `lgammaf_r` both return `lgamma_r`.
74
21
pub fn canonical_name ( name : & str ) -> & str {
0 commit comments