\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}\;\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z \le -2.9559504795751335 \cdot 10^{155} \lor \neg \left(\left(\left(y + 7.93650079365100015 \cdot 10^{-4}\right) \cdot z - 0.0027777777777778\right) \cdot z \le 3.31668127190630236 \cdot 10^{218}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{{z}^{2}}{x}, y, 7.93650079365100015 \cdot 10^{-4} \cdot \frac{{z}^{2}}{x} - \mathsf{fma}\left(\log \left(\frac{1}{x}\right), x, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\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}\\
\end{array}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 VAR;
if (((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) <= -2.9559504795751335e+155) || !(((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) <= 3.3166812719063024e+218))) {
VAR = fma((pow(z, 2.0) / x), y, ((0.0007936500793651 * (pow(z, 2.0) / x)) - fma(log((1.0 / x)), x, x)));
} else {
VAR = (((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.2 |
|---|---|
| Target | 1.2 |
| Herbie | 4.4 |
if (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) < -2.9559504795751335e+155 or 3.3166812719063024e+218 < (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) Initial program 36.6
Simplified36.6
Taylor expanded around inf 37.0
Simplified25.8
if -2.9559504795751335e+155 < (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) < 3.3166812719063024e+218Initial program 0.2
Final simplification4.4
herbie shell --seed 2020105 +o rules:numerics
(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)))