\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -3.7618411608635746 \cdot 10^{88}:\\
\;\;\;\;\frac{x}{\frac{z}{\left(y - z\right) + 1}}\\
\mathbf{elif}\;x \le 7.8501220882830768 \cdot 10^{-164}:\\
\;\;\;\;\left(\frac{x \cdot y}{z} + 1 \cdot \frac{x}{z}\right) - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(1 + y\right) - x\\
\end{array}double code(double x, double y, double z) {
return ((x * ((y - z) + 1.0)) / z);
}
double code(double x, double y, double z) {
double temp;
if ((x <= -3.7618411608635746e+88)) {
temp = (x / (z / ((y - z) + 1.0)));
} else {
double temp_1;
if ((x <= 7.850122088283077e-164)) {
temp_1 = ((((x * y) / z) + (1.0 * (x / z))) - x);
} else {
temp_1 = (((x / z) * (1.0 + y)) - x);
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 9.9 |
|---|---|
| Target | 0.6 |
| Herbie | 0.4 |
if x < -3.7618411608635746e+88Initial program 35.3
rmApplied associate-/l*0.1
if -3.7618411608635746e+88 < x < 7.850122088283077e-164Initial program 1.3
Taylor expanded around 0 0.5
if 7.850122088283077e-164 < x Initial program 13.5
Taylor expanded around 0 4.5
Taylor expanded around 0 4.5
Simplified0.5
Final simplification0.4
herbie shell --seed 2020053
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(if (< x -2.71483106713436e-162) (- (* (+ 1 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1)) z))