\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \leq -3.9587781002086833 \cdot 10^{+152}:\\
\;\;\;\;-y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \frac{y \cdot x}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}\\
\mathbf{if}\;z \leq -1.6005527008883997 \cdot 10^{-83}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.0712262234135167 \cdot 10^{-132}:\\
\;\;\;\;\frac{x}{\mathsf{hypot}\left(\sqrt{-t} \cdot \sqrt{a}, z\right)} \cdot \left(z \cdot y\right)\\
\mathbf{elif}\;z \leq 3.2862688268057826 \cdot 10^{+148}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}\\
\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 -3.9587781002086833e+152)
(- (* y x))
(let* ((t_1 (/ (* y x) (/ (sqrt (- (* z z) (* t a))) z))))
(if (<= z -1.6005527008883997e-83)
t_1
(if (<= z 1.0712262234135167e-132)
(* (/ x (hypot (* (sqrt (- t)) (sqrt a)) z)) (* z y))
(if (<= z 3.2862688268057826e+148) t_1 (* y x)))))))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 <= -3.9587781002086833e+152) {
tmp = -(y * x);
} else {
double t_1 = (y * x) / (sqrt((z * z) - (t * a)) / z);
double tmp_1;
if (z <= -1.6005527008883997e-83) {
tmp_1 = t_1;
} else if (z <= 1.0712262234135167e-132) {
tmp_1 = (x / hypot((sqrt(-t) * sqrt(a)), z)) * (z * y);
} else if (z <= 3.2862688268057826e+148) {
tmp_1 = t_1;
} else {
tmp_1 = y * x;
}
tmp = tmp_1;
}
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.5 |
|---|---|
| Target | 7.8 |
| Herbie | 5.5 |
if z < -3.9587781002086833e152Initial program 53.5
Taylor expanded in z around -inf 1.4
Simplified1.4
if -3.9587781002086833e152 < z < -1.60055270088839973e-83 or 1.0712262234135167e-132 < z < 3.28626882680578261e148Initial program 8.1
Applied associate-/l*_binary644.6
if -1.60055270088839973e-83 < z < 1.0712262234135167e-132Initial program 15.3
Applied associate-/l*_binary6415.8
Simplified12.9
Applied distribute-rgt-neg-in_binary6412.9
Applied sqrt-prod_binary6413.3
Applied div-inv_binary6413.3
Applied times-frac_binary6412.4
Simplified12.4
Simplified12.4
if 3.28626882680578261e148 < z Initial program 52.4
Taylor expanded in z around inf 1.1
Final simplification5.5
herbie shell --seed 2022097
(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)))))