\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}\;x \le 8.08463019213889685 \cdot 10^{87}:\\
\;\;\;\;\left(\left(\left(\left(x - 0.5\right) \cdot \left(2 \cdot \log \left({x}^{\frac{1}{3}}\right)\right) + \left(x - 0.5\right) \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 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)\\
\end{array}double code(double x, double y, double z) {
return (((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x));
}
double code(double x, double y, double z) {
double VAR;
if ((x <= 8.084630192138897e+87)) {
VAR = ((((((x - 0.5) * (2.0 * log(pow(x, 0.3333333333333333)))) + ((x - 0.5) * log(cbrt(x)))) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x));
} else {
VAR = (((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((0.0007936500793651 * (pow(z, 2.0) / x)) + (0.083333333333333 * (1.0 / x))) - (0.0027777777777778 * (z / x))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.2 |
|---|---|
| Target | 1.2 |
| Herbie | 5.6 |
if x < 8.084630192138897e+87Initial program 1.0
rmApplied add-cube-cbrt1.0
Applied log-prod1.0
Applied distribute-lft-in1.0
Simplified1.0
rmApplied pow1/31.0
if 8.084630192138897e+87 < x Initial program 13.0
Taylor expanded around 0 11.5
Final simplification5.6
herbie shell --seed 2020105
(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)))