\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 -6.808458039899931 \cdot 10^{+39}:\\
\;\;\;\;\left(x - 2\right) \cdot \left(\left(4.16438922228 + \frac{y}{{x}^{3}}\right) - \frac{101.78514585392108}{x}\right)\\
\mathbf{elif}\;x \leq 4.681623202233483 \cdot 10^{+37}:\\
\;\;\;\;\left(x - 2\right) \cdot \frac{x \cdot \left(y + x \cdot \left(x \cdot \left(x \cdot 4.16438922228 + 78.6994924154\right) + 137.519416416\right)\right) + z}{x \cdot \left(\left(\left(x \cdot x\right) \cdot \left(x + 43.3400022514\right) + x \cdot 263.505074721\right) + 313.399215894\right) + 47.066876606}\\
\mathbf{else}:\\
\;\;\;\;\left(x - 2\right) \cdot \left(\left(4.16438922228 + \frac{y}{{x}^{3}}\right) - \frac{101.78514585392108}{x}\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 (<= x -6.808458039899931e+39)
(*
(- x 2.0)
(- (+ 4.16438922228 (/ y (pow x 3.0))) (/ 101.78514585392108 x)))
(if (<= x 4.681623202233483e+37)
(*
(- x 2.0)
(/
(+
(*
x
(+
y
(* x (+ (* x (+ (* x 4.16438922228) 78.6994924154)) 137.519416416))))
z)
(+
(*
x
(+
(+ (* (* x x) (+ x 43.3400022514)) (* x 263.505074721))
313.399215894))
47.066876606)))
(*
(- x 2.0)
(- (+ 4.16438922228 (/ y (pow x 3.0))) (/ 101.78514585392108 x))))))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 <= -6.808458039899931e+39) {
tmp = (x - 2.0) * ((4.16438922228 + (y / pow(x, 3.0))) - (101.78514585392108 / x));
} else if (x <= 4.681623202233483e+37) {
tmp = (x - 2.0) * (((x * (y + (x * ((x * ((x * 4.16438922228) + 78.6994924154)) + 137.519416416)))) + z) / ((x * ((((x * x) * (x + 43.3400022514)) + (x * 263.505074721)) + 313.399215894)) + 47.066876606));
} else {
tmp = (x - 2.0) * ((4.16438922228 + (y / pow(x, 3.0))) - (101.78514585392108 / x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 26.5 |
|---|---|
| Target | 0.6 |
| Herbie | 0.6 |
if x < -6.80845803989993092e39 or 4.6816232022334829e37 < x Initial program 60.1
rmApplied *-un-lft-identity_binary6460.1
Applied times-frac_binary6456.3
Simplified56.3
Simplified56.3
Taylor expanded around inf 0.9
Simplified0.9
if -6.80845803989993092e39 < x < 4.6816232022334829e37Initial program 0.8
rmApplied *-un-lft-identity_binary640.8
Applied times-frac_binary640.4
Simplified0.4
Simplified0.4
rmApplied distribute-rgt-in_binary640.4
Simplified0.4
Simplified0.4
rmApplied associate-*r*_binary640.4
Final simplification0.6
herbie shell --seed 2020273
(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)))