\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}\begin{array}{l}
\mathbf{if}\;z \leq -2.3321377759488846 \cdot 10^{+67}:\\
\;\;\;\;x \cdot \frac{y}{\frac{0.5 \cdot \frac{t}{\frac{z}{a}} - z}{z}}\\
\mathbf{elif}\;z \leq 7.8352056567318 \cdot 10^{-12}:\\
\;\;\;\;\frac{x}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{y}{\frac{\sqrt{\sqrt{z \cdot z - t \cdot a}}}{\sqrt[3]{z}}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{\frac{z - 0.5 \cdot \left(a \cdot \frac{t}{z}\right)}{z}}\\
\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.3321377759488846e+67)
(* x (/ y (/ (- (* 0.5 (/ t (/ z a))) z) z)))
(if (<= z 7.8352056567318e-12)
(*
(/ x (/ (sqrt (sqrt (- (* z z) (* t a)))) (* (cbrt z) (cbrt z))))
(/ y (/ (sqrt (sqrt (- (* z z) (* t a)))) (cbrt z))))
(* x (/ y (/ (- z (* 0.5 (* a (/ t z)))) z))))))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.3321377759488846e+67) {
tmp = x * (y / (((0.5 * (t / (z / a))) - z) / z));
} else if (z <= 7.8352056567318e-12) {
tmp = (x / (sqrt(sqrt((z * z) - (t * a))) / (cbrt(z) * cbrt(z)))) * (y / (sqrt(sqrt((z * z) - (t * a))) / cbrt(z)));
} else {
tmp = x * (y / ((z - (0.5 * (a * (t / z)))) / z));
}
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.7 |
|---|---|
| Target | 7.7 |
| Herbie | 6.5 |
if z < -2.3321377759488846e67Initial program 39.6
Simplified36.8
rmApplied *-un-lft-identity_binary64_1167236.8
Applied *-un-lft-identity_binary64_1167236.8
Applied times-frac_binary64_1167836.8
Applied times-frac_binary64_1167836.8
Simplified36.8
Taylor expanded around -inf 5.9
Simplified2.9
if -2.3321377759488846e67 < z < 7.8352056567317998e-12Initial program 12.4
Simplified11.5
rmApplied add-cube-cbrt_binary64_1170712.2
Applied add-sqr-sqrt_binary64_1169412.2
Applied times-frac_binary64_1167812.2
Applied times-frac_binary64_116789.5
if 7.8352056567317998e-12 < z Initial program 31.4
Simplified28.8
rmApplied *-un-lft-identity_binary64_1167228.8
Applied *-un-lft-identity_binary64_1167228.8
Applied times-frac_binary64_1167828.8
Applied times-frac_binary64_1167828.9
Simplified28.9
Taylor expanded around inf 7.1
Simplified4.8
Final simplification6.5
herbie shell --seed 2021176
(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)))))