x \cdot \log \left(\frac{x}{y}\right) - z\begin{array}{l}
\mathbf{if}\;y \le -5.640858341756123312303713450472891686377 \cdot 10^{-309}:\\
\;\;\;\;x \cdot \log \left(\frac{-1}{y}\right) - \mathsf{fma}\left(\log \left(\frac{-1}{x}\right), x, z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\log x \cdot x + x \cdot \log \left(\frac{1}{y}\right)\right) - z\\
\end{array}double f(double x, double y, double z) {
double r426565 = x;
double r426566 = y;
double r426567 = r426565 / r426566;
double r426568 = log(r426567);
double r426569 = r426565 * r426568;
double r426570 = z;
double r426571 = r426569 - r426570;
return r426571;
}
double f(double x, double y, double z) {
double r426572 = y;
double r426573 = -5.640858341756123e-309;
bool r426574 = r426572 <= r426573;
double r426575 = x;
double r426576 = -1.0;
double r426577 = r426576 / r426572;
double r426578 = log(r426577);
double r426579 = r426575 * r426578;
double r426580 = r426576 / r426575;
double r426581 = log(r426580);
double r426582 = z;
double r426583 = fma(r426581, r426575, r426582);
double r426584 = r426579 - r426583;
double r426585 = log(r426575);
double r426586 = r426585 * r426575;
double r426587 = 1.0;
double r426588 = r426587 / r426572;
double r426589 = log(r426588);
double r426590 = r426575 * r426589;
double r426591 = r426586 + r426590;
double r426592 = r426591 - r426582;
double r426593 = r426574 ? r426584 : r426592;
return r426593;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 15.1 |
|---|---|
| Target | 7.9 |
| Herbie | 0.4 |
if y < -5.640858341756123e-309Initial program 15.2
Taylor expanded around -inf 0.4
Simplified0.4
if -5.640858341756123e-309 < y Initial program 15.1
rmApplied *-un-lft-identity15.1
Applied add-cube-cbrt15.1
Applied times-frac15.1
Applied log-prod4.6
Applied distribute-lft-in4.7
Simplified4.7
rmApplied div-inv4.7
Applied log-prod0.4
Applied distribute-lft-in0.4
Applied associate-+r+0.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019208 +o rules:numerics
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< y 7.59507779908377277e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))