\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}\begin{array}{l}
\mathbf{if}\;z \leq -1.8478451807879652 \cdot 10^{+55}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{z \cdot z}{x} \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778 \cdot \frac{z}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(\left(x - 0.5\right) \cdot \log \left(\sqrt[3]{x}\right) - x\right)\right)\right) + \frac{z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right) + 0.083333333333333}{x}\\
\end{array}(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))(FPCore (x y z)
:precision binary64
(if (<= z -1.8478451807879652e+55)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(-
(* (/ (* z z) x) (+ y 0.0007936500793651))
(* 0.0027777777777778 (/ z x))))
(+
(+
0.91893853320467
(+
(* (- x 0.5) (log (* (cbrt x) (cbrt x))))
(- (* (- x 0.5) (log (cbrt x))) x)))
(/
(+
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778))
0.083333333333333)
x))))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 tmp;
if (z <= -1.8478451807879652e+55) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((z * z) / x) * (y + 0.0007936500793651)) - (0.0027777777777778 * (z / x)));
} else {
tmp = (0.91893853320467 + (((x - 0.5) * log(cbrt(x) * cbrt(x))) + (((x - 0.5) * log(cbrt(x))) - x))) + (((z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778)) + 0.083333333333333) / x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.1 |
|---|---|
| Target | 1.3 |
| Herbie | 5.3 |
if z < -1.8478451807879652e55Initial program 29.3
Taylor expanded around inf 29.8
Simplified20.6
if -1.8478451807879652e55 < z Initial program 3.7
rmApplied add-cube-cbrt_binary64_120483.7
Applied log-prod_binary64_120993.8
Applied distribute-rgt-in_binary64_119633.8
Applied associate--l+_binary64_119503.7
Simplified3.7
Final simplification5.3
herbie shell --seed 2020342
(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)))