11pub mod gen;
2+ #[ cfg( feature = "test-multiprecision" ) ]
3+ pub mod mpfloat;
24mod num_traits;
35mod special_case;
46mod test_traits;
@@ -14,14 +16,18 @@ pub type TestResult<T = (), E = anyhow::Error> = Result<T, E>;
1416// List of all files present in libm's source
1517include ! ( concat!( env!( "OUT_DIR" ) , "/all_files.rs" ) ) ;
1618
17- /// ULP allowed to differ from musl (note that musl itself may not be accurate).
19+ /// Default ULP allowed to differ from musl (note that musl itself may not be accurate).
1820const MUSL_DEFAULT_ULP : u32 = 2 ;
1921
20- /// Certain functions have different allowed ULP (consider these xfail).
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.
2126///
2227/// Note that these results were obtained using 400,000,000 rounds of random inputs, which
2328/// is not a value used by default.
2429pub fn musl_allowed_ulp ( name : & str ) -> u32 {
30+ // Consider overrides xfail
2531 match name {
2632 #[ cfg( x86_no_sse) ]
2733 "asinh" | "asinhf" => 6 ,
@@ -42,6 +48,27 @@ pub fn musl_allowed_ulp(name: &str) -> u32 {
4248 }
4349}
4450
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+
4572/// Return the unsuffixed version of a function name; e.g. `abs` and `absf` both return `abs`,
4673/// `lgamma_r` and `lgammaf_r` both return `lgamma_r`.
4774pub fn canonical_name ( name : & str ) -> & str {
0 commit comments