?

Average Accuracy: 88.7% → 97.8%
Time: 9.9s
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 -\infty:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+241}:\\ \;\;\;\;t_1 \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \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 (- (* x y) (* y z))))
   (if (<= t_1 (- INFINITY))
     (* y (* t (- x z)))
     (if (<= t_1 2e+241) (* t_1 t) (* (- x 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 = (x * y) - (y * z);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = y * (t * (x - z));
	} else if (t_1 <= 2e+241) {
		tmp = t_1 * t;
	} else {
		tmp = (x - 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 = (x * y) - (y * z);
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = y * (t * (x - z));
	} else if (t_1 <= 2e+241) {
		tmp = t_1 * t;
	} else {
		tmp = (x - 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 = (x * y) - (y * z)
	tmp = 0
	if t_1 <= -math.inf:
		tmp = y * (t * (x - z))
	elif t_1 <= 2e+241:
		tmp = t_1 * t
	else:
		tmp = (x - 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(Float64(x * y) - Float64(y * z))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(y * Float64(t * Float64(x - z)));
	elseif (t_1 <= 2e+241)
		tmp = Float64(t_1 * t);
	else
		tmp = Float64(Float64(x - 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 = (x * y) - (y * z);
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = y * (t * (x - z));
	elseif (t_1 <= 2e+241)
		tmp = t_1 * t;
	else
		tmp = (x - 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[(N[(x * y), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(t * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+241], N[(t$95$1 * t), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y * t), $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 -\infty:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original88.7%
Target95.1%
Herbie97.8%
\[\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)) < -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)} \]

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z y)) < 2.0000000000000001e241

    1. Initial program 97.6%

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

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

    1. Initial program 40.5%

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

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

      [Start]40.5

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

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

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

      associate-*l* [=>]99.1

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

      *-commutative [=>]99.1

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

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

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

      [Start]99.1

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

      mul-1-neg [=>]99.1

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

      associate-*r* [=>]99.4

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

      associate-*r* [=>]99.3

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

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

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

      distribute-lft-in [<=]99.3

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

      sub-neg [<=]99.3

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

      *-commutative [=>]99.3

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

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

Alternatives

Alternative 1
Accuracy67.5%
Cost1177
\[\begin{array}{l} t_1 := y \cdot \left(z \cdot \left(-t\right)\right)\\ \mathbf{if}\;z \leq -1.1 \cdot 10^{-31}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.42 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq -8.4 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-124}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{-97} \lor \neg \left(z \leq 3.5 \cdot 10^{-41}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 2
Accuracy67.6%
Cost1176
\[\begin{array}{l} t_1 := z \cdot \left(y \cdot \left(-t\right)\right)\\ t_2 := y \cdot \left(z \cdot \left(-t\right)\right)\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{-31}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.42 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq -8.4 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-124}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-98}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-40}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy67.1%
Cost1176
\[\begin{array}{l} t_1 := z \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{if}\;z \leq -1.12 \cdot 10^{-31}:\\ \;\;\;\;y \cdot \left(z \cdot \left(-t\right)\right)\\ \mathbf{elif}\;z \leq -4.9 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-139}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-98}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-41}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy87.2%
Cost713
\[\begin{array}{l} \mathbf{if}\;z \leq 1.35 \cdot 10^{+60} \lor \neg \left(z \leq 2.9 \cdot 10^{+203}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(y \cdot \left(-t\right)\right)\\ \end{array} \]
Alternative 5
Accuracy95.8%
Cost580
\[\begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+54}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array} \]
Alternative 6
Accuracy96.1%
Cost580
\[\begin{array}{l} \mathbf{if}\;t \leq 5.2 \cdot 10^{-23}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 7
Accuracy54.3%
Cost452
\[\begin{array}{l} \mathbf{if}\;t \leq 3.5 \cdot 10^{-102}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 8
Accuracy51.4%
Cost320
\[x \cdot \left(y \cdot t\right) \]

Error

Reproduce?

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