\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 2.2940227510868728 \cdot 10^{+23}:\\
\;\;\;\;\left(\left(\log \left(\sqrt{x}\right) \cdot \left(x - 0.5\right) + \left(\sqrt{\log \left(\sqrt{x}\right) \cdot \left(x - 0.5\right)} \cdot \sqrt{\log \left(\sqrt{x}\right) \cdot \left(x - 0.5\right)} - x\right)\right) + 0.91893853320467\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log \left(\sqrt{x}\right) \cdot \left(x - 0.5\right) + \left(\log \left(\sqrt{x}\right) \cdot \left(x - 0.5\right) - x\right)\right)\right) + \left(\left(y + 0.0007936500793651\right) \cdot \frac{z \cdot z}{x} - 0.0027777777777778 \cdot \frac{z}{x}\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 2.2940227510868728e+23)
(+
(+
(+
(* (log (sqrt x)) (- x 0.5))
(-
(*
(sqrt (* (log (sqrt x)) (- x 0.5)))
(sqrt (* (log (sqrt x)) (- x 0.5))))
x))
0.91893853320467)
(/
(+
(* z (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
0.083333333333333)
x))
(+
(+
0.91893853320467
(+ (* (log (sqrt x)) (- x 0.5)) (- (* (log (sqrt x)) (- x 0.5)) x)))
(-
(* (+ y 0.0007936500793651) (/ (* z z) x))
(* 0.0027777777777778 (/ 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 <= 2.2940227510868728e+23) {
tmp = (((log(sqrt(x)) * (x - 0.5)) + ((sqrt(log(sqrt(x)) * (x - 0.5)) * sqrt(log(sqrt(x)) * (x - 0.5))) - x)) + 0.91893853320467) + (((z * (((y + 0.0007936500793651) * z) - 0.0027777777777778)) + 0.083333333333333) / x);
} else {
tmp = (0.91893853320467 + ((log(sqrt(x)) * (x - 0.5)) + ((log(sqrt(x)) * (x - 0.5)) - x))) + (((y + 0.0007936500793651) * ((z * z) / x)) - (0.0027777777777778 * (z / x)));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.9 |
|---|---|
| Target | 1.2 |
| Herbie | 4.3 |
if x < 2.2940227510868728e23Initial program 0.2
rmApplied add-sqr-sqrt_binary64_142520.2
Applied log-prod_binary64_143140.2
Applied distribute-rgt-in_binary64_141830.2
Applied associate--l+_binary64_141700.2
Simplified0.2
rmApplied add-sqr-sqrt_binary64_142520.3
if 2.2940227510868728e23 < x Initial program 10.6
rmApplied add-sqr-sqrt_binary64_1425210.6
Applied log-prod_binary64_1431410.6
Applied distribute-rgt-in_binary64_1418310.6
Applied associate--l+_binary64_1417010.6
Simplified10.6
Taylor expanded around inf 10.8
Simplified7.6
Final simplification4.3
herbie shell --seed 2020281
(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)))