\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}
\mathbf{if}\;x \leq -4.994033402817942 \cdot 10^{+40} \lor \neg \left(x \leq 2.844774379865759 \cdot 10^{+65}\right):\\
\;\;\;\;\frac{x - 2}{\left(0.24013125253755718 + \left(\frac{5.86923874282773}{x} + \frac{931.6513700817767}{{x}^{3}}\right)\right) - \mathsf{fma}\left(0.05766301844525606, \frac{y}{{x}^{3}}, \frac{55.572073733743466}{x \cdot x}\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(x - 2\right) \cdot \frac{\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, 4.16438922228, 78.6994924154\right), 137.519416416\right), y\right), z\right)}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, \mathsf{fma}\left(x, x + 43.3400022514, 263.505074721\right), 313.399215894\right), 47.066876606\right)}\\
\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
(if (or (<= x -4.994033402817942e+40) (not (<= x 2.844774379865759e+65)))
(/
(- x 2.0)
(-
(+
0.24013125253755718
(+ (/ 5.86923874282773 x) (/ 931.6513700817767 (pow x 3.0))))
(fma
0.05766301844525606
(/ y (pow x 3.0))
(/ 55.572073733743466 (* x x)))))
(*
(- x 2.0)
(/
(fma
x
(fma x (fma x (fma x 4.16438922228 78.6994924154) 137.519416416) y)
z)
(fma
x
(fma x (fma x (+ x 43.3400022514) 263.505074721) 313.399215894)
47.066876606)))))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 tmp;
if ((x <= -4.994033402817942e+40) || !(x <= 2.844774379865759e+65)) {
tmp = (x - 2.0) / ((0.24013125253755718 + ((5.86923874282773 / x) + (931.6513700817767 / pow(x, 3.0)))) - fma(0.05766301844525606, (y / pow(x, 3.0)), (55.572073733743466 / (x * x))));
} else {
tmp = (x - 2.0) * (fma(x, fma(x, fma(x, fma(x, 4.16438922228, 78.6994924154), 137.519416416), y), z) / fma(x, fma(x, fma(x, (x + 43.3400022514), 263.505074721), 313.399215894), 47.066876606));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 26.9 |
|---|---|
| Target | 0.9 |
| Herbie | 1.5 |
if x < -4.99403340281794192e40 or 2.84477437986575909e65 < x Initial program 61.8
Simplified61.8
Applied associate-/l*_binary6458.4
Taylor expanded in x around inf 2.6
Simplified2.6
if -4.99403340281794192e40 < x < 2.84477437986575909e65Initial program 2.0
Simplified2.0
Applied *-un-lft-identity_binary642.0
Applied times-frac_binary640.8
Simplified0.8
Final simplification1.5
herbie shell --seed 2022081
(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)))