\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\begin{array}{l}
\mathbf{if}\;x \le -4.5795719880723017 \cdot 10^{83}:\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\mathbf{elif}\;x \le 7.9790518556511268 \cdot 10^{-115}:\\
\;\;\;\;\left(\frac{x \cdot y}{z} + 1 \cdot \frac{x}{z}\right) - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(\left(y - z\right) + 1\right)\\
\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 ((x <= -4.579571988072302e+83)) {
VAR = (x * (((y - z) + 1.0) / z));
} else {
double VAR_1;
if ((x <= 7.979051855651127e-115)) {
VAR_1 = ((((x * y) / z) + (1.0 * (x / z))) - x);
} else {
VAR_1 = ((x / z) * ((y - z) + 1.0));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.1 |
|---|---|
| Target | 0.5 |
| Herbie | 0.7 |
if x < -4.579571988072302e+83Initial program 38.6
rmApplied *-un-lft-identity38.6
Applied times-frac0.1
Simplified0.1
if -4.579571988072302e+83 < x < 7.979051855651127e-115Initial program 1.1
Taylor expanded around 0 0.4
if 7.979051855651127e-115 < x Initial program 15.4
rmApplied associate-/l*1.3
rmApplied associate-/r/1.6
Final simplification0.7
herbie shell --seed 2020091
(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))