(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.62e+152)
(* y (- x))
(if (<= z -1e-200)
(/ y (/ (/ t_1 z) x))
(if (<= z 370000000.0) (* z (/ (* y x) 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.62e+152) {
tmp = y * -x;
} else if (z <= -1e-200) {
tmp = y / ((t_1 / z) / x);
} else if (z <= 370000000.0) {
tmp = z * ((y * x) / t_1);
} else {
tmp = y * x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) * z) / sqrt(((z * z) - (t * a)))
end function
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt(((z * z) - (t * a)))
if (z <= (-1.62d+152)) then
tmp = y * -x
else if (z <= (-1d-200)) then
tmp = y / ((t_1 / z) / x)
else if (z <= 370000000.0d0) then
tmp = z * ((y * x) / t_1)
else
tmp = y * x
end if
code = tmp
end function
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.62e+152) {
tmp = y * -x;
} else if (z <= -1e-200) {
tmp = y / ((t_1 / z) / x);
} else if (z <= 370000000.0) {
tmp = z * ((y * x) / 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.62e+152: tmp = y * -x elif z <= -1e-200: tmp = y / ((t_1 / z) / x) elif z <= 370000000.0: tmp = z * ((y * x) / 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.62e+152) tmp = Float64(y * Float64(-x)); elseif (z <= -1e-200) tmp = Float64(y / Float64(Float64(t_1 / z) / x)); elseif (z <= 370000000.0) tmp = Float64(z * Float64(Float64(y * x) / 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.62e+152) tmp = y * -x; elseif (z <= -1e-200) tmp = y / ((t_1 / z) / x); elseif (z <= 370000000.0) tmp = z * ((y * x) / 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.62e+152], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, -1e-200], N[(y / N[(N[(t$95$1 / z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 370000000.0], N[(z * N[(N[(y * x), $MachinePrecision] / t$95$1), $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.62 \cdot 10^{+152}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-200}:\\
\;\;\;\;\frac{y}{\frac{\frac{t_1}{z}}{x}}\\
\mathbf{elif}\;z \leq 370000000:\\
\;\;\;\;z \cdot \frac{y \cdot x}{t_1}\\
\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 | 7.9 |
| Herbie | 7.0 |
if z < -1.6200000000000001e152Initial program 53.3
Taylor expanded in z around -inf 1.3
Simplified1.3
if -1.6200000000000001e152 < z < -9.9999999999999998e-201Initial program 9.8
Applied egg-rr12.1
Applied egg-rr9.9
Applied egg-rr6.3
if -9.9999999999999998e-201 < z < 3.7e8Initial program 13.8
Applied egg-rr13.5
if 3.7e8 < z Initial program 34.1
Taylor expanded in z around inf 4.7
Final simplification7.0
herbie shell --seed 2022172
(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)))))