(FPCore (x y z t a) :precision binary64 (/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (* z (/ z t)))))
(if (<= z -4.2219193410772696e+73)
(/ (* y x) (fma 0.5 t_1 -1.0))
(if (<= z 4.861570841540991e-16)
(/ (* z (* y x)) (sqrt (fma z z (* a (- t)))))
(/ (* y x) (fma t_1 -0.5 1.0))))))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 t_1 = a / (z * (z / t));
double tmp;
if (z <= -4.2219193410772696e+73) {
tmp = (y * x) / fma(0.5, t_1, -1.0);
} else if (z <= 4.861570841540991e-16) {
tmp = (z * (y * x)) / sqrt(fma(z, z, (a * -t)));
} else {
tmp = (y * x) / fma(t_1, -0.5, 1.0);
}
return tmp;
}
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a)))) end
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z * Float64(z / t))) tmp = 0.0 if (z <= -4.2219193410772696e+73) tmp = Float64(Float64(y * x) / fma(0.5, t_1, -1.0)); elseif (z <= 4.861570841540991e-16) tmp = Float64(Float64(z * Float64(y * x)) / sqrt(fma(z, z, Float64(a * Float64(-t))))); else tmp = Float64(Float64(y * x) / fma(t_1, -0.5, 1.0)); end return tmp end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2219193410772696e+73], N[(N[(y * x), $MachinePrecision] / N[(0.5 * t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.861570841540991e-16], N[(N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(z * z + N[(a * (-t)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / N[(t$95$1 * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
t_1 := \frac{a}{z \cdot \frac{z}{t}}\\
\mathbf{if}\;z \leq -4.2219193410772696 \cdot 10^{+73}:\\
\;\;\;\;\frac{y \cdot x}{\mathsf{fma}\left(0.5, t_1, -1\right)}\\
\mathbf{elif}\;z \leq 4.861570841540991 \cdot 10^{-16}:\\
\;\;\;\;\frac{z \cdot \left(y \cdot x\right)}{\sqrt{\mathsf{fma}\left(z, z, a \cdot \left(-t\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{\mathsf{fma}\left(t_1, -0.5, 1\right)}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 25.1 |
|---|---|
| Target | 7.7 |
| Herbie | 7.7 |
if z < -4.22191934107726956e73Initial program 39.7
Simplified39.5
Applied egg-rr37.0
Taylor expanded in z around -inf 6.3
Simplified2.6
if -4.22191934107726956e73 < z < 4.8615708415409906e-16Initial program 12.0
Applied egg-rr12.0
if 4.8615708415409906e-16 < z Initial program 32.6
Simplified32.4
Applied egg-rr29.6
Taylor expanded in z around inf 8.5
Simplified5.5
Final simplification7.7
herbie shell --seed 2022153
(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)))))