1
1
pub mod gen;
2
+ #[ cfg( feature = "test-multiprecision" ) ]
3
+ pub mod mpfloat;
2
4
mod num_traits;
3
5
mod special_case;
4
6
mod test_traits;
@@ -14,14 +16,18 @@ pub type TestResult<T = (), E = anyhow::Error> = Result<T, E>;
14
16
// List of all files present in libm's source
15
17
include ! ( concat!( env!( "OUT_DIR" ) , "/all_files.rs" ) ) ;
16
18
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).
18
20
const MUSL_DEFAULT_ULP : u32 = 2 ;
19
21
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.
21
26
///
22
27
/// Note that these results were obtained using 400,000,000 rounds of random inputs, which
23
28
/// is not a value used by default.
24
29
pub fn musl_allowed_ulp ( name : & str ) -> u32 {
30
+ // Consider overrides xfail
25
31
match name {
26
32
#[ cfg( x86_no_sse) ]
27
33
"asinh" | "asinhf" => 6 ,
@@ -42,6 +48,27 @@ pub fn musl_allowed_ulp(name: &str) -> u32 {
42
48
}
43
49
}
44
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
+
45
72
/// Return the unsuffixed version of a function name; e.g. `abs` and `absf` both return `abs`,
46
73
/// `lgamma_r` and `lgammaf_r` both return `lgamma_r`.
47
74
pub fn canonical_name ( name : & str ) -> & str {
0 commit comments