\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;x + \frac{1}{\frac{\frac{z}{x}}{y}}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := x + \frac{x \cdot y}{z}\\
\mathbf{if}\;t_0 \leq -2.5470166038654833 \cdot 10^{-217}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 58567475251.42587:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{elif}\;t_0 \leq 3.111711601723932 \cdot 10^{+296}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\frac{y}{z} \cdot \sqrt[3]{x}\right)\\
\end{array}\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (+ y z)) z)))
(if (<= t_0 (- INFINITY))
(+ x (/ 1.0 (/ (/ z x) y)))
(let* ((t_1 (+ x (/ (* x y) z))))
(if (<= t_0 -2.5470166038654833e-217)
t_1
(if (<= t_0 58567475251.42587)
(fma x (/ y z) x)
(if (<= t_0 3.111711601723932e+296)
t_1
(+ x (* (* (cbrt x) (cbrt x)) (* (/ y z) (cbrt x)))))))))))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double t_0 = (x * (y + z)) / z;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = x + (1.0 / ((z / x) / y));
} else {
double t_1 = x + ((x * y) / z);
double tmp_1;
if (t_0 <= -2.5470166038654833e-217) {
tmp_1 = t_1;
} else if (t_0 <= 58567475251.42587) {
tmp_1 = fma(x, (y / z), x);
} else if (t_0 <= 3.111711601723932e+296) {
tmp_1 = t_1;
} else {
tmp_1 = x + ((cbrt(x) * cbrt(x)) * ((y / z) * cbrt(x)));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.4 |
|---|---|
| Target | 3.2 |
| Herbie | 0.3 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0Initial program 64.0
Simplified0.1
Taylor expanded in y around 0 20.1
Applied associate-/l*_binary640.1
Applied clear-num_binary640.1
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -2.54701660386548331e-217 or 58567475251.425873 < (/.f64 (*.f64 x (+.f64 y z)) z) < 3.111711601723932e296Initial program 0.3
Simplified5.9
Taylor expanded in y around 0 0.2
if -2.54701660386548331e-217 < (/.f64 (*.f64 x (+.f64 y z)) z) < 58567475251.425873Initial program 9.9
Simplified0.1
if 3.111711601723932e296 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 59.1
Simplified1.4
Taylor expanded in y around 0 23.9
Applied associate-/l*_binary642.7
Applied add-cube-cbrt_binary642.9
Applied *-un-lft-identity_binary642.9
Applied times-frac_binary642.9
Applied *-un-lft-identity_binary642.9
Applied times-frac_binary642.0
Simplified2.0
Simplified1.6
Final simplification0.3
herbie shell --seed 2022097
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))