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




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 10.2 |
|---|---|
| Target | 0.5 |
| Herbie | 0.1 |
if z < -1.6211922145077054e-12Initial program 16.5
rmApplied *-un-lft-identity_binary6416.5
Applied times-frac_binary640.1
Simplified0.1
if -1.6211922145077054e-12 < z < 1107741618477.668Initial program 0.1
rmApplied associate-/l*_binary648.4
rmApplied associate-/r/_binary640.1
if 1107741618477.668 < z Initial program 17.5
rmApplied associate-/l*_binary640.1
Final simplification0.1
herbie shell --seed 2020219
(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))