\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\begin{array}{l}
\mathbf{if}\;z \leq -2.9064435797870745 \cdot 10^{+82}:\\
\;\;\;\;-x \cdot y\\
\mathbf{elif}\;z \leq -8.759496516960208 \cdot 10^{-250}:\\
\;\;\;\;\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\
\mathbf{elif}\;z \leq 1.2732782527458712 \cdot 10^{+42}:\\
\;\;\;\;\frac{x}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot y\right)\\
\mathbf{elif}\;z \leq 3.819796553361413 \cdot 10^{+121}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.9064435797870745e+82)
(- (* x y))
(if (<= z -8.759496516960208e-250)
(/ (* x y) (/ (sqrt (- (* z z) (* t a))) z))
(if (<= z 1.2732782527458712e+42)
(* (/ x (sqrt (- (* z z) (* t a)))) (* z y))
(if (<= z 3.819796553361413e+121)
(* (* x y) (/ z (sqrt (- (* z z) (* t a)))))
(* x y))))))double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt((z * z) - (t * a));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.9064435797870745e+82) {
tmp = -(x * y);
} else if (z <= -8.759496516960208e-250) {
tmp = (x * y) / (sqrt((z * z) - (t * a)) / z);
} else if (z <= 1.2732782527458712e+42) {
tmp = (x / sqrt((z * z) - (t * a))) * (z * y);
} else if (z <= 3.819796553361413e+121) {
tmp = (x * y) * (z / sqrt((z * z) - (t * a)));
} else {
tmp = x * y;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 24.2 |
|---|---|
| Target | 7.9 |
| Herbie | 6.8 |
if z < -2.90644357978707446e82Initial program 40.7
Taylor expanded around -inf 3.1
Simplified3.1
if -2.90644357978707446e82 < z < -8.7594965169602077e-250Initial program 9.6
rmApplied associate-/l*_binary648.1
if -8.7594965169602077e-250 < z < 1.2732782527458712e42Initial program 12.1
rmApplied associate-/l*_binary6411.8
rmApplied div-inv_binary6411.9
Applied times-frac_binary6413.3
Simplified13.2
if 1.2732782527458712e42 < z < 3.81979655336141291e121Initial program 8.0
rmApplied *-un-lft-identity_binary648.0
Applied sqrt-prod_binary648.0
Applied times-frac_binary643.5
Simplified3.5
if 3.81979655336141291e121 < z Initial program 46.6
Taylor expanded around inf 1.5
Final simplification6.8
herbie shell --seed 2020273
(FPCore (x y z t a)
:name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z -3.1921305903852764e+46) (- (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))