(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 (sqrt (- (* z z) (* t a)))))
(if (<= z -1.0184175095225266e+104)
(- (* y x))
(if (<= z -1.5207850390489686e-214)
(/ (* y x) (/ t_1 z))
(if (<= z 1.8773682071337756e-206)
(/ y (/ (hypot z (sqrt (- (* t a)))) (* z x)))
(if (<= z 1.55751804684065e+143) (* x (* y (/ 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 t_1 = sqrt(((z * z) - (t * a)));
double tmp;
if (z <= -1.0184175095225266e+104) {
tmp = -(y * x);
} else if (z <= -1.5207850390489686e-214) {
tmp = (y * x) / (t_1 / z);
} else if (z <= 1.8773682071337756e-206) {
tmp = y / (hypot(z, sqrt(-(t * a))) / (z * x));
} else if (z <= 1.55751804684065e+143) {
tmp = x * (y * (z / t_1));
} else {
tmp = y * x;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = Math.sqrt(((z * z) - (t * a)));
double tmp;
if (z <= -1.0184175095225266e+104) {
tmp = -(y * x);
} else if (z <= -1.5207850390489686e-214) {
tmp = (y * x) / (t_1 / z);
} else if (z <= 1.8773682071337756e-206) {
tmp = y / (Math.hypot(z, Math.sqrt(-(t * a))) / (z * x));
} else if (z <= 1.55751804684065e+143) {
tmp = x * (y * (z / t_1));
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a): return ((x * y) * z) / math.sqrt(((z * z) - (t * a)))
def code(x, y, z, t, a): t_1 = math.sqrt(((z * z) - (t * a))) tmp = 0 if z <= -1.0184175095225266e+104: tmp = -(y * x) elif z <= -1.5207850390489686e-214: tmp = (y * x) / (t_1 / z) elif z <= 1.8773682071337756e-206: tmp = y / (math.hypot(z, math.sqrt(-(t * a))) / (z * x)) elif z <= 1.55751804684065e+143: tmp = x * (y * (z / t_1)) else: tmp = y * x 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 = sqrt(Float64(Float64(z * z) - Float64(t * a))) tmp = 0.0 if (z <= -1.0184175095225266e+104) tmp = Float64(-Float64(y * x)); elseif (z <= -1.5207850390489686e-214) tmp = Float64(Float64(y * x) / Float64(t_1 / z)); elseif (z <= 1.8773682071337756e-206) tmp = Float64(y / Float64(hypot(z, sqrt(Float64(-Float64(t * a)))) / Float64(z * x))); elseif (z <= 1.55751804684065e+143) tmp = Float64(x * Float64(y * Float64(z / t_1))); else tmp = Float64(y * x); end return tmp end
function tmp = code(x, y, z, t, a) tmp = ((x * y) * z) / sqrt(((z * z) - (t * a))); end
function tmp_2 = code(x, y, z, t, a) t_1 = sqrt(((z * z) - (t * a))); tmp = 0.0; if (z <= -1.0184175095225266e+104) tmp = -(y * x); elseif (z <= -1.5207850390489686e-214) tmp = (y * x) / (t_1 / z); elseif (z <= 1.8773682071337756e-206) tmp = y / (hypot(z, sqrt(-(t * a))) / (z * x)); elseif (z <= 1.55751804684065e+143) tmp = x * (y * (z / t_1)); else tmp = y * x; end tmp_2 = 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[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -1.0184175095225266e+104], (-N[(y * x), $MachinePrecision]), If[LessEqual[z, -1.5207850390489686e-214], N[(N[(y * x), $MachinePrecision] / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8773682071337756e-206], N[(y / N[(N[Sqrt[z ^ 2 + N[Sqrt[(-N[(t * a), $MachinePrecision])], $MachinePrecision] ^ 2], $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55751804684065e+143], N[(x * N[(y * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
t_1 := \sqrt{z \cdot z - t \cdot a}\\
\mathbf{if}\;z \leq -1.0184175095225266 \cdot 10^{+104}:\\
\;\;\;\;-y \cdot x\\
\mathbf{elif}\;z \leq -1.5207850390489686 \cdot 10^{-214}:\\
\;\;\;\;\frac{y \cdot x}{\frac{t_1}{z}}\\
\mathbf{elif}\;z \leq 1.8773682071337756 \cdot 10^{-206}:\\
\;\;\;\;\frac{y}{\frac{\mathsf{hypot}\left(z, \sqrt{-t \cdot a}\right)}{z \cdot x}}\\
\mathbf{elif}\;z \leq 1.55751804684065 \cdot 10^{+143}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{z}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 24.8 |
|---|---|
| Target | 8.0 |
| Herbie | 5.9 |
if z < -1.0184175095225266e104Initial program 43.7
Taylor expanded in z around -inf 2.5
Simplified2.5
if -1.0184175095225266e104 < z < -1.5207850390489686e-214Initial program 10.0
Applied egg-rr7.4
Applied egg-rr7.4
if -1.5207850390489686e-214 < z < 1.87736820713377555e-206Initial program 18.2
Applied egg-rr20.0
Applied egg-rr21.2
Taylor expanded in x around 0 18.2
Simplified15.3
if 1.87736820713377555e-206 < z < 1.5575180468406501e143Initial program 9.7
Applied egg-rr6.1
Applied egg-rr6.4
Applied egg-rr6.0
if 1.5575180468406501e143 < z Initial program 50.2
Taylor expanded in z around inf 1.4
Final simplification5.9
herbie shell --seed 2022133
(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)))))