\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -2.34303192057842814 \cdot 10^{-194}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + 1\right) - x\\
\mathbf{elif}\;x \le 2.4438339566529289 \cdot 10^{-143}:\\
\;\;\;\;\left(x \cdot \left(y + 1\right)\right) \cdot \frac{1}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + 1}} - x\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (((double) (y - z)) + 1.0)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if ((x <= -2.343031920578428e-194)) {
VAR = ((double) (((double) (((double) (x / z)) * ((double) (y + 1.0)))) - x));
} else {
double VAR_1;
if ((x <= 2.443833956652929e-143)) {
VAR_1 = ((double) (((double) (((double) (x * ((double) (y + 1.0)))) * ((double) (1.0 / z)))) - x));
} else {
VAR_1 = ((double) (((double) (x / ((double) (z / ((double) (y + 1.0)))))) - x));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.5 |
|---|---|
| Target | 0.5 |
| Herbie | 0.7 |
if x < -2.34303192057842814e-194Initial program 13.5
Simplified2.2
rmApplied clear-num2.2
rmApplied associate-/r/2.2
Applied associate-*r*0.7
Simplified0.6
if -2.34303192057842814e-194 < x < 2.4438339566529289e-143Initial program 0.2
Simplified7.8
rmApplied div-inv7.8
Applied associate-*r*0.2
if 2.4438339566529289e-143 < x Initial program 15.6
Simplified1.4
rmApplied clear-num1.4
rmApplied un-div-inv1.2
Final simplification0.7
herbie shell --seed 2020179
(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.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))