x \cdot \log \left(\frac{x}{y}\right) - z\begin{array}{l}
\mathbf{if}\;y \le -5.330202515239102447628611255442331031352 \cdot 10^{-309}:\\
\;\;\;\;\mathsf{fma}\left(x, \log \left(\frac{-1}{y}\right) - \log \left(\frac{-1}{x}\right), -z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \log \left(\frac{\sqrt{x}}{\sqrt{y}}\right) + \log \left(\frac{\sqrt{x}}{\sqrt{y}}\right), -z\right)\\
\end{array}double f(double x, double y, double z) {
double r57605475 = x;
double r57605476 = y;
double r57605477 = r57605475 / r57605476;
double r57605478 = log(r57605477);
double r57605479 = r57605475 * r57605478;
double r57605480 = z;
double r57605481 = r57605479 - r57605480;
return r57605481;
}
double f(double x, double y, double z) {
double r57605482 = y;
double r57605483 = -5.3302025152391e-309;
bool r57605484 = r57605482 <= r57605483;
double r57605485 = x;
double r57605486 = -1.0;
double r57605487 = r57605486 / r57605482;
double r57605488 = log(r57605487);
double r57605489 = r57605486 / r57605485;
double r57605490 = log(r57605489);
double r57605491 = r57605488 - r57605490;
double r57605492 = z;
double r57605493 = -r57605492;
double r57605494 = fma(r57605485, r57605491, r57605493);
double r57605495 = sqrt(r57605485);
double r57605496 = sqrt(r57605482);
double r57605497 = r57605495 / r57605496;
double r57605498 = log(r57605497);
double r57605499 = r57605498 + r57605498;
double r57605500 = fma(r57605485, r57605499, r57605493);
double r57605501 = r57605484 ? r57605494 : r57605500;
return r57605501;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 15.1 |
|---|---|
| Target | 7.6 |
| Herbie | 0.2 |
if y < -5.3302025152391e-309Initial program 14.8
rmApplied fma-neg14.8
Taylor expanded around -inf 0.3
if -5.3302025152391e-309 < y Initial program 15.4
rmApplied fma-neg15.4
rmApplied add-sqr-sqrt15.4
Applied add-sqr-sqrt15.4
Applied times-frac15.4
Applied log-prod0.1
Final simplification0.2
herbie shell --seed 2019173 +o rules:numerics
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:herbie-target
(if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))