\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}\begin{array}{l}
\mathbf{if}\;\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z \le -2.3650331453426772 \cdot 10^{303}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \left(\left(7.93650079365100015 \cdot 10^{-4} \cdot \frac{{z}^{2}}{x} + 0.0833333333333329956 \cdot \frac{1}{x}\right) - 0.0027777777777778 \cdot \frac{z}{x}\right)\\
\mathbf{elif}\;\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z \le 1.2871692070878 \cdot 10^{266}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \left(3 \cdot \log \left(\sqrt[3]{x}\right)\right) - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(\log \left(\sqrt[3]{x}\right) \cdot \left(x - 0.5\right) - x\right)\right) + 0.91893853320467001\right) + \left(\left(7.93650079365100015 \cdot 10^{-4} \cdot \frac{{z}^{2}}{x} - 0.0027777777777778 \cdot \frac{z}{x}\right) + \frac{0.0833333333333329956}{x}\right)\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (((double) (((double) (((double) (x - 0.5)) * ((double) log(x)))) - x)) + 0.91893853320467)) + ((double) (((double) (((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) + 0.083333333333333)) / x))));
}
double code(double x, double y, double z) {
double VAR;
if ((((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) <= -2.3650331453426772e+303)) {
VAR = ((double) (((double) (((double) (((double) (((double) (x - 0.5)) * ((double) log(x)))) - x)) + 0.91893853320467)) + ((double) (((double) (((double) (0.0007936500793651 * ((double) (((double) pow(z, 2.0)) / x)))) + ((double) (0.083333333333333 * ((double) (1.0 / x)))))) - ((double) (0.0027777777777778 * ((double) (z / x))))))));
} else {
double VAR_1;
if ((((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) <= 1.2871692070877998e+266)) {
VAR_1 = ((double) (((double) (((double) (((double) (((double) (x - 0.5)) * ((double) (3.0 * ((double) log(((double) cbrt(x)))))))) - x)) + 0.91893853320467)) + ((double) (((double) (((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) + 0.083333333333333)) / x))));
} else {
VAR_1 = ((double) (((double) (((double) (((double) (((double) (x - 0.5)) * ((double) log(((double) (((double) cbrt(x)) * ((double) cbrt(x)))))))) + ((double) (((double) (((double) log(((double) cbrt(x)))) * ((double) (x - 0.5)))) - x)))) + 0.91893853320467)) + ((double) (((double) (((double) (0.0007936500793651 * ((double) (((double) pow(z, 2.0)) / x)))) - ((double) (0.0027777777777778 * ((double) (z / x)))))) + ((double) (0.083333333333333 / x))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.1 |
|---|---|
| Target | 1.2 |
| Herbie | 5.5 |
if (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) < -2.3650331453426772e303Initial program 61.0
Taylor expanded around 0 41.1
if -2.3650331453426772e303 < (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) < 1.2871692070878e266Initial program 0.2
rmApplied add-cube-cbrt0.2
Applied log-prod0.3
Applied distribute-lft-in0.3
Simplified0.3
rmApplied distribute-lft-out0.3
Simplified0.3
if 1.2871692070878e266 < (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) Initial program 49.0
rmApplied add-cube-cbrt49.0
Applied log-prod49.0
Applied distribute-lft-in49.0
Applied associate--l+49.0
Simplified49.0
Taylor expanded around 0 47.1
Simplified47.1
Final simplification5.5
herbie shell --seed 2020161
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))