?

Average Error: 24.3 → 7.7
Time: 23.9s
Precision: binary64
Cost: 7496

?

\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}} \]
\[\begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+68}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-5}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\sqrt{z \cdot z - t \cdot a}}\\ \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
 (if (<= z -1.75e+68)
   (* y (- x))
   (if (<= z 8.2e-5) (/ (* x (* z y)) (sqrt (- (* z z) (* t a)))) (* 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 tmp;
	if (z <= -1.75e+68) {
		tmp = y * -x;
	} else if (z <= 8.2e-5) {
		tmp = (x * (z * y)) / sqrt(((z * z) - (t * a)));
	} 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) :: tmp
    if (z <= (-1.75d+68)) then
        tmp = y * -x
    else if (z <= 8.2d-5) then
        tmp = (x * (z * y)) / sqrt(((z * z) - (t * a)))
    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 tmp;
	if (z <= -1.75e+68) {
		tmp = y * -x;
	} else if (z <= 8.2e-5) {
		tmp = (x * (z * y)) / Math.sqrt(((z * z) - (t * a)));
	} 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):
	tmp = 0
	if z <= -1.75e+68:
		tmp = y * -x
	elif z <= 8.2e-5:
		tmp = (x * (z * y)) / math.sqrt(((z * z) - (t * a)))
	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)
	tmp = 0.0
	if (z <= -1.75e+68)
		tmp = Float64(y * Float64(-x));
	elseif (z <= 8.2e-5)
		tmp = Float64(Float64(x * Float64(z * y)) / sqrt(Float64(Float64(z * z) - Float64(t * a))));
	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)
	tmp = 0.0;
	if (z <= -1.75e+68)
		tmp = y * -x;
	elseif (z <= 8.2e-5)
		tmp = (x * (z * y)) / sqrt(((z * z) - (t * a)));
	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_] := If[LessEqual[z, -1.75e+68], N[(y * (-x)), $MachinePrecision], If[LessEqual[z, 8.2e-5], N[(N[(x * N[(z * y), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $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}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+68}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\sqrt{z \cdot z - t \cdot a}}\\

\mathbf{else}:\\
\;\;\;\;y \cdot x\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.3
Target7.5
Herbie7.7
\[\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 < -1.74999999999999989e68

    1. Initial program 39.0

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

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

      [Start]39.0

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

      rational_best.json-simplify-2 [=>]39.0

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

      rational_best.json-simplify-44 [=>]41.1

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

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

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

      [Start]3.0

      \[ -1 \cdot \left(y \cdot x\right) \]

      rational_best.json-simplify-44 [=>]3.0

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

      rational_best.json-simplify-2 [=>]3.0

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

      rational_best.json-simplify-12 [=>]3.0

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

    if -1.74999999999999989e68 < z < 8.20000000000000009e-5

    1. Initial program 11.8

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

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

      [Start]11.8

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

      rational_best.json-simplify-2 [=>]11.8

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

      rational_best.json-simplify-44 [=>]11.6

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

    if 8.20000000000000009e-5 < z

    1. Initial program 31.6

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

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

      [Start]31.6

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

      rational_best.json-simplify-2 [=>]31.6

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

      rational_best.json-simplify-44 [=>]33.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+68}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-5}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\sqrt{z \cdot z - t \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]

Alternatives

Alternative 1
Error12.4
Cost7632
\[\begin{array}{l} \mathbf{if}\;z \leq -1.35 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 6.7 \cdot 10^{-137}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\sqrt{t \cdot \left(-a\right)}}\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{-43}:\\ \;\;\;\;\frac{\left(x \cdot y\right) \cdot z}{z + -0.5 \cdot \frac{a \cdot t}{z}}\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-9}:\\ \;\;\;\;z \cdot \left(\sqrt{\frac{-1}{a \cdot t}} \cdot \left(y \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 2
Error12.4
Cost7568
\[\begin{array}{l} t_1 := \frac{x \cdot \left(z \cdot y\right)}{\sqrt{t \cdot \left(-a\right)}}\\ \mathbf{if}\;z \leq -2 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.95 \cdot 10^{-43}:\\ \;\;\;\;\frac{\left(x \cdot y\right) \cdot z}{z + -0.5 \cdot \frac{a \cdot t}{z}}\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-9}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 3
Error16.1
Cost1288
\[\begin{array}{l} \mathbf{if}\;z \leq -1.42 \cdot 10^{+66}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-197}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{\left(-z\right) + 0.5 \cdot \frac{a \cdot t}{z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 4
Error16.0
Cost1224
\[\begin{array}{l} \mathbf{if}\;z \leq -1.95 \cdot 10^{-163}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{-7}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{z + -0.5 \cdot \frac{a \cdot t}{z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 5
Error16.1
Cost1224
\[\begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{-165}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-6}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{z + -0.5 \cdot \frac{a \cdot t}{z}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 6
Error16.2
Cost1224
\[\begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+66}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-198}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{0.5 \cdot \frac{a \cdot t}{z} - z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 7
Error16.0
Cost1224
\[\begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+66}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-199}:\\ \;\;\;\;\frac{z \cdot \left(y \cdot x\right)}{0.5 \cdot \frac{a \cdot t}{z} - z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 8
Error17.0
Cost776
\[\begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{-90}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-199}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{-z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 9
Error17.2
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{-166}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5.6 \cdot 10^{-162}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 10
Error17.3
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -5.7 \cdot 10^{-164}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-197}:\\ \;\;\;\;\frac{y \cdot \left(z \cdot x\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 11
Error19.0
Cost388
\[\begin{array}{l} \mathbf{if}\;z \leq -2.85 \cdot 10^{-304}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 12
Error36.2
Cost192
\[y \cdot x \]

Error

Reproduce?

herbie shell --seed 2023090 
(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)))))