Average Error: 24.8 → 5.9
Time: 8.2s
Precision: binary64
\[[x, y] = \mathsf{sort}([x, y]) \\]
\[\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} \]
(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}

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
Target8.0
Herbie5.9
\[\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 5 regimes
  2. if z < -1.0184175095225266e104

    1. Initial program 43.7

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

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

      \[\leadsto \color{blue}{-y \cdot x} \]

    if -1.0184175095225266e104 < z < -1.5207850390489686e-214

    1. Initial program 10.0

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

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

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

    if -1.5207850390489686e-214 < z < 1.87736820713377555e-206

    1. Initial program 18.2

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Applied egg-rr21.2

      \[\leadsto \color{blue}{\frac{y}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{x}}} \]
    4. Taylor expanded in x around 0 18.2

      \[\leadsto \frac{y}{\color{blue}{\sqrt{{z}^{2} - a \cdot t} \cdot \frac{1}{z \cdot x}}} \]
    5. Simplified15.3

      \[\leadsto \frac{y}{\color{blue}{\frac{\mathsf{hypot}\left(z, \sqrt{-a \cdot t}\right)}{z \cdot x}}} \]

    if 1.87736820713377555e-206 < z < 1.5575180468406501e143

    1. Initial program 9.7

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}{y}}} \]
    4. Applied egg-rr6.0

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

    if 1.5575180468406501e143 < z

    1. Initial program 50.2

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

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

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

Reproduce

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