\frac{\left(x - 2\right) \cdot \left(\left(\left(\left(x \cdot 4.16438922228 + 78.6994924154\right) \cdot x + 137.519416416\right) \cdot x + y\right) \cdot x + z\right)}{\left(\left(\left(x + 43.3400022514\right) \cdot x + 263.505074721\right) \cdot x + 313.399215894\right) \cdot x + 47.066876606}
\begin{array}{l}
t_0 := \left(\mathsf{fma}\left(x, 4.16438922228, \frac{3655.1204654076414}{x}\right) + \frac{y}{x \cdot x}\right) - \left(110.1139242984811 + \frac{130977.50649958357}{x \cdot x}\right)\\
\mathbf{if}\;x \leq -3.019861234299114 \cdot 10^{+31}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.264914738129263 \cdot 10^{+25}:\\
\;\;\;\;\begin{array}{l}
t_1 := {x}^{4} + \left(47.066876606 + \mathsf{fma}\left(x \cdot x, 263.505074721, \mathsf{fma}\left(x, 313.399215894, {x}^{3} \cdot 43.3400022514\right)\right)\right)\\
\mathsf{fma}\left(70.37071397084, \frac{{x}^{4}}{t_1}, \frac{x \cdot \left(x \cdot y\right)}{t_1} + \mathsf{fma}\left(4.16438922228, \frac{{x}^{5}}{t_1}, \frac{x \cdot z}{t_1}\right)\right) - \mathsf{fma}\left(2, \frac{x \cdot y}{t_1}, \mathsf{fma}\left(2, \frac{z}{t_1}, \mathsf{fma}\left(275.038832832, \frac{x \cdot x}{t_1}, 19.8795684148 \cdot \frac{{x}^{3}}{t_1}\right)\right)\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x y z)
:precision binary64
(/
(*
(- x 2.0)
(+
(*
(+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y)
x)
z))
(+
(* (+ (* (+ (* (+ x 43.3400022514) x) 263.505074721) x) 313.399215894) x)
47.066876606)))(FPCore (x y z)
:precision binary64
(let* ((t_0
(-
(+ (fma x 4.16438922228 (/ 3655.1204654076414 x)) (/ y (* x x)))
(+ 110.1139242984811 (/ 130977.50649958357 (* x x))))))
(if (<= x -3.019861234299114e+31)
t_0
(if (<= x 1.264914738129263e+25)
(let* ((t_1
(+
(pow x 4.0)
(+
47.066876606
(fma
(* x x)
263.505074721
(fma x 313.399215894 (* (pow x 3.0) 43.3400022514)))))))
(-
(fma
70.37071397084
(/ (pow x 4.0) t_1)
(+
(/ (* x (* x y)) t_1)
(fma 4.16438922228 (/ (pow x 5.0) t_1) (/ (* x z) t_1))))
(fma
2.0
(/ (* x y) t_1)
(fma
2.0
(/ z t_1)
(fma
275.038832832
(/ (* x x) t_1)
(* 19.8795684148 (/ (pow x 3.0) t_1)))))))
t_0))))double code(double x, double y, double z) {
return ((x - 2.0) * ((((((((x * 4.16438922228) + 78.6994924154) * x) + 137.519416416) * x) + y) * x) + z)) / (((((((x + 43.3400022514) * x) + 263.505074721) * x) + 313.399215894) * x) + 47.066876606);
}
double code(double x, double y, double z) {
double t_0 = (fma(x, 4.16438922228, (3655.1204654076414 / x)) + (y / (x * x))) - (110.1139242984811 + (130977.50649958357 / (x * x)));
double tmp;
if (x <= -3.019861234299114e+31) {
tmp = t_0;
} else if (x <= 1.264914738129263e+25) {
double t_1 = pow(x, 4.0) + (47.066876606 + fma((x * x), 263.505074721, fma(x, 313.399215894, (pow(x, 3.0) * 43.3400022514))));
tmp = fma(70.37071397084, (pow(x, 4.0) / t_1), (((x * (x * y)) / t_1) + fma(4.16438922228, (pow(x, 5.0) / t_1), ((x * z) / t_1)))) - fma(2.0, ((x * y) / t_1), fma(2.0, (z / t_1), fma(275.038832832, ((x * x) / t_1), (19.8795684148 * (pow(x, 3.0) / t_1)))));
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 26.8 |
|---|---|
| Target | 0.8 |
| Herbie | 1.3 |
if x < -3.0198612342991141e31 or 1.26491473812926299e25 < x Initial program 58.0
Taylor expanded in x around inf 2.3
Simplified2.3
if -3.0198612342991141e31 < x < 1.26491473812926299e25Initial program 0.5
Taylor expanded in y around 0 0.5
Simplified0.5
Final simplification1.3
herbie shell --seed 2022076
(FPCore (x y z)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< x -3.326128725870005e+62) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811) (if (< x 9.429991714554673e+55) (* (/ (- x 2.0) 1.0) (/ (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z) (+ (* (+ (+ (* 263.505074721 x) (+ (* 43.3400022514 (* x x)) (* x (* x x)))) 313.399215894) x) 47.066876606))) (- (+ (/ y (* x x)) (* 4.16438922228 x)) 110.1139242984811)))
(/ (* (- x 2.0) (+ (* (+ (* (+ (* (+ (* x 4.16438922228) 78.6994924154) x) 137.519416416) x) y) x) z)) (+ (* (+ (* (+ (* (+ x 43.3400022514) x) 263.505074721) x) 313.399215894) x) 47.066876606)))