?

Average Accuracy: 88.9% → 98.9%
Time: 12.7s
Precision: binary64
Cost: 2512

?

\[ \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\\ t_2 := t \cdot \left(y \cdot \left(x - z\right)\right)\\ \mathbf{if}\;t_1 \leq -2 \cdot 10^{+194}:\\ \;\;\;\;\frac{y}{\frac{\frac{1}{t}}{x - z}}\\ \mathbf{elif}\;t_1 \leq -2 \cdot 10^{-148}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{-137}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+256}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\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))) (t_2 (* t (* y (- x z)))))
   (if (<= t_1 -2e+194)
     (/ y (/ (/ 1.0 t) (- x z)))
     (if (<= t_1 -2e-148)
       t_2
       (if (<= t_1 5e-137)
         (* (- x z) (* y t))
         (if (<= t_1 5e+256) t_2 (* y (* t (- 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 t_2 = t * (y * (x - z));
	double tmp;
	if (t_1 <= -2e+194) {
		tmp = y / ((1.0 / t) / (x - z));
	} else if (t_1 <= -2e-148) {
		tmp = t_2;
	} else if (t_1 <= 5e-137) {
		tmp = (x - z) * (y * t);
	} else if (t_1 <= 5e+256) {
		tmp = t_2;
	} else {
		tmp = y * (t * (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) :: t_2
    real(8) :: tmp
    t_1 = (x * y) - (y * z)
    t_2 = t * (y * (x - z))
    if (t_1 <= (-2d+194)) then
        tmp = y / ((1.0d0 / t) / (x - z))
    else if (t_1 <= (-2d-148)) then
        tmp = t_2
    else if (t_1 <= 5d-137) then
        tmp = (x - z) * (y * t)
    else if (t_1 <= 5d+256) then
        tmp = t_2
    else
        tmp = y * (t * (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 t_2 = t * (y * (x - z));
	double tmp;
	if (t_1 <= -2e+194) {
		tmp = y / ((1.0 / t) / (x - z));
	} else if (t_1 <= -2e-148) {
		tmp = t_2;
	} else if (t_1 <= 5e-137) {
		tmp = (x - z) * (y * t);
	} else if (t_1 <= 5e+256) {
		tmp = t_2;
	} else {
		tmp = y * (t * (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)
	t_2 = t * (y * (x - z))
	tmp = 0
	if t_1 <= -2e+194:
		tmp = y / ((1.0 / t) / (x - z))
	elif t_1 <= -2e-148:
		tmp = t_2
	elif t_1 <= 5e-137:
		tmp = (x - z) * (y * t)
	elif t_1 <= 5e+256:
		tmp = t_2
	else:
		tmp = y * (t * (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))
	t_2 = Float64(t * Float64(y * Float64(x - z)))
	tmp = 0.0
	if (t_1 <= -2e+194)
		tmp = Float64(y / Float64(Float64(1.0 / t) / Float64(x - z)));
	elseif (t_1 <= -2e-148)
		tmp = t_2;
	elseif (t_1 <= 5e-137)
		tmp = Float64(Float64(x - z) * Float64(y * t));
	elseif (t_1 <= 5e+256)
		tmp = t_2;
	else
		tmp = Float64(y * Float64(t * 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);
	t_2 = t * (y * (x - z));
	tmp = 0.0;
	if (t_1 <= -2e+194)
		tmp = y / ((1.0 / t) / (x - z));
	elseif (t_1 <= -2e-148)
		tmp = t_2;
	elseif (t_1 <= 5e-137)
		tmp = (x - z) * (y * t);
	elseif (t_1 <= 5e+256)
		tmp = t_2;
	else
		tmp = y * (t * (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]}, Block[{t$95$2 = N[(t * N[(y * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+194], N[(y / N[(N[(1.0 / t), $MachinePrecision] / N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -2e-148], t$95$2, If[LessEqual[t$95$1, 5e-137], N[(N[(x - z), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+256], t$95$2, N[(y * N[(t * 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\\
t_2 := t \cdot \left(y \cdot \left(x - z\right)\right)\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+194}:\\
\;\;\;\;\frac{y}{\frac{\frac{1}{t}}{x - z}}\\

\mathbf{elif}\;t_1 \leq -2 \cdot 10^{-148}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 5 \cdot 10^{-137}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+256}:\\
\;\;\;\;t_2\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original88.9%
Target95.1%
Herbie98.9%
\[\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)) < -1.99999999999999989e194

    1. Initial program 59.3%

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

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

      [Start]59.3

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

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

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

      associate-*l* [=>]97.5

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

      *-commutative [=>]97.5

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

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

      [Start]97.5

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

      associate-*r* [=>]99.1

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

      flip3-- [=>]24.0

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

      associate-*r/ [=>]17.0

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

      associate-/l* [=>]24.0

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

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

      \[ \frac{y \cdot 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* [=>]24.0

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

      flip3-- [<=]99.0

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

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

      [Start]99.0

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

      frac-2neg [=>]99.0

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

      associate-/r/ [=>]99.1

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

      associate-/l* [=>]98.9

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

      metadata-eval [=>]98.9

      \[ \frac{y}{\frac{\color{blue}{-1}}{t}} \cdot \left(-\left(x - z\right)\right) \]
    5. Applied egg-rr97.6%

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

      [Start]98.9

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

      associate-*l/ [=>]59.2

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

      associate-/l* [=>]97.6

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

      neg-mul-1 [=>]97.6

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

      associate-/r* [=>]97.6

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

      associate-/r* [<=]97.6

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

      metadata-eval [<=]97.6

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

      div-inv [<=]97.6

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

      clear-num [=>]97.6

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

      associate-/r/ [=>]97.6

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

      metadata-eval [=>]97.6

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

      associate-/r* [=>]97.6

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

      metadata-eval [=>]97.6

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

    if -1.99999999999999989e194 < (-.f64 (*.f64 x y) (*.f64 z y)) < -1.99999999999999987e-148 or 5.00000000000000001e-137 < (-.f64 (*.f64 x y) (*.f64 z y)) < 5.00000000000000015e256

    1. Initial program 99.6%

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

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

      [Start]99.6

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

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

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

    if -1.99999999999999987e-148 < (-.f64 (*.f64 x y) (*.f64 z y)) < 5.00000000000000001e-137

    1. Initial program 91.8%

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

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

      [Start]91.8

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

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

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

      associate-*l* [=>]97.1

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

      *-commutative [=>]97.1

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

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

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

      [Start]97.1

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

      mul-1-neg [=>]97.1

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

      associate-*r* [=>]96.5

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

      associate-*r* [=>]97.0

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

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

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

      distribute-lft-in [<=]97.0

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

      sub-neg [<=]97.0

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

      *-commutative [=>]97.0

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

    if 5.00000000000000015e256 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 31.7%

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

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

      [Start]31.7

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

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

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

      associate-*l* [=>]99.4

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

      *-commutative [=>]99.4

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

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

Alternatives

Alternative 1
Accuracy99.1%
Cost2512
\[\begin{array}{l} t_1 := t \cdot \left(y \cdot \left(x - z\right)\right)\\ t_2 := x \cdot y - y \cdot z\\ t_3 := \left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{if}\;t_2 \leq -5 \cdot 10^{+304}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq -2 \cdot 10^{-148}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{-137}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+256}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \end{array} \]
Alternative 2
Accuracy69.7%
Cost780
\[\begin{array}{l} \mathbf{if}\;z \leq -13.5:\\ \;\;\;\;z \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-8}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;z \leq 1.45 \cdot 10^{+221}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \end{array} \]
Alternative 3
Accuracy69.4%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -31.5 \lor \neg \left(z \leq 1.85 \cdot 10^{-6}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 4
Accuracy69.6%
Cost649
\[\begin{array}{l} \mathbf{if}\;z \leq -16 \lor \neg \left(z \leq 2.3 \cdot 10^{-6}\right):\\ \;\;\;\;z \cdot \left(y \cdot \left(-t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 5
Accuracy87.0%
Cost580
\[\begin{array}{l} \mathbf{if}\;t \leq 3.7 \cdot 10^{+146}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 6
Accuracy96.2%
Cost580
\[\begin{array}{l} \mathbf{if}\;t \leq 3 \cdot 10^{+47}:\\ \;\;\;\;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 7
Accuracy54.4%
Cost452
\[\begin{array}{l} \mathbf{if}\;t \leq 10^{+24}:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]
Alternative 8
Accuracy51.4%
Cost320
\[y \cdot \left(x \cdot t\right) \]

Error

Reproduce?

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