x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
t_1 := \frac{x}{\frac{z}{y}}\\
\mathbf{if}\;\frac{y}{z} \leq -3.0717914688874457 \cdot 10^{+214}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;\frac{y}{z} \leq -5.886782599650217 \cdot 10^{-117}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\frac{y}{z} \leq 6.406396545967077 \cdot 10^{-145}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;\frac{y}{z} \leq 1.2888889004451218 \cdot 10^{+160}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\
\end{array}
(FPCore (x y z t) :precision binary64 (* x (/ (* (/ y z) t) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (/ z y))))
(if (<= (/ y z) -3.0717914688874457e+214)
(/ y (/ z x))
(if (<= (/ y z) -5.886782599650217e-117)
t_1
(if (<= (/ y z) 6.406396545967077e-145)
(/ (* y x) z)
(if (<= (/ y z) 1.2888889004451218e+160)
t_1
(/ 1.0 (/ z (* y x)))))))))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 t_1 = x / (z / y);
double tmp;
if ((y / z) <= -3.0717914688874457e+214) {
tmp = y / (z / x);
} else if ((y / z) <= -5.886782599650217e-117) {
tmp = t_1;
} else if ((y / z) <= 6.406396545967077e-145) {
tmp = (y * x) / z;
} else if ((y / z) <= 1.2888889004451218e+160) {
tmp = t_1;
} else {
tmp = 1.0 / (z / (y * x));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 14.8 |
|---|---|
| Target | 1.6 |
| Herbie | 1.0 |
if (/.f64 y z) < -3.0717914688874457e214Initial program 43.5
Simplified28.0
Applied egg-rr25.5
Applied egg-rr0.8
Applied egg-rr0.9
if -3.0717914688874457e214 < (/.f64 y z) < -5.8867825996502169e-117 or 6.40639654596707673e-145 < (/.f64 y z) < 1.2888889004451218e160Initial program 7.4
Simplified0.3
Applied egg-rr0.3
if -5.8867825996502169e-117 < (/.f64 y z) < 6.40639654596707673e-145Initial program 15.4
Simplified7.8
Taylor expanded in x around 0 1.6
if 1.2888889004451218e160 < (/.f64 y z) Initial program 36.2
Simplified20.4
Applied egg-rr2.7
Final simplification1.0
herbie shell --seed 2022130
(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)))