?

Average Error: 10.63% → 2%
Time: 9.8s
Precision: binary64
Cost: 8072

?

\[ \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^{+283}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\frac{1}{x - z}}{y \cdot t}\right)}^{-1}\\ \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+283)
       (* t (* y (- x z)))
       (pow (/ (/ 1.0 (- x z)) (* y t)) -1.0)))))
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+283) {
		tmp = t * (y * (x - z));
	} else {
		tmp = pow(((1.0 / (x - z)) / (y * t)), -1.0);
	}
	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+283) {
		tmp = t * (y * (x - z));
	} else {
		tmp = Math.pow(((1.0 / (x - z)) / (y * t)), -1.0);
	}
	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+283:
		tmp = t * (y * (x - z))
	else:
		tmp = math.pow(((1.0 / (x - z)) / (y * t)), -1.0)
	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+283)
		tmp = Float64(t * Float64(y * Float64(x - z)));
	else
		tmp = Float64(Float64(1.0 / Float64(x - z)) / Float64(y * t)) ^ -1.0;
	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+283)
		tmp = t * (y * (x - z));
	else
		tmp = ((1.0 / (x - z)) / (y * t)) ^ -1.0;
	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+283], N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(1.0 / N[(x - z), $MachinePrecision]), $MachinePrecision] / N[(y * t), $MachinePrecision]), $MachinePrecision], -1.0], $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^{+283}:\\
\;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.63%
Target5.46%
Herbie2%
\[\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 100

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified0.45

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

      [Start]100

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

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

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

      associate-*l* [=>]0.45

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

      *-commutative [=>]0.45

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

    if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1.99999999999999991e283

    1. Initial program 2.15

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified2.15

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

      [Start]2.15

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

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

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

    if 1.99999999999999991e283 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 80

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Simplified0.4

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

      [Start]80

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

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

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

      associate-*l* [=>]0.4

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

      *-commutative [=>]0.4

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

      \[\leadsto \color{blue}{\frac{y \cdot t}{\frac{1}{x - z}}} \]
    4. Applied egg-rr0.7

      \[\leadsto \color{blue}{{\left(\frac{\frac{1}{x - z}}{y \cdot t}\right)}^{-1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification2

    \[\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^{+283}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\frac{1}{x - z}}{y \cdot t}\right)}^{-1}\\ \end{array} \]

Alternatives

Alternative 1
Error2.56%
Cost1608
\[\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 4 \cdot 10^{+132}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot t}{\frac{1}{x - z}}\\ \end{array} \]
Alternative 2
Error1.98%
Cost1481
\[\begin{array}{l} t_1 := x \cdot y - y \cdot z\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+289}\right):\\ \;\;\;\;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 3
Error30.37%
Cost913
\[\begin{array}{l} t_1 := y \cdot \left(-z \cdot t\right)\\ \mathbf{if}\;z \leq -10200000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.4 \cdot 10^{-70}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-47} \lor \neg \left(z \leq 5.2 \cdot 10^{+19}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 4
Error29.66%
Cost913
\[\begin{array}{l} t_1 := z \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq 2.85 \cdot 10^{-42} \lor \neg \left(z \leq 9.5 \cdot 10^{+19}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 5
Error29.7%
Cost912
\[\begin{array}{l} t_1 := z \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{if}\;z \leq -4400000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9.2 \cdot 10^{-68}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq 1.42 \cdot 10^{-37}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+19}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error12.72%
Cost845
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+179}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{-176} \lor \neg \left(x \leq -1 \cdot 10^{-307}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \end{array} \]
Alternative 7
Error45.73%
Cost452
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{+58}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]
Alternative 8
Error49.43%
Cost320
\[y \cdot \left(x \cdot t\right) \]
Alternative 9
Error48.99%
Cost320
\[x \cdot \left(y \cdot t\right) \]

Error

Reproduce?

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