\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 \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \leq 3.704179924344528 \cdot 10^{+304}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{z \cdot \left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) + 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{1}{x \cdot \left(12.000000000000048 + z \cdot 0.40000000000000646\right) - 0.10095227809524163 \cdot \left(x \cdot \left(z \cdot z\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 (<=
(* z (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
3.704179924344528e+304)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* z (- (* (+ y 0.0007936500793651) z) 0.0027777777777778))
0.083333333333333)
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
1.0
(-
(* x (+ 12.000000000000048 (* z 0.40000000000000646)))
(* 0.10095227809524163 (* x (* z z))))))))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 * (((y + 0.0007936500793651) * z) - 0.0027777777777778)) <= 3.704179924344528e+304) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((z * (((y + 0.0007936500793651) * z) - 0.0027777777777778)) + 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (1.0 / ((x * (12.000000000000048 + (z * 0.40000000000000646))) - (0.10095227809524163 * (x * (z * z)))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.8 |
|---|---|
| Target | 1.2 |
| Herbie | 4.8 |
if (*.f64 (-.f64 (*.f64 (+.f64 y 7320129949063637/9223372036854775808) z) 3202559735019045/1152921504606846976) z) < 3.70417992434452793e304Initial program 1.7
if 3.70417992434452793e304 < (*.f64 (-.f64 (*.f64 (+.f64 y 7320129949063637/9223372036854775808) z) 3202559735019045/1152921504606846976) z) Initial program 62.7
rmApplied clear-num_binary64_1337662.7
Simplified62.7
Taylor expanded around 0 47.7
Simplified47.7
Final simplification4.8
herbie shell --seed 2020308
(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)))