@xort/rcmg 0.0.0-stage → 0.1.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +176 -0
- package/LICENSE-MIT +21 -0
- package/PROVENANCE.json +1601 -0
- package/README.md +152 -2
- package/licenses/registry/allocator-api2-0.2.22-c19b7c6f923b/LICENSE-APACHE +176 -0
- package/licenses/registry/allocator-api2-0.2.22-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/autocfg-1.5.1-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/autocfg-1.5.1-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/alloc.rs +794 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/collections/mod.rs +93 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/collections/raw_vec.rs +781 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/collections/str/lossy.rs +209 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/collections/str/mod.rs +43 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/collections/string.rs +2191 -0
- package/licenses/registry/bumpalo-3.20.4-c19b7c6f923b/src/collections/vec.rs +3051 -0
- package/licenses/registry/cfg-if-1.0.5-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/cfg-if-1.0.5-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/equivalent-1.0.3-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/equivalent-1.0.3-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/foldhash-0.2.0-c19b7c6f923b/LICENSE +19 -0
- package/licenses/registry/hashbrown-0.16.1-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/hashbrown-0.16.1-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/LICENSE.txt +258 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/acos.rs +112 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/acosf.rs +79 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/asin.rs +115 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/asinf.rs +68 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/atan.rs +180 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/atan2.rs +131 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/atan2f.rs +90 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/atanf.rs +108 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/cbrt.rs +219 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/cbrtf.rs +73 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/cos.rs +77 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/cosf.rs +86 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/erf.rs +314 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/erff.rs +226 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/exp.rs +156 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/exp2.rs +400 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/exp2f.rs +141 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/expf.rs +103 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/expm1.rs +142 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/expm1f.rs +134 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/fma.rs +171 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/ceil.rs +174 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/floor.rs +157 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fma.rs +278 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fmax.rs +23 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fmaximum.rs +27 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fmaximum_num.rs +29 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fmin.rs +23 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fminimum.rs +27 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fminimum_num.rs +29 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/fmod.rs +116 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/rint.rs +130 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/sqrt.rs +541 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/generic/trunc.rs +148 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/j0.rs +426 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/j0f.rs +363 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/j1.rs +418 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/j1f.rs +383 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/jn.rs +339 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/jnf.rs +253 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/k_cos.rs +62 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/k_cosf.rs +29 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/k_sin.rs +57 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/k_sinf.rs +30 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/k_tan.rs +105 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/k_tanf.rs +46 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/lgamma_r.rs +321 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/lgammaf_r.rs +256 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log.rs +118 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log10.rs +116 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log10f.rs +90 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log1p.rs +142 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log1pf.rs +97 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log2.rs +105 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/log2f.rs +86 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/logf.rs +66 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/pow.rs +624 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/powf.rs +343 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/rem_pio2.rs +235 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/rem_pio2_large.rs +476 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/rem_pio2f.rs +65 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/sin.rs +95 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/sincos.rs +137 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/sincosf.rs +176 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/sinf.rs +96 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/support/int_traits/narrowing_div.rs +175 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/support/modular.rs +304 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/tan.rs +74 -0
- package/licenses/registry/libm-0.2.16-c19b7c6f923b/src/math/tanf.rs +81 -0
- package/licenses/registry/num-traits-0.2.19-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/num-traits-0.2.19-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/num-traits-0.2.19-c19b7c6f923b/src/lib.rs +635 -0
- package/licenses/registry/once_cell-1.21.4-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/once_cell-1.21.4-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/proc-macro2-1.0.107-c19b7c6f923b/LICENSE-APACHE +176 -0
- package/licenses/registry/proc-macro2-1.0.107-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/quote-1.0.47-c19b7c6f923b/LICENSE-APACHE +176 -0
- package/licenses/registry/quote-1.0.47-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/robust-1.2.0-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/robust-1.2.0-c19b7c6f923b/LICENSE-MIT +26 -0
- package/licenses/registry/robust-1.2.0-c19b7c6f923b/src/lib.rs +2224 -0
- package/licenses/registry/rustversion-1.0.23-c19b7c6f923b/LICENSE-APACHE +176 -0
- package/licenses/registry/rustversion-1.0.23-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/smallvec-1.16.6-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/smallvec-1.16.6-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/spade-2.15.1-c19b7c6f923b/LICENSE-APACHE +202 -0
- package/licenses/registry/spade-2.15.1-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/syn-2.0.119-c19b7c6f923b/LICENSE-APACHE +176 -0
- package/licenses/registry/syn-2.0.119-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/unicode-ident-1.0.27-c19b7c6f923b/LICENSE-APACHE +176 -0
- package/licenses/registry/unicode-ident-1.0.27-c19b7c6f923b/LICENSE-MIT +23 -0
- package/licenses/registry/unicode-ident-1.0.27-c19b7c6f923b/LICENSE-UNICODE +39 -0
- package/licenses/registry/wasm-bindgen-0.2.118-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/wasm-bindgen-0.2.118-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/wasm-bindgen-macro-0.2.118-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/wasm-bindgen-macro-0.2.118-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/wasm-bindgen-macro-support-0.2.118-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/wasm-bindgen-macro-support-0.2.118-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry/wasm-bindgen-shared-0.2.118-c19b7c6f923b/LICENSE-APACHE +201 -0
- package/licenses/registry/wasm-bindgen-shared-0.2.118-c19b7c6f923b/LICENSE-MIT +25 -0
- package/licenses/registry-licenses.json +1413 -0
- package/licenses/source/LICENSE-APACHE +176 -0
- package/licenses/source/LICENSE-MIT +21 -0
- package/licenses/source/crates/rcmg-mesh/src/isosurface/LICENSE-PyMCubes +27 -0
- package/licenses/source/crates/rcmg-mesh/src/isosurface/NOTICE.md +11 -0
- package/licenses/source/vendor/cadcraft-dxf/LICENSE-APACHE +177 -0
- package/licenses/source/vendor/cadcraft-dxf/LICENSE-MIT +21 -0
- package/node/index.mjs +2 -0
- package/node/package.json +3 -0
- package/node/rcmg_ffi.d.ts +51 -0
- package/node/rcmg_ffi.js +269 -0
- package/node/rcmg_ffi_bg.wasm +0 -0
- package/node/rcmg_ffi_bg.wasm.d.ts +32 -0
- package/package.json +57 -6
- package/web/rcmg_ffi.d.ts +108 -0
- package/web/rcmg_ffi.js +358 -0
- package/web/rcmg_ffi_bg.wasm +0 -0
- package/web/rcmg_ffi_bg.wasm.d.ts +32 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1.c */
|
|
2
|
+
/*
|
|
3
|
+
* ====================================================
|
|
4
|
+
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
7
|
+
* Permission to use, copy, modify, and distribute this
|
|
8
|
+
* software is freely granted, provided that this notice
|
|
9
|
+
* is preserved.
|
|
10
|
+
* ====================================================
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const O_THRESHOLD: f64 = 7.09782712893383973096e+02; /* 0x40862E42, 0xFEFA39EF */
|
|
14
|
+
const LN2_HI: f64 = 6.93147180369123816490e-01; /* 0x3fe62e42, 0xfee00000 */
|
|
15
|
+
const LN2_LO: f64 = 1.90821492927058770002e-10; /* 0x3dea39ef, 0x35793c76 */
|
|
16
|
+
const INVLN2: f64 = 1.44269504088896338700e+00; /* 0x3ff71547, 0x652b82fe */
|
|
17
|
+
/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs = x*x/2: */
|
|
18
|
+
const Q1: f64 = -3.33333333333331316428e-02; /* BFA11111 111110F4 */
|
|
19
|
+
const Q2: f64 = 1.58730158725481460165e-03; /* 3F5A01A0 19FE5585 */
|
|
20
|
+
const Q3: f64 = -7.93650757867487942473e-05; /* BF14CE19 9EAADBB7 */
|
|
21
|
+
const Q4: f64 = 4.00821782732936239552e-06; /* 3ED0CFCA 86E65239 */
|
|
22
|
+
const Q5: f64 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
|
|
23
|
+
|
|
24
|
+
/// Exponential, base *e*, of x-1 (f64)
|
|
25
|
+
///
|
|
26
|
+
/// Calculates the exponential of `x` and subtract 1, that is, *e* raised
|
|
27
|
+
/// to the power `x` minus 1 (where *e* is the base of the natural
|
|
28
|
+
/// system of logarithms, approximately 2.71828).
|
|
29
|
+
/// The result is accurate even for small values of `x`,
|
|
30
|
+
/// where using `exp(x)-1` would lose many significant digits.
|
|
31
|
+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
|
|
32
|
+
pub fn expm1(mut x: f64) -> f64 {
|
|
33
|
+
let hi: f64;
|
|
34
|
+
let lo: f64;
|
|
35
|
+
let k: i32;
|
|
36
|
+
let c: f64;
|
|
37
|
+
let mut t: f64;
|
|
38
|
+
let mut y: f64;
|
|
39
|
+
|
|
40
|
+
let mut ui = x.to_bits();
|
|
41
|
+
let hx = ((ui >> 32) & 0x7fffffff) as u32;
|
|
42
|
+
let sign = (ui >> 63) as i32;
|
|
43
|
+
|
|
44
|
+
/* filter out huge and non-finite argument */
|
|
45
|
+
if hx >= 0x4043687A {
|
|
46
|
+
/* if |x|>=56*ln2 */
|
|
47
|
+
if x.is_nan() {
|
|
48
|
+
return x;
|
|
49
|
+
}
|
|
50
|
+
if sign != 0 {
|
|
51
|
+
return -1.0;
|
|
52
|
+
}
|
|
53
|
+
if x > O_THRESHOLD {
|
|
54
|
+
x *= f64::from_bits(0x7fe0000000000000);
|
|
55
|
+
return x;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* argument reduction */
|
|
60
|
+
if hx > 0x3fd62e42 {
|
|
61
|
+
/* if |x| > 0.5 ln2 */
|
|
62
|
+
if hx < 0x3FF0A2B2 {
|
|
63
|
+
/* and |x| < 1.5 ln2 */
|
|
64
|
+
if sign == 0 {
|
|
65
|
+
hi = x - LN2_HI;
|
|
66
|
+
lo = LN2_LO;
|
|
67
|
+
k = 1;
|
|
68
|
+
} else {
|
|
69
|
+
hi = x + LN2_HI;
|
|
70
|
+
lo = -LN2_LO;
|
|
71
|
+
k = -1;
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
k = (INVLN2 * x + if sign != 0 { -0.5 } else { 0.5 }) as i32;
|
|
75
|
+
t = k as f64;
|
|
76
|
+
hi = x - t * LN2_HI; /* t*ln2_hi is exact here */
|
|
77
|
+
lo = t * LN2_LO;
|
|
78
|
+
}
|
|
79
|
+
x = hi - lo;
|
|
80
|
+
c = (hi - x) - lo;
|
|
81
|
+
} else if hx < 0x3c900000 {
|
|
82
|
+
/* |x| < 2**-54, return x */
|
|
83
|
+
if hx < 0x00100000 {
|
|
84
|
+
force_eval!(x);
|
|
85
|
+
}
|
|
86
|
+
return x;
|
|
87
|
+
} else {
|
|
88
|
+
c = 0.0;
|
|
89
|
+
k = 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* x is now in primary range */
|
|
93
|
+
let hfx = 0.5 * x;
|
|
94
|
+
let hxs = x * hfx;
|
|
95
|
+
let r1 = 1.0 + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5))));
|
|
96
|
+
t = 3.0 - r1 * hfx;
|
|
97
|
+
let mut e = hxs * ((r1 - t) / (6.0 - x * t));
|
|
98
|
+
if k == 0 {
|
|
99
|
+
/* c is 0 */
|
|
100
|
+
return x - (x * e - hxs);
|
|
101
|
+
}
|
|
102
|
+
e = x * (e - c) - c;
|
|
103
|
+
e -= hxs;
|
|
104
|
+
/* exp(x) ~ 2^k (x_reduced - e + 1) */
|
|
105
|
+
if k == -1 {
|
|
106
|
+
return 0.5 * (x - e) - 0.5;
|
|
107
|
+
}
|
|
108
|
+
if k == 1 {
|
|
109
|
+
if x < -0.25 {
|
|
110
|
+
return -2.0 * (e - (x + 0.5));
|
|
111
|
+
}
|
|
112
|
+
return 1.0 + 2.0 * (x - e);
|
|
113
|
+
}
|
|
114
|
+
ui = ((0x3ff + k) as u64) << 52; /* 2^k */
|
|
115
|
+
let twopk = f64::from_bits(ui);
|
|
116
|
+
if !(0..=56).contains(&k) {
|
|
117
|
+
/* suffice to return exp(x)-1 */
|
|
118
|
+
y = x - e + 1.0;
|
|
119
|
+
if k == 1024 {
|
|
120
|
+
y = y * 2.0 * f64::from_bits(0x7fe0000000000000);
|
|
121
|
+
} else {
|
|
122
|
+
y = y * twopk;
|
|
123
|
+
}
|
|
124
|
+
return y - 1.0;
|
|
125
|
+
}
|
|
126
|
+
ui = ((0x3ff - k) as u64) << 52; /* 2^-k */
|
|
127
|
+
let uf = f64::from_bits(ui);
|
|
128
|
+
if k < 20 {
|
|
129
|
+
y = (x - e + (1.0 - uf)) * twopk;
|
|
130
|
+
} else {
|
|
131
|
+
y = (x - (e + uf) + 1.0) * twopk;
|
|
132
|
+
}
|
|
133
|
+
y
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
#[cfg(test)]
|
|
137
|
+
mod tests {
|
|
138
|
+
#[test]
|
|
139
|
+
fn sanity_check() {
|
|
140
|
+
assert_eq!(super::expm1(1.1), 2.0041660239464334);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1f.c */
|
|
2
|
+
/*
|
|
3
|
+
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* ====================================================
|
|
7
|
+
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
8
|
+
*
|
|
9
|
+
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
10
|
+
* Permission to use, copy, modify, and distribute this
|
|
11
|
+
* software is freely granted, provided that this notice
|
|
12
|
+
* is preserved.
|
|
13
|
+
* ====================================================
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const LN2_HI: f32 = 6.9313812256e-01; /* 0x3f317180 */
|
|
17
|
+
const LN2_LO: f32 = 9.0580006145e-06; /* 0x3717f7d1 */
|
|
18
|
+
const INV_LN2: f32 = 1.4426950216e+00; /* 0x3fb8aa3b */
|
|
19
|
+
/*
|
|
20
|
+
* Domain [-0.34568, 0.34568], range ~[-6.694e-10, 6.696e-10]:
|
|
21
|
+
* |6 / x * (1 + 2 * (1 / (exp(x) - 1) - 1 / x)) - q(x)| < 2**-30.04
|
|
22
|
+
* Scaled coefficients: Qn_here = 2**n * Qn_for_q (see s_expm1.c):
|
|
23
|
+
*/
|
|
24
|
+
const Q1: f32 = -3.3333212137e-2; /* -0x888868.0p-28 */
|
|
25
|
+
const Q2: f32 = 1.5807170421e-3; /* 0xcf3010.0p-33 */
|
|
26
|
+
|
|
27
|
+
/// Exponential, base *e*, of x-1 (f32)
|
|
28
|
+
///
|
|
29
|
+
/// Calculates the exponential of `x` and subtract 1, that is, *e* raised
|
|
30
|
+
/// to the power `x` minus 1 (where *e* is the base of the natural
|
|
31
|
+
/// system of logarithms, approximately 2.71828).
|
|
32
|
+
/// The result is accurate even for small values of `x`,
|
|
33
|
+
/// where using `exp(x)-1` would lose many significant digits.
|
|
34
|
+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
|
|
35
|
+
pub fn expm1f(mut x: f32) -> f32 {
|
|
36
|
+
let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127
|
|
37
|
+
|
|
38
|
+
let mut hx = x.to_bits();
|
|
39
|
+
let sign = (hx >> 31) != 0;
|
|
40
|
+
hx &= 0x7fffffff;
|
|
41
|
+
|
|
42
|
+
/* filter out huge and non-finite argument */
|
|
43
|
+
if hx >= 0x4195b844 {
|
|
44
|
+
/* if |x|>=27*ln2 */
|
|
45
|
+
if hx > 0x7f800000 {
|
|
46
|
+
/* NaN */
|
|
47
|
+
return x;
|
|
48
|
+
}
|
|
49
|
+
if sign {
|
|
50
|
+
return -1.;
|
|
51
|
+
}
|
|
52
|
+
if hx > 0x42b17217 {
|
|
53
|
+
/* x > log(FLT_MAX) */
|
|
54
|
+
x *= x1p127;
|
|
55
|
+
return x;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let k: i32;
|
|
60
|
+
let hi: f32;
|
|
61
|
+
let lo: f32;
|
|
62
|
+
let mut c = 0f32;
|
|
63
|
+
/* argument reduction */
|
|
64
|
+
if hx > 0x3eb17218 {
|
|
65
|
+
/* if |x| > 0.5 ln2 */
|
|
66
|
+
if hx < 0x3F851592 {
|
|
67
|
+
/* and |x| < 1.5 ln2 */
|
|
68
|
+
if !sign {
|
|
69
|
+
hi = x - LN2_HI;
|
|
70
|
+
lo = LN2_LO;
|
|
71
|
+
k = 1;
|
|
72
|
+
} else {
|
|
73
|
+
hi = x + LN2_HI;
|
|
74
|
+
lo = -LN2_LO;
|
|
75
|
+
k = -1;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
k = (INV_LN2 * x + (if sign { -0.5 } else { 0.5 })) as i32;
|
|
79
|
+
let t = k as f32;
|
|
80
|
+
hi = x - t * LN2_HI; /* t*ln2_hi is exact here */
|
|
81
|
+
lo = t * LN2_LO;
|
|
82
|
+
}
|
|
83
|
+
x = hi - lo;
|
|
84
|
+
c = (hi - x) - lo;
|
|
85
|
+
} else if hx < 0x33000000 {
|
|
86
|
+
/* when |x|<2**-25, return x */
|
|
87
|
+
if hx < 0x00800000 {
|
|
88
|
+
force_eval!(x * x);
|
|
89
|
+
}
|
|
90
|
+
return x;
|
|
91
|
+
} else {
|
|
92
|
+
k = 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* x is now in primary range */
|
|
96
|
+
let hfx = 0.5 * x;
|
|
97
|
+
let hxs = x * hfx;
|
|
98
|
+
let r1 = 1. + hxs * (Q1 + hxs * Q2);
|
|
99
|
+
let t = 3. - r1 * hfx;
|
|
100
|
+
let mut e = hxs * ((r1 - t) / (6. - x * t));
|
|
101
|
+
if k == 0 {
|
|
102
|
+
/* c is 0 */
|
|
103
|
+
return x - (x * e - hxs);
|
|
104
|
+
}
|
|
105
|
+
e = x * (e - c) - c;
|
|
106
|
+
e -= hxs;
|
|
107
|
+
/* exp(x) ~ 2^k (x_reduced - e + 1) */
|
|
108
|
+
if k == -1 {
|
|
109
|
+
return 0.5 * (x - e) - 0.5;
|
|
110
|
+
}
|
|
111
|
+
if k == 1 {
|
|
112
|
+
if x < -0.25 {
|
|
113
|
+
return -2. * (e - (x + 0.5));
|
|
114
|
+
}
|
|
115
|
+
return 1. + 2. * (x - e);
|
|
116
|
+
}
|
|
117
|
+
let twopk = f32::from_bits(((0x7f + k) << 23) as u32); /* 2^k */
|
|
118
|
+
if !(0..=56).contains(&k) {
|
|
119
|
+
/* suffice to return exp(x)-1 */
|
|
120
|
+
let mut y = x - e + 1.;
|
|
121
|
+
if k == 128 {
|
|
122
|
+
y = y * 2. * x1p127;
|
|
123
|
+
} else {
|
|
124
|
+
y = y * twopk;
|
|
125
|
+
}
|
|
126
|
+
return y - 1.;
|
|
127
|
+
}
|
|
128
|
+
let uf = f32::from_bits(((0x7f - k) << 23) as u32); /* 2^-k */
|
|
129
|
+
if k < 23 {
|
|
130
|
+
(x - e + (1. - uf)) * twopk
|
|
131
|
+
} else {
|
|
132
|
+
(x - (e + uf) + 1.) * twopk
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
|
2
|
+
/* origin: musl src/math/fma.c, fmaf.c Ported to generic Rust algorithm in 2025, TG. */
|
|
3
|
+
|
|
4
|
+
use super::generic;
|
|
5
|
+
use crate::support::Round;
|
|
6
|
+
|
|
7
|
+
// Placeholder so we can have `fmaf16` in the `Float` trait.
|
|
8
|
+
#[allow(unused)]
|
|
9
|
+
#[cfg(f16_enabled)]
|
|
10
|
+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
|
|
11
|
+
pub(crate) fn fmaf16(_x: f16, _y: f16, _z: f16) -> f16 {
|
|
12
|
+
unimplemented!()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// Floating multiply add (f32)
|
|
16
|
+
///
|
|
17
|
+
/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision).
|
|
18
|
+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
|
|
19
|
+
pub fn fmaf(x: f32, y: f32, z: f32) -> f32 {
|
|
20
|
+
select_implementation! {
|
|
21
|
+
name: fmaf,
|
|
22
|
+
use_arch: any(
|
|
23
|
+
all(target_arch = "aarch64", target_feature = "neon"),
|
|
24
|
+
target_feature = "sse2",
|
|
25
|
+
),
|
|
26
|
+
args: x, y, z,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
generic::fma_wide_round(x, y, z, Round::Nearest).val
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// Fused multiply add (f64)
|
|
33
|
+
///
|
|
34
|
+
/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision).
|
|
35
|
+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
|
|
36
|
+
pub fn fma(x: f64, y: f64, z: f64) -> f64 {
|
|
37
|
+
select_implementation! {
|
|
38
|
+
name: fma,
|
|
39
|
+
use_arch: any(
|
|
40
|
+
all(target_arch = "aarch64", target_feature = "neon"),
|
|
41
|
+
target_feature = "sse2",
|
|
42
|
+
),
|
|
43
|
+
args: x, y, z,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
generic::fma_round(x, y, z, Round::Nearest).val
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Fused multiply add (f128)
|
|
50
|
+
///
|
|
51
|
+
/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision).
|
|
52
|
+
#[cfg(f128_enabled)]
|
|
53
|
+
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
|
|
54
|
+
pub fn fmaf128(x: f128, y: f128, z: f128) -> f128 {
|
|
55
|
+
generic::fma_round(x, y, z, Round::Nearest).val
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#[cfg(test)]
|
|
59
|
+
mod tests {
|
|
60
|
+
use super::*;
|
|
61
|
+
use crate::support::{CastFrom, CastInto, Float, FpResult, HInt, MinInt, Round, Status};
|
|
62
|
+
|
|
63
|
+
/// Test the generic `fma_round` algorithm for a given float.
|
|
64
|
+
fn spec_test<F>(f: impl Fn(F, F, F) -> F)
|
|
65
|
+
where
|
|
66
|
+
F: Float,
|
|
67
|
+
F: CastFrom<F::SignedInt>,
|
|
68
|
+
F: CastFrom<i8>,
|
|
69
|
+
F::Int: HInt,
|
|
70
|
+
u32: CastInto<F::Int>,
|
|
71
|
+
{
|
|
72
|
+
let x = F::from_bits(F::Int::ONE);
|
|
73
|
+
let y = F::from_bits(F::Int::ONE);
|
|
74
|
+
let z = F::ZERO;
|
|
75
|
+
|
|
76
|
+
// 754-2020 says "When the exact result of (a × b) + c is non-zero yet the result of
|
|
77
|
+
// fusedMultiplyAdd is zero because of rounding, the zero result takes the sign of the
|
|
78
|
+
// exact result"
|
|
79
|
+
assert_biteq!(f(x, y, z), F::ZERO);
|
|
80
|
+
assert_biteq!(f(x, -y, z), F::NEG_ZERO);
|
|
81
|
+
assert_biteq!(f(-x, y, z), F::NEG_ZERO);
|
|
82
|
+
assert_biteq!(f(-x, -y, z), F::ZERO);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#[test]
|
|
86
|
+
fn spec_test_f32() {
|
|
87
|
+
spec_test::<f32>(fmaf);
|
|
88
|
+
|
|
89
|
+
// Also do a small check that the non-widening version works for f32 (this should ideally
|
|
90
|
+
// get tested some more).
|
|
91
|
+
spec_test::<f32>(|x, y, z| generic::fma_round(x, y, z, Round::Nearest).val);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#[test]
|
|
95
|
+
fn spec_test_f64() {
|
|
96
|
+
spec_test::<f64>(fma);
|
|
97
|
+
|
|
98
|
+
let expect_underflow = [
|
|
99
|
+
(
|
|
100
|
+
hf64!("0x1.0p-1070"),
|
|
101
|
+
hf64!("0x1.0p-1070"),
|
|
102
|
+
hf64!("0x1.ffffffffffffp-1023"),
|
|
103
|
+
hf64!("0x0.ffffffffffff8p-1022"),
|
|
104
|
+
),
|
|
105
|
+
(
|
|
106
|
+
// FIXME: we raise underflow but this should only be inexact (based on C and
|
|
107
|
+
// `rustc_apfloat`).
|
|
108
|
+
hf64!("0x1.0p-1070"),
|
|
109
|
+
hf64!("0x1.0p-1070"),
|
|
110
|
+
hf64!("-0x1.0p-1022"),
|
|
111
|
+
hf64!("-0x1.0p-1022"),
|
|
112
|
+
),
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
for (x, y, z, res) in expect_underflow {
|
|
116
|
+
let FpResult { val, status } = generic::fma_round(x, y, z, Round::Nearest);
|
|
117
|
+
assert_biteq!(val, res);
|
|
118
|
+
assert_eq!(status, Status::UNDERFLOW);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#[test]
|
|
123
|
+
#[cfg(f128_enabled)]
|
|
124
|
+
fn spec_test_f128() {
|
|
125
|
+
spec_test::<f128>(fmaf128);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#[test]
|
|
129
|
+
fn issue_263() {
|
|
130
|
+
let a = f32::from_bits(1266679807);
|
|
131
|
+
let b = f32::from_bits(1300234242);
|
|
132
|
+
let c = f32::from_bits(1115553792);
|
|
133
|
+
let expected = f32::from_bits(1501560833);
|
|
134
|
+
assert_eq!(fmaf(a, b, c), expected);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#[test]
|
|
138
|
+
fn fma_segfault() {
|
|
139
|
+
// These two inputs cause fma to segfault on release due to overflow:
|
|
140
|
+
assert_eq!(
|
|
141
|
+
fma(
|
|
142
|
+
-0.0000000000000002220446049250313,
|
|
143
|
+
-0.0000000000000002220446049250313,
|
|
144
|
+
-0.0000000000000002220446049250313
|
|
145
|
+
),
|
|
146
|
+
-0.00000000000000022204460492503126,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
let result = fma(-0.992, -0.992, -0.992);
|
|
150
|
+
//force rounding to storage format on x87 to prevent superious errors.
|
|
151
|
+
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]
|
|
152
|
+
let result = force_eval!(result);
|
|
153
|
+
assert_eq!(result, -0.007936000000000007,);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#[test]
|
|
157
|
+
fn fma_sbb() {
|
|
158
|
+
assert_eq!(
|
|
159
|
+
fma(-(1.0 - f64::EPSILON), f64::MIN, f64::MIN),
|
|
160
|
+
-3991680619069439e277
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
#[test]
|
|
165
|
+
fn fma_underflow() {
|
|
166
|
+
assert_eq!(
|
|
167
|
+
fma(1.1102230246251565e-16, -9.812526705433188e-305, 1.0894e-320),
|
|
168
|
+
0.0,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
|
2
|
+
/* origin: musl src/math/ceilf.c */
|
|
3
|
+
|
|
4
|
+
//! Generic `ceil` algorithm.
|
|
5
|
+
//!
|
|
6
|
+
//! Note that this uses the algorithm from musl's `ceilf` rather than `ceil` or `ceill` because
|
|
7
|
+
//! performance seems to be better (based on icount) and it does not seem to experience rounding
|
|
8
|
+
//! errors on i386.
|
|
9
|
+
|
|
10
|
+
use crate::support::{Float, FpResult, Int, IntTy, MinInt, Status};
|
|
11
|
+
|
|
12
|
+
#[inline]
|
|
13
|
+
pub fn ceil<F: Float>(x: F) -> F {
|
|
14
|
+
ceil_status(x).val
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#[inline]
|
|
18
|
+
pub fn ceil_status<F: Float>(x: F) -> FpResult<F> {
|
|
19
|
+
let zero = IntTy::<F>::ZERO;
|
|
20
|
+
|
|
21
|
+
let mut ix = x.to_bits();
|
|
22
|
+
let e = x.exp_unbiased();
|
|
23
|
+
|
|
24
|
+
// If the represented value has no fractional part, no truncation is needed.
|
|
25
|
+
if e >= F::SIG_BITS as i32 {
|
|
26
|
+
return FpResult::ok(x);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let status;
|
|
30
|
+
let res = if e >= 0 {
|
|
31
|
+
// |x| >= 1.0
|
|
32
|
+
let m = F::SIG_MASK >> e.unsigned();
|
|
33
|
+
if (ix & m) == zero {
|
|
34
|
+
// Portion to be masked is already zero; no adjustment needed.
|
|
35
|
+
return FpResult::ok(x);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Otherwise, raise an inexact exception.
|
|
39
|
+
status = Status::INEXACT;
|
|
40
|
+
|
|
41
|
+
if x.is_sign_positive() {
|
|
42
|
+
ix += m;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ix &= !m;
|
|
46
|
+
F::from_bits(ix)
|
|
47
|
+
} else {
|
|
48
|
+
// |x| < 1.0, raise an inexact exception since truncation will happen (unless x == 0).
|
|
49
|
+
if ix & F::SIG_MASK == F::Int::ZERO {
|
|
50
|
+
status = Status::OK;
|
|
51
|
+
} else {
|
|
52
|
+
status = Status::INEXACT;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if x.is_sign_negative() {
|
|
56
|
+
// -1.0 < x <= -0.0; rounding up goes toward -0.0.
|
|
57
|
+
F::NEG_ZERO
|
|
58
|
+
} else if ix << 1 != zero {
|
|
59
|
+
// 0.0 < x < 1.0; rounding up goes toward +1.0.
|
|
60
|
+
F::ONE
|
|
61
|
+
} else {
|
|
62
|
+
// +0.0 remains unchanged
|
|
63
|
+
x
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
FpResult::new(res, status)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#[cfg(test)]
|
|
71
|
+
mod tests {
|
|
72
|
+
use super::*;
|
|
73
|
+
use crate::support::Hexf;
|
|
74
|
+
|
|
75
|
+
/// Test against https://en.cppreference.com/w/cpp/numeric/math/ceil
|
|
76
|
+
fn spec_test<F: Float>(cases: &[(F, F, Status)]) {
|
|
77
|
+
let roundtrip = [
|
|
78
|
+
F::ZERO,
|
|
79
|
+
F::ONE,
|
|
80
|
+
F::NEG_ONE,
|
|
81
|
+
F::NEG_ZERO,
|
|
82
|
+
F::INFINITY,
|
|
83
|
+
F::NEG_INFINITY,
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
for x in roundtrip {
|
|
87
|
+
let FpResult { val, status } = ceil_status(x);
|
|
88
|
+
assert_biteq!(val, x, "{}", Hexf(x));
|
|
89
|
+
assert_eq!(status, Status::OK, "{}", Hexf(x));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for &(x, res, res_stat) in cases {
|
|
93
|
+
let FpResult { val, status } = ceil_status(x);
|
|
94
|
+
assert_biteq!(val, res, "{}", Hexf(x));
|
|
95
|
+
assert_eq!(status, res_stat, "{}", Hexf(x));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Skipping f16 / f128 "sanity_check"s due to rejected literal lexing at MSRV */
|
|
100
|
+
|
|
101
|
+
#[test]
|
|
102
|
+
#[cfg(f16_enabled)]
|
|
103
|
+
fn spec_tests_f16() {
|
|
104
|
+
let cases = [
|
|
105
|
+
(0.1, 1.0, Status::INEXACT),
|
|
106
|
+
(-0.1, -0.0, Status::INEXACT),
|
|
107
|
+
(0.9, 1.0, Status::INEXACT),
|
|
108
|
+
(-0.9, -0.0, Status::INEXACT),
|
|
109
|
+
(1.1, 2.0, Status::INEXACT),
|
|
110
|
+
(-1.1, -1.0, Status::INEXACT),
|
|
111
|
+
(1.9, 2.0, Status::INEXACT),
|
|
112
|
+
(-1.9, -1.0, Status::INEXACT),
|
|
113
|
+
];
|
|
114
|
+
spec_test::<f16>(&cases);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#[test]
|
|
118
|
+
fn sanity_check_f32() {
|
|
119
|
+
assert_eq!(ceil(1.1f32), 2.0);
|
|
120
|
+
assert_eq!(ceil(2.9f32), 3.0);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#[test]
|
|
124
|
+
fn spec_tests_f32() {
|
|
125
|
+
let cases = [
|
|
126
|
+
(0.1, 1.0, Status::INEXACT),
|
|
127
|
+
(-0.1, -0.0, Status::INEXACT),
|
|
128
|
+
(0.9, 1.0, Status::INEXACT),
|
|
129
|
+
(-0.9, -0.0, Status::INEXACT),
|
|
130
|
+
(1.1, 2.0, Status::INEXACT),
|
|
131
|
+
(-1.1, -1.0, Status::INEXACT),
|
|
132
|
+
(1.9, 2.0, Status::INEXACT),
|
|
133
|
+
(-1.9, -1.0, Status::INEXACT),
|
|
134
|
+
];
|
|
135
|
+
spec_test::<f32>(&cases);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#[test]
|
|
139
|
+
fn sanity_check_f64() {
|
|
140
|
+
assert_eq!(ceil(1.1f64), 2.0);
|
|
141
|
+
assert_eq!(ceil(2.9f64), 3.0);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#[test]
|
|
145
|
+
fn spec_tests_f64() {
|
|
146
|
+
let cases = [
|
|
147
|
+
(0.1, 1.0, Status::INEXACT),
|
|
148
|
+
(-0.1, -0.0, Status::INEXACT),
|
|
149
|
+
(0.9, 1.0, Status::INEXACT),
|
|
150
|
+
(-0.9, -0.0, Status::INEXACT),
|
|
151
|
+
(1.1, 2.0, Status::INEXACT),
|
|
152
|
+
(-1.1, -1.0, Status::INEXACT),
|
|
153
|
+
(1.9, 2.0, Status::INEXACT),
|
|
154
|
+
(-1.9, -1.0, Status::INEXACT),
|
|
155
|
+
];
|
|
156
|
+
spec_test::<f64>(&cases);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
#[test]
|
|
160
|
+
#[cfg(f128_enabled)]
|
|
161
|
+
fn spec_tests_f128() {
|
|
162
|
+
let cases = [
|
|
163
|
+
(0.1, 1.0, Status::INEXACT),
|
|
164
|
+
(-0.1, -0.0, Status::INEXACT),
|
|
165
|
+
(0.9, 1.0, Status::INEXACT),
|
|
166
|
+
(-0.9, -0.0, Status::INEXACT),
|
|
167
|
+
(1.1, 2.0, Status::INEXACT),
|
|
168
|
+
(-1.1, -1.0, Status::INEXACT),
|
|
169
|
+
(1.9, 2.0, Status::INEXACT),
|
|
170
|
+
(-1.9, -1.0, Status::INEXACT),
|
|
171
|
+
];
|
|
172
|
+
spec_test::<f128>(&cases);
|
|
173
|
+
}
|
|
174
|
+
}
|