Average Error: 24.2 → 6.6
Time: 7.8s
Precision: binary64
\[ \begin{array}{c}[x, y] = \mathsf{sort}([x, y])\\ \end{array} \]
\[\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} \]
(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}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.2
Target7.6
Herbie6.6
\[\begin{array}{l} \mathbf{if}\;z < -3.1921305903852764 \cdot 10^{+46}:\\ \;\;\;\;-y \cdot x\\ \mathbf{elif}\;z < 5.976268120920894 \cdot 10^{+90}:\\ \;\;\;\;\frac{x \cdot z}{\frac{\sqrt{z \cdot z - a \cdot t}}{y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]

Derivation

  1. Split input into 3 regimes
  2. if z < -2.7002634376703844e64

    1. Initial program 38.4

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Simplified38.5

      \[\leadsto \color{blue}{x \cdot \frac{y \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Taylor expanded in z around -inf 3.0

      \[\leadsto x \cdot \color{blue}{\left(-1 \cdot y\right)} \]
    4. Simplified3.0

      \[\leadsto x \cdot \color{blue}{\left(-y\right)} \]

    if -2.7002634376703844e64 < z < 3.05149059242564875e53

    1. Initial program 10.8

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Simplified10.5

      \[\leadsto \color{blue}{x \cdot \frac{y \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Applied egg-rr9.7

      \[\leadsto x \cdot \color{blue}{\left(y \cdot \left(z \cdot {\left(z \cdot z - t \cdot a\right)}^{-0.5}\right)\right)} \]

    if 3.05149059242564875e53 < z

    1. Initial program 38.2

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Simplified38.4

      \[\leadsto \color{blue}{x \cdot \frac{y \cdot z}{\sqrt{z \cdot z - t \cdot a}}} \]
    3. Taylor expanded in z around inf 3.7

      \[\leadsto x \cdot \color{blue}{y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \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} \]

Reproduce

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)))))