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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 26.7 |
|---|---|
| Target | 0.6 |
| Herbie | 0.7 |
if x < -2.3691724974546789e37Initial program 58.9
rmApplied *-un-lft-identity_binary64_1064958.9
Applied times-frac_binary64_1065554.8
Simplified54.8
Simplified54.8
Taylor expanded around inf 0.9
Simplified0.9
if -2.3691724974546789e37 < x < 3.88076255453383013e73Initial program 2.6
rmApplied *-un-lft-identity_binary64_106492.6
Applied times-frac_binary64_106550.8
Simplified0.8
Simplified0.8
Taylor expanded around 0 0.7
if 3.88076255453383013e73 < x Initial program 64.0
Taylor expanded around inf 0.5
Final simplification0.7
herbie shell --seed 2021093
(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)))