\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}\;x \leq 5.109353660521276 \cdot 10^{+17}:\\
\;\;\;\;\left(\left(x - 0.5\right) \cdot \left(2 \cdot \left(\log \left(\sqrt[3]{x}\right) + \log \left(\sqrt[3]{\sqrt[3]{x}}\right)\right)\right) + \left(x - 0.5\right) \cdot \log \left(\sqrt[3]{\sqrt[3]{x}}\right)\right) + \left(0.91893853320467 + \left(\frac{z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right) + 0.083333333333333}{x} - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 + \left(\left(\left(y + 0.0007936500793651\right) \cdot \frac{z}{\frac{x}{z}} - 0.0027777777777778 \cdot \frac{z}{x}\right) - x\right)\right)\\
\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 (<= x 5.109353660521276e+17)
(+
(+
(* (- x 0.5) (* 2.0 (+ (log (cbrt x)) (log (cbrt (cbrt x))))))
(* (- x 0.5) (log (cbrt (cbrt x)))))
(+
0.91893853320467
(-
(/
(+
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778))
0.083333333333333)
x)
x)))
(+
(* (- x 0.5) (log x))
(+
0.91893853320467
(-
(-
(* (+ y 0.0007936500793651) (/ z (/ x z)))
(* 0.0027777777777778 (/ z x)))
x)))))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) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) + 0.083333333333333)) / x)));
}
double code(double x, double y, double z) {
double VAR;
if ((x <= 5.109353660521276e+17)) {
VAR = ((double) (((double) (((double) (((double) (x - 0.5)) * ((double) (2.0 * ((double) (((double) log(((double) cbrt(x)))) + ((double) log(((double) cbrt(((double) cbrt(x)))))))))))) + ((double) (((double) (x - 0.5)) * ((double) log(((double) cbrt(((double) cbrt(x)))))))))) + ((double) (0.91893853320467 + ((double) ((((double) (((double) (z * ((double) (((double) (z * ((double) (y + 0.0007936500793651)))) - 0.0027777777777778)))) + 0.083333333333333)) / x) - x))))));
} else {
VAR = ((double) (((double) (((double) (x - 0.5)) * ((double) log(x)))) + ((double) (0.91893853320467 + ((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * (z / (x / z)))) - ((double) (0.0027777777777778 * (z / x))))) - x))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.7 |
|---|---|
| Target | 1.2 |
| Herbie | 0.3 |
if x < 510935366052127620Initial program 0.2
Simplified0.2
rmApplied add-cube-cbrt0.2
Applied log-prod0.2
Applied distribute-lft-in0.2
Simplified0.2
rmApplied add-cube-cbrt0.2
Applied log-prod0.2
Applied distribute-lft-in0.2
Applied associate-+r+0.2
Simplified0.2
if 510935366052127620 < x Initial program 10.2
Simplified10.2
Taylor expanded around inf 10.3
Simplified0.4
Final simplification0.3
herbie shell --seed 2020198
(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)))