\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 -265728588174745400:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 7.0217947990339626 \cdot 10^{+44}:\\
\;\;\;\;\frac{\left(x - 2\right) \cdot \left(x \cdot \left(y + \sqrt{x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416} \cdot \left(x \cdot \sqrt{\mathsf{fma}\left(x, \mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right), 137.519416416\right)}\right)\right) + z\right)}{x \cdot \left(x \cdot \left(x \cdot \left(x + 43.3400022514\right) + 263.505074721\right) + 313.399215894\right) + 47.066876606}\\
\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 -265728588174745400.0)
t_0
(if (<= x 7.0217947990339626e+44)
(/
(*
(- x 2.0)
(+
(*
x
(+
y
(*
(sqrt
(+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416))
(*
x
(sqrt
(fma x (fma x 4.16438922228 78.6994924154) 137.519416416))))))
z))
(+
(*
x
(+ (* x (+ (* x (+ x 43.3400022514)) 263.505074721)) 313.399215894))
47.066876606))
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 <= -265728588174745400.0) {
tmp = t_0;
} else if (x <= 7.0217947990339626e+44) {
tmp = ((x - 2.0) * ((x * (y + (sqrt((x * ((x * 4.16438922228) + 78.6994924154)) + 137.519416416) * (x * sqrt(fma(x, fma(x, 4.16438922228, 78.6994924154), 137.519416416)))))) + z)) / ((x * ((x * ((x * (x + 43.3400022514)) + 263.505074721)) + 313.399215894)) + 47.066876606);
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 27.0 |
|---|---|
| Target | 0.8 |
| Herbie | 1.4 |
if x < -265728588174745410 or 7.02179479903396256e44 < x Initial program 58.7
Taylor expanded in x around inf 1.9
Simplified1.9
if -265728588174745410 < x < 7.02179479903396256e44Initial program 0.8
Applied add-sqr-sqrt_binary640.9
Applied associate-*l*_binary640.9
Simplified0.9
Final simplification1.4
herbie shell --seed 2022097
(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)))