x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
t_1 := x \cdot \frac{\frac{y}{z} \cdot t}{t}\\
\mathbf{if}\;t_1 \leq -1.6687413961929113 \cdot 10^{+307}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := x \cdot \frac{y}{z}\\
\mathbf{if}\;t_1 \leq -2.843252304093686 \cdot 10^{-283}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 4.210823815911059 \cdot 10^{-268}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;t_1 \leq 4.2617907411146433 \cdot 10^{+301}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{y}{\sqrt[3]{z}}\\
\end{array}\\
\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 (/ (* (/ y z) t) t))))
(if (<= t_1 -1.6687413961929113e+307)
(* (* x y) (/ 1.0 z))
(let* ((t_2 (* x (/ y z))))
(if (<= t_1 -2.843252304093686e-283)
t_2
(if (<= t_1 4.210823815911059e-268)
(/ (* x y) z)
(if (<= t_1 4.2617907411146433e+301)
t_2
(* (* x (/ 1.0 (* (cbrt z) (cbrt z)))) (/ y (cbrt z))))))))))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 * (((y / z) * t) / t);
double tmp;
if (t_1 <= -1.6687413961929113e+307) {
tmp = (x * y) * (1.0 / z);
} else {
double t_2 = x * (y / z);
double tmp_1;
if (t_1 <= -2.843252304093686e-283) {
tmp_1 = t_2;
} else if (t_1 <= 4.210823815911059e-268) {
tmp_1 = (x * y) / z;
} else if (t_1 <= 4.2617907411146433e+301) {
tmp_1 = t_2;
} else {
tmp_1 = (x * (1.0 / (cbrt(z) * cbrt(z)))) * (y / cbrt(z));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 14.7 |
|---|---|
| Target | 1.6 |
| Herbie | 1.7 |
if (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < -1.66874139619291129e307Initial program 63.9
Simplified27.3
Applied div-inv_binary6427.4
Applied associate-*r*_binary643.4
Simplified3.4
if -1.66874139619291129e307 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < -2.84325230409368613e-283 or 4.2108238159110592e-268 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < 4.2617907411146433e301Initial program 0.9
Simplified0.4
if -2.84325230409368613e-283 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) < 4.2108238159110592e-268Initial program 21.1
Simplified9.1
Taylor expanded in x around 0 2.4
if 4.2617907411146433e301 < (*.f64 x (/.f64 (*.f64 (/.f64 y z) t) t)) Initial program 62.6
Simplified28.2
Applied add-cube-cbrt_binary6428.8
Applied *-un-lft-identity_binary6428.8
Applied times-frac_binary6428.8
Applied associate-*r*_binary648.8
Final simplification1.7
herbie shell --seed 2021307
(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)))