x \cdot \log \left(\frac{x}{y}\right) - z
\begin{array}{l}
t_0 := \log \left(\frac{\sqrt[3]{x}}{\sqrt[3]{y}}\right)\\
\mathsf{fma}\left(x, 2 \cdot t_0, x \cdot t_0\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (- (* x (log (/ x y))) z))
(FPCore (x y z) :precision binary64 (let* ((t_0 (log (/ (cbrt x) (cbrt y))))) (- (fma x (* 2.0 t_0) (* x t_0)) z)))
double code(double x, double y, double z) {
return (x * log(x / y)) - z;
}
double code(double x, double y, double z) {
double t_0 = log(cbrt(x) / cbrt(y));
return fma(x, (2.0 * t_0), (x * t_0)) - z;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 14.8 |
|---|---|
| Target | 7.7 |
| Herbie | 0.1 |
Initial program 14.8
Applied add-cube-cbrt_binary6414.8
Applied add-cube-cbrt_binary6414.8
Applied times-frac_binary6414.8
Applied log-prod_binary643.5
Applied distribute-rgt-in_binary643.5
Simplified0.2
Simplified0.2
Applied fma-def_binary640.1
Final simplification0.1
herbie shell --seed 2022004
(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))