?

Average Accuracy: 89.1% → 99.4%
Time: 13.1s
Precision: binary64
Cost: 2768

?

\[ \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 := t \cdot \left(y \cdot \left(x - z\right)\right)\\ t_2 := x \cdot y - y \cdot z\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;t_2 \leq -1 \cdot 10^{-249}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 0:\\ \;\;\;\;y \cdot \frac{t}{\frac{1}{x - z}}\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+207}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right) - z \cdot \left(y \cdot t\right)\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (- (* x y) (* z y)) t))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (* y (- x z)))) (t_2 (- (* x y) (* y z))))
   (if (<= t_2 (- INFINITY))
     (* (- x z) (* y t))
     (if (<= t_2 -1e-249)
       t_1
       (if (<= t_2 0.0)
         (* y (/ t (/ 1.0 (- x z))))
         (if (<= t_2 2e+207) t_1 (- (* x (* y t)) (* z (* y t)))))))))
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 = t * (y * (x - z));
	double t_2 = (x * y) - (y * z);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = (x - z) * (y * t);
	} else if (t_2 <= -1e-249) {
		tmp = t_1;
	} else if (t_2 <= 0.0) {
		tmp = y * (t / (1.0 / (x - z)));
	} else if (t_2 <= 2e+207) {
		tmp = t_1;
	} else {
		tmp = (x * (y * t)) - (z * (y * t));
	}
	return tmp;
}
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 = t * (y * (x - z));
	double t_2 = (x * y) - (y * z);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = (x - z) * (y * t);
	} else if (t_2 <= -1e-249) {
		tmp = t_1;
	} else if (t_2 <= 0.0) {
		tmp = y * (t / (1.0 / (x - z)));
	} else if (t_2 <= 2e+207) {
		tmp = t_1;
	} else {
		tmp = (x * (y * t)) - (z * (y * t));
	}
	return tmp;
}
def code(x, y, z, t):
	return ((x * y) - (z * y)) * t
def code(x, y, z, t):
	t_1 = t * (y * (x - z))
	t_2 = (x * y) - (y * z)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = (x - z) * (y * t)
	elif t_2 <= -1e-249:
		tmp = t_1
	elif t_2 <= 0.0:
		tmp = y * (t / (1.0 / (x - z)))
	elif t_2 <= 2e+207:
		tmp = t_1
	else:
		tmp = (x * (y * t)) - (z * (y * t))
	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(t * Float64(y * Float64(x - z)))
	t_2 = Float64(Float64(x * y) - Float64(y * z))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = Float64(Float64(x - z) * Float64(y * t));
	elseif (t_2 <= -1e-249)
		tmp = t_1;
	elseif (t_2 <= 0.0)
		tmp = Float64(y * Float64(t / Float64(1.0 / Float64(x - z))));
	elseif (t_2 <= 2e+207)
		tmp = t_1;
	else
		tmp = Float64(Float64(x * Float64(y * t)) - Float64(z * Float64(y * t)));
	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 = t * (y * (x - z));
	t_2 = (x * y) - (y * z);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = (x - z) * (y * t);
	elseif (t_2 <= -1e-249)
		tmp = t_1;
	elseif (t_2 <= 0.0)
		tmp = y * (t / (1.0 / (x - z)));
	elseif (t_2 <= 2e+207)
		tmp = t_1;
	else
		tmp = (x * (y * t)) - (z * (y * t));
	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[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(x - z), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -1e-249], t$95$1, If[LessEqual[t$95$2, 0.0], N[(y * N[(t / N[(1.0 / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+207], t$95$1, N[(N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision] - N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
t_1 := t \cdot \left(y \cdot \left(x - z\right)\right)\\
t_2 := x \cdot y - y \cdot z\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

\mathbf{elif}\;t_2 \leq -1 \cdot 10^{-249}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;y \cdot \frac{t}{\frac{1}{x - z}}\\

\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+207}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot t\right) - z \cdot \left(y \cdot t\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original89.1%
Target94.5%
Herbie99.4%
\[\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 4 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z y)) < -inf.0

    1. Initial program 0.0%

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

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

      [Start]0.0

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

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

      \[ \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)} \]

      *-commutative [=>]99.6

      \[ y \cdot \color{blue}{\left(t \cdot \left(x - z\right)\right)} \]
    3. Taylor expanded in x around 0 99.6%

      \[\leadsto \color{blue}{y \cdot \left(t \cdot x\right) + -1 \cdot \left(y \cdot \left(t \cdot z\right)\right)} \]
    4. Simplified99.5%

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

      [Start]99.6

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

      mul-1-neg [=>]99.6

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

      associate-*r* [=>]99.5

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

      associate-*r* [=>]99.5

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

      distribute-rgt-neg-out [<=]99.5

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

      distribute-lft-in [<=]99.5

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

      sub-neg [<=]99.5

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

      *-commutative [=>]99.5

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z y)) < -1.00000000000000005e-249 or -0.0 < (-.f64 (*.f64 x y) (*.f64 z y)) < 2.0000000000000001e207

    1. Initial program 99.5%

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

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

      [Start]99.5

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

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

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

    if -1.00000000000000005e-249 < (-.f64 (*.f64 x y) (*.f64 z y)) < -0.0

    1. Initial program 72.0%

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

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

      [Start]72.0

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

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

      \[ \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)} \]

      *-commutative [=>]99.6

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

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

      [Start]99.6

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

      flip3-- [=>]48.6

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

      associate-*r/ [=>]48.1

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

      associate-/l* [=>]48.7

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

      *-un-lft-identity [=>]48.7

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

      associate-/l* [=>]48.6

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

      flip3-- [<=]99.6

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

    if 2.0000000000000001e207 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 52.8%

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

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

      [Start]52.8

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

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

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

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

      [Start]52.8

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

      *-commutative [=>]52.8

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

      associate-*l* [=>]98.7

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

      *-commutative [=>]98.7

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

      sub-neg [=>]98.7

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

      +-commutative [=>]98.7

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

      distribute-lft-in [=>]98.7

      \[ \color{blue}{\left(y \cdot t\right) \cdot \left(-z\right) + \left(y \cdot t\right) \cdot x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification99.4%

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

Alternatives

Alternative 1
Accuracy98.9%
Cost2640
\[\begin{array}{l} t_1 := x \cdot y - y \cdot z\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;t_1 \leq -1 \cdot 10^{-249}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;y \cdot \frac{t}{\frac{1}{x - z}}\\ \mathbf{elif}\;t_1 \leq 10^{+129}:\\ \;\;\;\;t_1 \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array} \]
Alternative 2
Accuracy68.5%
Cost1176
\[\begin{array}{l} t_1 := -z \cdot \left(y \cdot t\right)\\ \mathbf{if}\;z \leq -7 \cdot 10^{+263}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{+60}:\\ \;\;\;\;\left(-y\right) \cdot \left(z \cdot t\right)\\ \mathbf{elif}\;z \leq -8.5 \cdot 10^{-51}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-86}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-286}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq 40000000000000:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy68.3%
Cost1044
\[\begin{array}{l} t_1 := \left(y \cdot z\right) \cdot \left(-t\right)\\ \mathbf{if}\;z \leq -2 \cdot 10^{+60}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-50}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;z \leq -1.24 \cdot 10^{-86}:\\ \;\;\;\;-z \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-288}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{+14}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy68.8%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{-11} \lor \neg \left(z \leq 1.5 \cdot 10^{+15}\right):\\ \;\;\;\;\left(-y\right) \cdot \left(z \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \end{array} \]
Alternative 5
Accuracy53.4%
Cost585
\[\begin{array}{l} \mathbf{if}\;t \leq 2000000000 \lor \neg \left(t \leq 5.2 \cdot 10^{+250}\right):\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 6
Accuracy88.3%
Cost580
\[\begin{array}{l} \mathbf{if}\;z \leq 1.35 \cdot 10^{+219}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \end{array} \]
Alternative 7
Accuracy94.1%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{-173}:\\ \;\;\;\;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 8
Accuracy96.1%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-12}:\\ \;\;\;\;\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 9
Accuracy53.5%
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-157}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 10
Accuracy51.2%
Cost320
\[x \cdot \left(y \cdot t\right) \]

Error

Reproduce?

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