\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.6524798424710355 \cdot 10^{+76} \lor \neg \left(x \leq 8.851117381461261 \cdot 10^{+56}\right):\\
\;\;\;\;\left(\left(x \cdot 4.16438922228 + \frac{3655.120465407641}{x}\right) + \frac{y}{x \cdot x}\right) - \left(110.11392429848108 + \frac{130977.50649958356}{x \cdot x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - 2\right) \cdot \left(x \cdot \frac{y}{47.066876606 + \left(x \cdot 313.399215894 + \left(\left(x \cdot x\right) \cdot 263.505074721 + {x}^{3} \cdot \left(x + 43.3400022514\right)\right)\right)} + \left(\frac{z}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)} + \left(137.519416416 \cdot \frac{x \cdot x}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)} + \left(4.16438922228 \cdot \frac{{x}^{4}}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\right)} + 78.6994924154 \cdot \frac{{x}^{3}}{47.066876606 + x \cdot \left(313.399215894 + x \cdot \left(263.505074721 + x \cdot \left(x + 43.3400022514\right)\right)\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 -4.6524798424710355e+76) (not (<= x 8.851117381461261e+56)))
(-
(+ (+ (* x 4.16438922228) (/ 3655.120465407641 x)) (/ y (* x x)))
(+ 110.11392429848108 (/ 130977.50649958356 (* x x))))
(*
(- x 2.0)
(+
(*
x
(/
y
(+
47.066876606
(+
(* x 313.399215894)
(+ (* (* x x) 263.505074721) (* (pow x 3.0) (+ x 43.3400022514)))))))
(+
(/
z
(+
47.066876606
(*
x
(+ 313.399215894 (* x (+ 263.505074721 (* x (+ x 43.3400022514))))))))
(+
(*
137.519416416
(/
(* x x)
(+
47.066876606
(*
x
(+
313.399215894
(* x (+ 263.505074721 (* x (+ x 43.3400022514)))))))))
(+
(*
4.16438922228
(/
(pow x 4.0)
(+
47.066876606
(*
x
(+
313.399215894
(* x (+ 263.505074721 (* x (+ x 43.3400022514)))))))))
(*
78.6994924154
(/
(pow x 3.0)
(+
47.066876606
(*
x
(+
313.399215894
(* x (+ 263.505074721 (* x (+ x 43.3400022514))))))))))))))))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.6524798424710355e+76) || !(x <= 8.851117381461261e+56)) {
tmp = (((x * 4.16438922228) + (3655.120465407641 / x)) + (y / (x * x))) - (110.11392429848108 + (130977.50649958356 / (x * x)));
} else {
tmp = (x - 2.0) * ((x * (y / (47.066876606 + ((x * 313.399215894) + (((x * x) * 263.505074721) + (pow(x, 3.0) * (x + 43.3400022514))))))) + ((z / (47.066876606 + (x * (313.399215894 + (x * (263.505074721 + (x * (x + 43.3400022514)))))))) + ((137.519416416 * ((x * x) / (47.066876606 + (x * (313.399215894 + (x * (263.505074721 + (x * (x + 43.3400022514))))))))) + ((4.16438922228 * (pow(x, 4.0) / (47.066876606 + (x * (313.399215894 + (x * (263.505074721 + (x * (x + 43.3400022514))))))))) + (78.6994924154 * (pow(x, 3.0) / (47.066876606 + (x * (313.399215894 + (x * (263.505074721 + (x * (x + 43.3400022514)))))))))))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 26.3 |
|---|---|
| Target | 0.5 |
| Herbie | 0.2 |
if x < -4.65247984247103554e76 or 8.8511173814612611e56 < x Initial program 63.4
Taylor expanded around inf 0.2
Simplified0.2
if -4.65247984247103554e76 < x < 8.8511173814612611e56Initial program 3.0
rmApplied *-un-lft-identity_binary643.0
Applied times-frac_binary640.9
Simplified0.9
Simplified0.9
Taylor expanded around 0 0.9
Simplified0.9
rmApplied *-un-lft-identity_binary640.9
Applied times-frac_binary640.2
Simplified0.2
Taylor expanded around 0 0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2021118
(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)))