\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 -2.530021484323837 \cdot 10^{+58} \lor \neg \left(x \leq 2.684414262750609 \cdot 10^{+23}\right):\\
\;\;\;\;\left(x \cdot 4.16438922228 + \frac{3655.120465407641}{x}\right) + \left(\frac{y}{x \cdot x} - \left(110.11392429848108 + \frac{130977.50649958356}{x \cdot x}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(4.16438922228 \cdot \frac{{x}^{5}}{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)} + \left(70.37071397084 \cdot \frac{{x}^{4}}{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)} + y \cdot \frac{x}{\frac{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)}{x}}\right)\right) + \frac{z}{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)} \cdot \left(x - 2\right)\right) - \left(\frac{19.87956841479999}{\frac{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)}{{x}^{3}}} + \left(\frac{2 \cdot \left(x \cdot y\right)}{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)} + \frac{\left(x \cdot x\right) \cdot 275.038832832}{{x}^{4} + \left(\left({x}^{3} \cdot 43.3400022514 + 47.066876606\right) + \left(x \cdot 313.399215894 + x \cdot \left(x \cdot 263.505074721\right)\right)\right)}\right)\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 -2.530021484323837e+58) (not (<= x 2.684414262750609e+23)))
(+
(+ (* x 4.16438922228) (/ 3655.120465407641 x))
(- (/ y (* x x)) (+ 110.11392429848108 (/ 130977.50649958356 (* x x)))))
(-
(+
(+
(*
4.16438922228
(/
(pow x 5.0)
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721)))))))
(+
(*
70.37071397084
(/
(pow x 4.0)
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721)))))))
(*
y
(/
x
(/
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721)))))
x)))))
(*
(/
z
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721))))))
(- x 2.0)))
(+
(/
19.87956841479999
(/
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721)))))
(pow x 3.0)))
(+
(/
(* 2.0 (* x y))
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721))))))
(/
(* (* x x) 275.038832832)
(+
(pow x 4.0)
(+
(+ (* (pow x 3.0) 43.3400022514) 47.066876606)
(+ (* x 313.399215894) (* x (* x 263.505074721)))))))))))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 <= -2.530021484323837e+58) || !(x <= 2.684414262750609e+23)) {
tmp = ((x * 4.16438922228) + (3655.120465407641 / x)) + ((y / (x * x)) - (110.11392429848108 + (130977.50649958356 / (x * x))));
} else {
tmp = (((4.16438922228 * (pow(x, 5.0) / (pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721))))))) + ((70.37071397084 * (pow(x, 4.0) / (pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721))))))) + (y * (x / ((pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721))))) / x))))) + ((z / (pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721)))))) * (x - 2.0))) - ((19.87956841479999 / ((pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721))))) / pow(x, 3.0))) + (((2.0 * (x * y)) / (pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721)))))) + (((x * x) * 275.038832832) / (pow(x, 4.0) + (((pow(x, 3.0) * 43.3400022514) + 47.066876606) + ((x * 313.399215894) + (x * (x * 263.505074721))))))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 26.7 |
|---|---|
| Target | 0.5 |
| Herbie | 0.7 |
if x < -2.53002148432383677e58 or 2.6844142627506089e23 < x Initial program 60.0
Simplified56.1
Taylor expanded around inf 1.1
Simplified1.1
if -2.53002148432383677e58 < x < 2.6844142627506089e23Initial program 1.1
Simplified0.5
Taylor expanded around 0 1.0
Simplified0.5
Final simplification0.7
herbie shell --seed 2021176
(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)))