Average Error: 24.8 → 7.0
Time: 8.1s
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} 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} \]
(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}

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.8
Target7.9
Herbie7.0
\[\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 4 regimes
  2. if z < -1.6200000000000001e152

    1. Initial program 53.3

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Taylor expanded in z around -inf 1.3

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

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

    if -1.6200000000000001e152 < z < -9.9999999999999998e-201

    1. Initial program 9.8

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Applied egg-rr12.1

      \[\leadsto \color{blue}{\frac{1}{{\left(z \cdot z - t \cdot a\right)}^{0.25}} \cdot \frac{y \cdot \left(x \cdot z\right)}{{\left(z \cdot z - t \cdot a\right)}^{0.25}}} \]
    3. Applied egg-rr9.9

      \[\leadsto \color{blue}{\frac{y}{{\left(z \cdot z - t \cdot a\right)}^{0.25} \cdot \frac{{\left(z \cdot z - t \cdot a\right)}^{0.25}}{z \cdot x}}} \]
    4. Applied egg-rr6.3

      \[\leadsto \frac{y}{\color{blue}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{x}}} \]

    if -9.9999999999999998e-201 < z < 3.7e8

    1. Initial program 13.8

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{\sqrt{z \cdot z - t \cdot a}} \cdot z} \]

    if 3.7e8 < z

    1. Initial program 34.1

      \[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
    2. Taylor expanded in z around inf 4.7

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

    \[\leadsto \begin{array}{l} \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{\sqrt{z \cdot z - t \cdot a}}{z}}{x}}\\ \mathbf{elif}\;z \leq 370000000:\\ \;\;\;\;z \cdot \frac{y \cdot x}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]

Reproduce

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