\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\begin{array}{l}
\mathbf{if}\;z \le -1.9935355709756488 \cdot 10^{25} \lor \neg \left(z \le 5.10680315044327009 \cdot 10^{-17}\right):\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{\left(y - z\right) + 1}}\\
\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 VAR;
if (((z <= -1.9935355709756488e+25) || !(z <= 5.10680315044327e-17))) {
VAR = (x * (((y - z) + 1.0) / z));
} else {
VAR = ((x / z) / (1.0 / ((y - z) + 1.0)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.6 |
|---|---|
| Target | 0.4 |
| Herbie | 0.1 |
if z < -1.9935355709756488e+25 or 5.10680315044327e-17 < z Initial program 17.7
rmApplied *-un-lft-identity17.7
Applied times-frac0.1
Simplified0.1
if -1.9935355709756488e+25 < z < 5.10680315044327e-17Initial program 0.3
rmApplied associate-/l*8.1
rmApplied div-inv8.1
Applied associate-/r*0.2
Final simplification0.1
herbie shell --seed 2020075
(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))