\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 4.2685767177764653 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x + -0.5, 0.91893853320467 - x\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x + -0.5\right) \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \mathsf{fma}\left(x + -0.5, \log \left(\sqrt[3]{x}\right), 0.91893853320467 - x\right)\right) + \left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{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 (<= x 4.2685767177764653e+67)
(+
(fma (log x) (+ x -0.5) (- 0.91893853320467 x))
(/
(+
(* z (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
0.083333333333333)
x))
(+
(+
(* (+ x -0.5) (log (* (cbrt x) (cbrt x))))
(fma (+ x -0.5) (log (cbrt x)) (- 0.91893853320467 x)))
(* (+ y 0.0007936500793651) (/ (* z z) 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 (x <= 4.2685767177764653e+67) {
tmp = fma(log(x), (x + -0.5), (0.91893853320467 - x)) + (((z * (((y + 0.0007936500793651) * z) - 0.0027777777777778)) + 0.083333333333333) / x);
} else {
tmp = (((x + -0.5) * log(cbrt(x) * cbrt(x))) + fma((x + -0.5), log(cbrt(x)), (0.91893853320467 - x))) + ((y + 0.0007936500793651) * ((z * z) / x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 4.0 |
|---|---|
| Target | 0.9 |
| Herbie | 2.8 |
if x < 4.26857671777646533e67Initial program 0.5
Taylor expanded in x around 0 0.5
Simplified0.5
if 4.26857671777646533e67 < x Initial program 9.8
Applied add-cube-cbrt_binary649.8
Applied log-prod_binary649.8
Applied distribute-rgt-in_binary649.8
Applied associate--l+_binary649.8
Applied associate-+l+_binary649.8
Simplified9.8
Taylor expanded in z around inf 9.8
Simplified6.6
Final simplification2.8
herbie shell --seed 2022088
(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)))