(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.7002634376703844e+64)
(* x (- y))
(if (<= z 3.0514905924256488e+53)
(* x (* y (* z (pow (- (* z z) (* t a)) -0.5))))
(* x y))))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.7002634376703844e+64) {
tmp = x * -y;
} else if (z <= 3.0514905924256488e+53) {
tmp = x * (y * (z * pow(((z * z) - (t * a)), -0.5)));
} else {
tmp = x * y;
}
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) :: tmp
if (z <= (-2.7002634376703844d+64)) then
tmp = x * -y
else if (z <= 3.0514905924256488d+53) then
tmp = x * (y * (z * (((z * z) - (t * a)) ** (-0.5d0))))
else
tmp = x * y
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 tmp;
if (z <= -2.7002634376703844e+64) {
tmp = x * -y;
} else if (z <= 3.0514905924256488e+53) {
tmp = x * (y * (z * Math.pow(((z * z) - (t * a)), -0.5)));
} else {
tmp = x * y;
}
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): tmp = 0 if z <= -2.7002634376703844e+64: tmp = x * -y elif z <= 3.0514905924256488e+53: tmp = x * (y * (z * math.pow(((z * z) - (t * a)), -0.5))) else: tmp = x * y 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) tmp = 0.0 if (z <= -2.7002634376703844e+64) tmp = Float64(x * Float64(-y)); elseif (z <= 3.0514905924256488e+53) tmp = Float64(x * Float64(y * Float64(z * (Float64(Float64(z * z) - Float64(t * a)) ^ -0.5)))); else tmp = Float64(x * y); 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) tmp = 0.0; if (z <= -2.7002634376703844e+64) tmp = x * -y; elseif (z <= 3.0514905924256488e+53) tmp = x * (y * (z * (((z * z) - (t * a)) ^ -0.5))); else tmp = x * y; 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_] := If[LessEqual[z, -2.7002634376703844e+64], N[(x * (-y)), $MachinePrecision], If[LessEqual[z, 3.0514905924256488e+53], N[(x * N[(y * N[(z * N[Power[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
\mathbf{if}\;z \leq -2.7002634376703844 \cdot 10^{+64}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{elif}\;z \leq 3.0514905924256488 \cdot 10^{+53}:\\
\;\;\;\;x \cdot \left(y \cdot \left(z \cdot {\left(z \cdot z - t \cdot a\right)}^{-0.5}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\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.2 |
|---|---|
| Target | 7.6 |
| Herbie | 6.6 |
if z < -2.7002634376703844e64Initial program 38.4
Simplified38.5
Taylor expanded in z around -inf 3.0
Simplified3.0
if -2.7002634376703844e64 < z < 3.05149059242564875e53Initial program 10.8
Simplified10.5
Applied egg-rr9.7
if 3.05149059242564875e53 < z Initial program 38.2
Simplified38.4
Taylor expanded in z around inf 3.7
Final simplification6.6
herbie shell --seed 2022150
(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)))))