\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \leq -1.0527729931731066 \cdot 10^{+145}:\\
\;\;\;\;x \cdot \frac{y + z}{z}\\
\mathbf{elif}\;x \leq 1.386016132827874 \cdot 10^{-44}:\\
\;\;\;\;x + \frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\end{array}(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z) :precision binary64 (if (<= x -1.0527729931731066e+145) (* x (/ (+ y z) z)) (if (<= x 1.386016132827874e-44) (+ x (/ (* x y) z)) (/ x (/ z (+ y z))))))
double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0527729931731066e+145) {
tmp = x * ((y + z) / z);
} else if (x <= 1.386016132827874e-44) {
tmp = x + ((x * y) / z);
} else {
tmp = x / (z / (y + z));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 1.8 |
if x < -1.05277299317310665e145Initial program 37.5
rmApplied *-un-lft-identity_binary64_1064937.5
Applied times-frac_binary64_106550.1
if -1.05277299317310665e145 < x < 1.386016132827874e-44Initial program 6.1
Taylor expanded around 0 2.7
if 1.386016132827874e-44 < x Initial program 19.5
rmApplied associate-/l*_binary64_105940.1
Simplified0.1
Final simplification1.8
herbie shell --seed 2021058
(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))