\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \leq -1.0422014424664703 \cdot 10^{+91}:\\
\;\;\;\;-y \cdot x\\
\mathbf{elif}\;z \leq 4.967878028669063 \cdot 10^{+25}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{\sqrt{z \cdot z - t \cdot a}}\\
\frac{y \cdot x}{t_1} \cdot \frac{z}{t_1}
\end{array}\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\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 -1.0422014424664703e+91)
(- (* y x))
(if (<= z 4.967878028669063e+25)
(let* ((t_1 (sqrt (sqrt (- (* z z) (* t a))))))
(* (/ (* y x) t_1) (/ z 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 <= -1.0422014424664703e+91) {
tmp = -(y * x);
} else if (z <= 4.967878028669063e+25) {
double t_1 = sqrt(sqrt((z * z) - (t * a)));
tmp = ((y * x) / t_1) * (z / t_1);
} else {
tmp = y * x;
}
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.9 |
|---|---|
| Target | 7.7 |
| Herbie | 7.0 |
if z < -1.0422014424664703e91Initial program 43.0
Taylor expanded in z around -inf 2.5
Simplified2.5
if -1.0422014424664703e91 < z < 4.96787802866906328e25Initial program 11.0
Applied add-sqr-sqrt_binary6411.2
Applied times-frac_binary6410.7
if 4.96787802866906328e25 < z Initial program 35.6
Taylor expanded in z around inf 4.1
Final simplification7.0
herbie shell --seed 2021275
(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)))))