\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 -3.814786698001926 \cdot 10^{-200}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 3.5870461030883145 \cdot 10^{-103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 6.381534117083224 \cdot 10^{+306}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 -3.814786698001926e-200)
t_0
(if (<= t_0 3.5870461030883145e-103)
t_1
(if (<= t_0 6.381534117083224e+306) t_0 t_1))))))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 <= -3.814786698001926e-200) {
tmp = t_0;
} else if (t_0 <= 3.5870461030883145e-103) {
tmp = t_1;
} else if (t_0 <= 6.381534117083224e+306) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.6 |
|---|---|
| Target | 3.0 |
| Herbie | 0.2 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or -3.81478669800192591e-200 < (/.f64 (*.f64 x (+.f64 y z)) z) < 3.5870461030883145e-103 or 6.38153411708322369e306 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 34.7
Applied associate-/l*_binary640.1
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -3.81478669800192591e-200 or 3.5870461030883145e-103 < (/.f64 (*.f64 x (+.f64 y z)) z) < 6.38153411708322369e306Initial program 0.3
Applied *-un-lft-identity_binary640.3
Applied associate-/r*_binary640.3
Final simplification0.2
herbie shell --seed 2022077
(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))