\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -1.025060815940221284599523414245967851062 \cdot 10^{-116} \lor \neg \left(x \le 2.664793329374929939202329816063701600281 \cdot 10^{-65}\right):\\
\;\;\;\;\frac{y}{z} \cdot x + x\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z} + x\\
\end{array}double f(double x, double y, double z) {
double r388804 = x;
double r388805 = y;
double r388806 = z;
double r388807 = r388805 + r388806;
double r388808 = r388804 * r388807;
double r388809 = r388808 / r388806;
return r388809;
}
double f(double x, double y, double z) {
double r388810 = x;
double r388811 = -1.0250608159402213e-116;
bool r388812 = r388810 <= r388811;
double r388813 = 2.66479332937493e-65;
bool r388814 = r388810 <= r388813;
double r388815 = !r388814;
bool r388816 = r388812 || r388815;
double r388817 = y;
double r388818 = z;
double r388819 = r388817 / r388818;
double r388820 = r388819 * r388810;
double r388821 = r388820 + r388810;
double r388822 = r388810 * r388817;
double r388823 = 1.0;
double r388824 = r388823 / r388818;
double r388825 = r388822 * r388824;
double r388826 = r388825 + r388810;
double r388827 = r388816 ? r388821 : r388826;
return r388827;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.7 |
|---|---|
| Target | 3.2 |
| Herbie | 2.0 |
if x < -1.0250608159402213e-116 or 2.66479332937493e-65 < x Initial program 17.0
Simplified0.7
rmApplied fma-udef0.7
if -1.0250608159402213e-116 < x < 2.66479332937493e-65Initial program 6.5
Simplified7.7
rmApplied fma-udef7.7
rmApplied *-un-lft-identity7.7
Applied add-cube-cbrt8.1
Applied times-frac8.1
Applied associate-*l*3.9
rmApplied associate-*l/3.4
rmApplied div-inv3.4
Applied associate-*r*4.3
Simplified3.9
Final simplification2.0
herbie shell --seed 2019353 +o rules:numerics
(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))