?

Average Accuracy: 89.0% → 97.7%
Time: 10.7s
Precision: binary64
Cost: 1608

?

\[ \begin{array}{c}[y, t] = \mathsf{sort}([y, t])\\ \end{array} \]
\[\left(x \cdot y - z \cdot y\right) \cdot t \]
\[\begin{array}{l} t_1 := x \cdot y - y \cdot z\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{+285}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+224}:\\ \;\;\;\;t_1 \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot t}{\frac{1}{x - z}}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* x y) (* y z))))
   (if (<= t_1 -1e+285)
     (* y (* (- x z) t))
     (if (<= t_1 2e+224) (* t_1 t) (/ (* y t) (/ 1.0 (- x z)))))))
double code(double x, double y, double z, double t) {
	return ((x * y) - (z * y)) * t;
}
double code(double x, double y, double z, double t) {
	double t_1 = (x * y) - (y * z);
	double tmp;
	if (t_1 <= -1e+285) {
		tmp = y * ((x - z) * t);
	} else if (t_1 <= 2e+224) {
		tmp = t_1 * t;
	} else {
		tmp = (y * t) / (1.0 / (x - z));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = ((x * y) - (z * y)) * t
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (x * y) - (y * z)
    if (t_1 <= (-1d+285)) then
        tmp = y * ((x - z) * t)
    else if (t_1 <= 2d+224) then
        tmp = t_1 * t
    else
        tmp = (y * t) / (1.0d0 / (x - z))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	return ((x * y) - (z * y)) * t;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (x * y) - (y * z);
	double tmp;
	if (t_1 <= -1e+285) {
		tmp = y * ((x - z) * t);
	} else if (t_1 <= 2e+224) {
		tmp = t_1 * t;
	} else {
		tmp = (y * t) / (1.0 / (x - z));
	}
	return tmp;
}
def code(x, y, z, t):
	return ((x * y) - (z * y)) * t
def code(x, y, z, t):
	t_1 = (x * y) - (y * z)
	tmp = 0
	if t_1 <= -1e+285:
		tmp = y * ((x - z) * t)
	elif t_1 <= 2e+224:
		tmp = t_1 * t
	else:
		tmp = (y * t) / (1.0 / (x - z))
	return tmp
function code(x, y, z, t)
	return Float64(Float64(Float64(x * y) - Float64(z * y)) * t)
end
function code(x, y, z, t)
	t_1 = Float64(Float64(x * y) - Float64(y * z))
	tmp = 0.0
	if (t_1 <= -1e+285)
		tmp = Float64(y * Float64(Float64(x - z) * t));
	elseif (t_1 <= 2e+224)
		tmp = Float64(t_1 * t);
	else
		tmp = Float64(Float64(y * t) / Float64(1.0 / Float64(x - z)));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = ((x * y) - (z * y)) * t;
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x * y) - (y * z);
	tmp = 0.0;
	if (t_1 <= -1e+285)
		tmp = y * ((x - z) * t);
	elseif (t_1 <= 2e+224)
		tmp = t_1 * t;
	else
		tmp = (y * t) / (1.0 / (x - z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+285], N[(y * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+224], N[(t$95$1 * t), $MachinePrecision], N[(N[(y * t), $MachinePrecision] / N[(1.0 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
t_1 := x \cdot y - y \cdot z\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+285}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+224}:\\
\;\;\;\;t_1 \cdot t\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original89.0%
Target94.5%
Herbie97.7%
\[\begin{array}{l} \mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t < 2.543067051564877 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array} \]

Derivation?

  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z y)) < -9.9999999999999998e284

    1. Initial program 18.5%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified99.6%

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

      [Start]18.5

      \[ \left(x \cdot y - z \cdot y\right) \cdot t \]

      distribute-rgt-out-- [=>]18.5

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

      associate-*l* [=>]99.6

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

    if -9.9999999999999998e284 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1.99999999999999994e224

    1. Initial program 97.6%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]

    if 1.99999999999999994e224 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 45.7%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified45.7%

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

      [Start]45.7

      \[ \left(x \cdot y - z \cdot y\right) \cdot t \]

      distribute-rgt-out-- [=>]45.7

      \[ \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
    3. Applied egg-rr44.9%

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

      [Start]45.7

      \[ \left(y \cdot \left(x - z\right)\right) \cdot t \]

      add-cube-cbrt [=>]44.9

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

      pow3 [=>]44.9

      \[ \color{blue}{{\left(\sqrt[3]{y \cdot \left(x - z\right)}\right)}^{3}} \cdot t \]
    4. Applied egg-rr6.9%

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

      [Start]44.9

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

      unpow3 [=>]44.9

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

      add-cube-cbrt [<=]45.7

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

      flip-- [=>]20.0

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

      associate-*r/ [=>]6.9

      \[ \color{blue}{\frac{y \cdot \left(x \cdot x - z \cdot z\right)}{x + z}} \cdot t \]
    5. Simplified45.6%

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

      [Start]6.9

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

      associate-/l* [=>]19.9

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

      difference-of-squares [=>]19.9

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

      associate-/r* [=>]45.6

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

      *-inverses [=>]45.6

      \[ \frac{y}{\frac{\color{blue}{1}}{x - z}} \cdot t \]
    6. Applied egg-rr98.6%

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

      [Start]45.6

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

      associate-*l/ [=>]98.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - y \cdot z \leq -1 \cdot 10^{+285}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - y \cdot z \leq 2 \cdot 10^{+224}:\\ \;\;\;\;\left(x \cdot y - y \cdot z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot t}{\frac{1}{x - z}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy97.0%
Cost1864
\[\begin{array}{l} t_1 := \left(x \cdot y - y \cdot z\right) \cdot t\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;t_1 \leq 10^{+266}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array} \]
Alternative 2
Accuracy88.1%
Cost713
\[\begin{array}{l} \mathbf{if}\;x \leq 1.6 \cdot 10^{+170} \lor \neg \left(x \leq 4.4 \cdot 10^{+237}\right):\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot t\\ \end{array} \]
Alternative 3
Accuracy70.2%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -1.06 \cdot 10^{-10} \lor \neg \left(z \leq 4.5 \cdot 10^{-43}\right):\\ \;\;\;\;z \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot t\\ \end{array} \]
Alternative 4
Accuracy70.0%
Cost648
\[\begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{-13}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-t\right)\right)\\ \mathbf{elif}\;z \leq 2.5 \cdot 10^{-43}:\\ \;\;\;\;\left(x \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-t\right)\right)\\ \end{array} \]
Alternative 5
Accuracy69.6%
Cost648
\[\begin{array}{l} \mathbf{if}\;z \leq -4.5 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-t\right)\right)\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-44}:\\ \;\;\;\;\left(x \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \end{array} \]
Alternative 6
Accuracy95.5%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+73}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array} \]
Alternative 7
Accuracy95.4%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq -2.25 \cdot 10^{+71}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array} \]
Alternative 8
Accuracy55.2%
Cost452
\[\begin{array}{l} \mathbf{if}\;t \leq 1.12 \cdot 10^{-92}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 9
Accuracy55.1%
Cost452
\[\begin{array}{l} \mathbf{if}\;t \leq 1.14 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot t\\ \end{array} \]
Alternative 10
Accuracy51.8%
Cost320
\[y \cdot \left(x \cdot t\right) \]

Error

Reproduce?

herbie shell --seed 2023147 
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))

  (* (- (* x y) (* z y)) t))