@@ -2,11 +2,11 @@ pub mod gen;
22#[ cfg( feature = "test-multiprecision" ) ]
33pub mod mpfloat;
44mod num_traits;
5- mod special_case ;
5+ mod precision ;
66mod test_traits;
77
88pub 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 } ;
1010pub use test_traits:: { CheckBasis , CheckCtx , CheckOutput , GenerateInput , TupleCall } ;
1111
1212/// 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>;
1616// List of all files present in libm's source
1717include ! ( concat!( env!( "OUT_DIR" ) , "/all_files.rs" ) ) ;
1818
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-
7219/// Return the unsuffixed version of a function name; e.g. `abs` and `absf` both return `abs`,
7320/// `lgamma_r` and `lgammaf_r` both return `lgamma_r`.
7421pub fn canonical_name ( name : & str ) -> & str {
0 commit comments