x \cdot \frac{\frac{y}{z} \cdot t}{t}\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -4.8517075312100841 \cdot 10^{206}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;\frac{y}{z} \le -6.28974222975093373 \cdot 10^{-132}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;\frac{y}{z} \le 0.0:\\
\;\;\;\;\frac{-y}{\frac{-z}{x}}\\
\mathbf{elif}\;\frac{y}{z} \le 1.2588805863233109 \cdot 10^{162}:\\
\;\;\;\;\frac{x \cdot -1}{\frac{-z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-y}{\frac{-z}{x}}\\
\end{array}double code(double x, double y, double z, double t) {
return (x * (((y / z) * t) / t));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((y / z) <= -4.851707531210084e+206)) {
VAR = (y * (x / z));
} else {
double VAR_1;
if (((y / z) <= -6.289742229750934e-132)) {
VAR_1 = (x * (y / z));
} else {
double VAR_2;
if (((y / z) <= 0.0)) {
VAR_2 = (-y / (-z / x));
} else {
double VAR_3;
if (((y / z) <= 1.258880586323311e+162)) {
VAR_3 = ((x * -1.0) / (-z / y));
} else {
VAR_3 = (-y / (-z / x));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 14.8 |
|---|---|
| Target | 1.4 |
| Herbie | 0.8 |
if (/ y z) < -4.851707531210084e+206Initial program 41.0
Simplified26.7
rmApplied frac-2neg26.7
Applied associate-*r/1.2
rmApplied neg-mul-11.2
Applied *-commutative1.2
Applied times-frac1.0
Simplified1.0
if -4.851707531210084e+206 < (/ y z) < -6.289742229750934e-132Initial program 7.1
Simplified0.3
if -6.289742229750934e-132 < (/ y z) < 0.0 or 1.258880586323311e+162 < (/ y z) Initial program 21.8
Simplified13.2
rmApplied frac-2neg13.2
Applied associate-*r/1.5
rmApplied *-commutative1.5
Applied associate-/l*1.1
if 0.0 < (/ y z) < 1.258880586323311e+162Initial program 9.0
Simplified0.4
rmApplied frac-2neg0.4
Applied associate-*r/8.2
rmApplied neg-mul-18.2
Applied associate-*r*8.2
Applied associate-/l*0.8
Final simplification0.8
herbie shell --seed 2020071 +o rules:numerics
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
:precision binary64
:herbie-target
(if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))
(* x (/ (* (/ y z) t) t)))