x \cdot \log \left(\frac{x}{y}\right) - z\begin{array}{l}
\mathbf{if}\;y \le -2.50299343895823 \cdot 10^{-310}:\\
\;\;\;\;x \cdot \left(\log \left(-x\right) - \log \left(-y\right)\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}double code(double x, double y, double z) {
return ((x * log((x / y))) - z);
}
double code(double x, double y, double z) {
double VAR;
if ((y <= -2.50299343895823e-310)) {
VAR = ((x * (log(-x) - log(-y))) - z);
} else {
VAR = ((x * (log(x) - log(y))) - z);
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 15.5 |
|---|---|
| Target | 7.7 |
| Herbie | 0.3 |
if y < -2.50299343895823e-310Initial program 15.1
rmApplied frac-2neg15.1
Applied log-div0.3
if -2.50299343895823e-310 < y Initial program 15.9
rmApplied log-div0.3
Final simplification0.3
herbie shell --seed 2020078
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))