\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y + z\right)}{z}\\
t_1 := \frac{x}{\frac{z}{y + z}}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq -1.9758423335381378 \cdot 10^{+60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 1.462732982746968 \cdot 10^{-41}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 1.6895306086943411 \cdot 10^{+249}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\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)) (t_1 (/ x (/ z (+ y z)))))
(if (<= t_0 (- INFINITY))
t_1
(if (<= t_0 -1.9758423335381378e+60)
t_0
(if (<= t_0 1.462732982746968e-41)
t_1
(if (<= t_0 1.6895306086943411e+249) t_0 (fma x (/ y z) 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 t_1 = x / (z / (y + z));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_0 <= -1.9758423335381378e+60) {
tmp = t_0;
} else if (t_0 <= 1.462732982746968e-41) {
tmp = t_1;
} else if (t_0 <= 1.6895306086943411e+249) {
tmp = t_0;
} else {
tmp = fma(x, (y / z), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.5 |
|---|---|
| Target | 2.9 |
| Herbie | 0.7 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or -1.9758423335381378e60 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.4627329827469679e-41Initial program 15.0
rmApplied associate-/l*_binary640.2
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -1.9758423335381378e60 or 1.4627329827469679e-41 < (/.f64 (*.f64 x (+.f64 y z)) z) < 1.6895306086943411e249Initial program 0.2
if 1.6895306086943411e249 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 43.3
Simplified4.5
Final simplification0.7
herbie shell --seed 2021211
(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))