\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}\begin{array}{l}
\mathbf{if}\;x \le 1.19845116113444352 \cdot 10^{125}:\\
\;\;\;\;\left(\left(\frac{\left(x \cdot x - 0.5 \cdot 0.5\right) \cdot \log x}{x + 0.5} - x\right) + 0.91893853320467001\right) + \frac{\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.0833333333333329956}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467001\right) + \frac{1}{\left(0.400000000000006406 \cdot \left(x \cdot z\right) + 12.000000000000048 \cdot x\right) - 0.100952278095241613 \cdot \left(x \cdot {z}^{2}\right)}\\
\end{array}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) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) + 0.083333333333333)) / x))));
}
double code(double x, double y, double z) {
double VAR;
if ((x <= 1.1984511611344435e+125)) {
VAR = ((double) (((double) (((double) (((double) (((double) (((double) (((double) (x * x)) - ((double) (0.5 * 0.5)))) * ((double) log(x)))) / ((double) (x + 0.5)))) - x)) + 0.91893853320467)) + ((double) (((double) (((double) (((double) (((double) (((double) (y + 0.0007936500793651)) * z)) - 0.0027777777777778)) * z)) + 0.083333333333333)) / x))));
} else {
VAR = ((double) (((double) (((double) (((double) (((double) (x - 0.5)) * ((double) log(x)))) - x)) + 0.91893853320467)) + ((double) (1.0 / ((double) (((double) (((double) (0.4000000000000064 * ((double) (x * z)))) + ((double) (12.000000000000048 * x)))) - ((double) (0.10095227809524161 * ((double) (x * ((double) pow(z, 2.0))))))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 5.7 |
|---|---|
| Target | 1.0 |
| Herbie | 6.0 |
if x < 1.19845116113444352e125Initial program 1.8
rmApplied flip--1.8
Applied associate-*l/1.8
if 1.19845116113444352e125 < x Initial program 12.2
rmApplied clear-num12.2
Taylor expanded around 0 13.1
Final simplification6.0
herbie shell --seed 2020162
(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)))