?

Average Accuracy: 61.0% → 88.8%
Time: 30.6s
Precision: binary64
Cost: 7496

?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{\sqrt{1 - t \cdot \frac{a}{z \cdot z}}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.0%
Target88.2%
Herbie88.8%
\[\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 < -6.4000000000000004

    1. Initial program 47.8%

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

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

      [Start]47.8

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

      associate-*r/ [<=]52.1

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

      associate-*l* [=>]52.0

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

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
    4. Simplified91.7%

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

      [Start]91.7

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

      associate-*r* [=>]91.7

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

      mul-1-neg [=>]91.7

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

    if -6.4000000000000004 < z < 5.49999999999999964e-16

    1. Initial program 80.4%

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

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

      [Start]80.4

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

      *-commutative [=>]80.4

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

      associate-*l* [=>]79.3

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

      associate-*l/ [<=]79.3

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

      *-commutative [=>]79.3

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

    if 5.49999999999999964e-16 < z

    1. Initial program 49.4%

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

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

      [Start]49.4

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

      associate-/l* [=>]53.8

      \[ \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}} \]
    3. Applied egg-rr45.8%

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

      [Start]53.8

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

      add-sqr-sqrt [=>]53.8

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

      sqrt-unprod [=>]53.8

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

      frac-times [=>]45.8

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

      add-sqr-sqrt [<=]45.8

      \[ \frac{x \cdot y}{\sqrt{\frac{\color{blue}{z \cdot z - t \cdot a}}{z \cdot z}}} \]
    4. Simplified97.9%

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

      [Start]45.8

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

      *-commutative [=>]45.8

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

      div-sub [=>]45.8

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

      unpow2 [<=]45.8

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

      unpow2 [<=]45.8

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

      *-inverses [=>]92.3

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

      unpow2 [<=]92.3

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

      associate-/l* [=>]97.9

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

      associate-/r/ [=>]97.9

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

      unpow2 [=>]97.9

      \[ \frac{x \cdot y}{\sqrt{1 - \frac{a}{\color{blue}{z \cdot z}} \cdot t}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.4:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-16}:\\ \;\;\;\;\frac{y}{\sqrt{z \cdot z - t \cdot a}} \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{\sqrt{1 - t \cdot \frac{a}{z \cdot z}}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy90.9%
Cost7496
\[\begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+153}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 2 \cdot 10^{+108}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + -0.5 \cdot \frac{a}{\frac{z}{t}}}\right)\\ \end{array} \]
Alternative 2
Accuracy88.5%
Cost7496
\[\begin{array}{l} \mathbf{if}\;z \leq -7:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{+107}:\\ \;\;\;\;\frac{x}{\frac{\sqrt{z \cdot z - t \cdot a}}{z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + -0.5 \cdot \frac{a}{\frac{z}{t}}}\right)\\ \end{array} \]
Alternative 3
Accuracy81.6%
Cost7304
\[\begin{array}{l} \mathbf{if}\;z \leq -4.7 \cdot 10^{-132}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-134}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{\sqrt{t \cdot \left(-a\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + -0.5 \cdot \frac{a}{\frac{z}{t}}}\right)\\ \end{array} \]
Alternative 4
Accuracy81.9%
Cost7304
\[\begin{array}{l} \mathbf{if}\;z \leq -1.36 \cdot 10^{-130}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-124}:\\ \;\;\;\;\frac{y}{\sqrt{t \cdot \left(-a\right)}} \cdot \left(z \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + -0.5 \cdot \frac{a}{\frac{z}{t}}}\right)\\ \end{array} \]
Alternative 5
Accuracy73.5%
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{-234}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-147}:\\ \;\;\;\;-2 \cdot \left(\frac{y}{\frac{\frac{t}{z}}{z}} \cdot \frac{x}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 6
Accuracy74.0%
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -1.05 \cdot 10^{-214}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-141}:\\ \;\;\;\;2 \cdot \left(y \cdot \left(\frac{z}{t} \cdot \frac{z \cdot x}{a}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 7
Accuracy74.0%
Cost1096
\[\begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{-213}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-149}:\\ \;\;\;\;2 \cdot \frac{y \cdot \left(z \cdot x\right)}{\frac{a}{\frac{z}{t}}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 8
Accuracy76.1%
Cost1092
\[\begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{-213}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + -0.5 \cdot \frac{a}{\frac{z}{t}}}\right)\\ \end{array} \]
Alternative 9
Accuracy77.4%
Cost1092
\[\begin{array}{l} \mathbf{if}\;z \leq 5 \cdot 10^{-271}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{0.5 \cdot \frac{t \cdot a}{z} - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot \frac{z}{z + -0.5 \cdot \frac{a}{\frac{z}{t}}}\right)\\ \end{array} \]
Alternative 10
Accuracy71.4%
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{-269}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{-242}:\\ \;\;\;\;\frac{x}{\frac{z}{z \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 11
Accuracy72.7%
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{-269}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-162}:\\ \;\;\;\;\frac{x \cdot \left(z \cdot y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 12
Accuracy70.4%
Cost388
\[\begin{array}{l} \mathbf{if}\;z \leq 9.5 \cdot 10^{-305}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot x\\ \end{array} \]
Alternative 13
Accuracy43.1%
Cost192
\[y \cdot x \]

Error

Reproduce?

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