x + \frac{y \cdot \left(\left(\left(\left(z \cdot 3.13060547622999996 + 11.166754126200001\right) \cdot z + t\right) \cdot z + a\right) \cdot z + b\right)}{\left(\left(\left(z + 15.234687406999999\right) \cdot z + 31.469011574900001\right) \cdot z + 11.940090572100001\right) \cdot z + 0.60777138777100004}\begin{array}{l}
\mathbf{if}\;z \le -1.7951056084945683 \cdot 10^{46}:\\
\;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{t}{{z}^{2}}, x\right)\\
\mathbf{elif}\;z \le 2.34503027419662274 \cdot 10^{55}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z + 15.234687406999999, z, 31.469011574900001\right), z, 11.940090572100001\right), z, 0.60777138777100004\right)}, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 3.13060547622999996, 11.166754126200001\right), z, t\right), z, a\right), z, b\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 3.13060547622999996 + \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{\left|z\right|} \cdot \frac{\frac{\sqrt[3]{t}}{1}}{\left|z\right|}, x\right)\\
\end{array}double code(double x, double y, double z, double t, double a, double b) {
return (x + ((y * ((((((((z * 3.13060547623) + 11.1667541262) * z) + t) * z) + a) * z) + b)) / (((((((z + 15.234687407) * z) + 31.4690115749) * z) + 11.9400905721) * z) + 0.607771387771)));
}
double code(double x, double y, double z, double t, double a, double b) {
double temp;
if ((z <= -1.7951056084945683e+46)) {
temp = fma(y, (3.13060547623 + (t / pow(z, 2.0))), x);
} else {
double temp_1;
if ((z <= 2.3450302741966227e+55)) {
temp_1 = fma((y / fma(fma(fma((z + 15.234687407), z, 31.4690115749), z, 11.9400905721), z, 0.607771387771)), fma(fma(fma(fma(z, 3.13060547623, 11.1667541262), z, t), z, a), z, b), x);
} else {
temp_1 = fma(y, (3.13060547623 + (((cbrt(t) * cbrt(t)) / fabs(z)) * ((cbrt(t) / 1.0) / fabs(z)))), x);
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b
Results
| Original | 29.5 |
|---|---|
| Target | 1.0 |
| Herbie | 1.1 |
if z < -1.7951056084945683e+46Initial program 60.9
Simplified59.7
Taylor expanded around inf 9.0
Simplified1.0
if -1.7951056084945683e+46 < z < 2.3450302741966227e+55Initial program 2.6
Simplified1.4
if 2.3450302741966227e+55 < z Initial program 62.2
Simplified60.9
Taylor expanded around inf 7.5
Simplified0.6
rmApplied add-sqr-sqrt0.6
Applied add-cube-cbrt0.6
Applied times-frac0.6
Simplified0.6
Simplified0.6
Final simplification1.1
herbie shell --seed 2020058 +o rules:numerics
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:logGamma from math-functions-0.1.5.2, D"
:precision binary64
:herbie-target
(if (< z -6.499344996252632e+53) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z))) (/ y 1))) (if (< z 7.066965436914287e+59) (+ x (/ y (/ (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771) (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)))) (+ x (* (+ (- 3.13060547623 (/ 36.527041698806414 z)) (/ t (* z z))) (/ y 1)))))
(+ x (/ (* y (+ (* (+ (* (+ (* (+ (* z 3.13060547623) 11.1667541262) z) t) z) a) z) b)) (+ (* (+ (* (+ (* (+ z 15.234687407) z) 31.4690115749) z) 11.9400905721) z) 0.607771387771))))