?

Average Accuracy: 74.5% → 92.7%
Time: 18.7s
Precision: binary64
Cost: 3532

?

\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
\[\begin{array}{l} t_1 := \left(x + y\right) + \frac{y \cdot \left(t - z\right)}{a - t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x + \frac{z - a}{\frac{t}{y}}\\ \mathbf{elif}\;t_1 \leq -5 \cdot 10^{-275}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - \frac{y}{\frac{a - t}{z - t}}\right)\\ \end{array} \]
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ (+ x y) (/ (* y (- t z)) (- a t)))))
   (if (<= t_1 (- INFINITY))
     (+ x (/ (- z a) (/ t y)))
     (if (<= t_1 -5e-275)
       t_1
       (if (<= t_1 0.0)
         (- x (/ y (/ t (- a z))))
         (+ x (- y (/ y (/ (- a t) (- z t))))))))))
double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = (x + y) + ((y * (t - z)) / (a - t));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + ((z - a) / (t / y));
	} else if (t_1 <= -5e-275) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = x - (y / (t / (a - z)));
	} else {
		tmp = x + (y - (y / ((a - t) / (z - t))));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
	return (x + y) - (((z - t) * y) / (a - t));
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = (x + y) + ((y * (t - z)) / (a - t));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = x + ((z - a) / (t / y));
	} else if (t_1 <= -5e-275) {
		tmp = t_1;
	} else if (t_1 <= 0.0) {
		tmp = x - (y / (t / (a - z)));
	} else {
		tmp = x + (y - (y / ((a - t) / (z - t))));
	}
	return tmp;
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
def code(x, y, z, t, a):
	t_1 = (x + y) + ((y * (t - z)) / (a - t))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = x + ((z - a) / (t / y))
	elif t_1 <= -5e-275:
		tmp = t_1
	elif t_1 <= 0.0:
		tmp = x - (y / (t / (a - z)))
	else:
		tmp = x + (y - (y / ((a - t) / (z - t))))
	return tmp
function code(x, y, z, t, a)
	return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t)))
end
function code(x, y, z, t, a)
	t_1 = Float64(Float64(x + y) + Float64(Float64(y * Float64(t - z)) / Float64(a - t)))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x + Float64(Float64(z - a) / Float64(t / y)));
	elseif (t_1 <= -5e-275)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = Float64(x - Float64(y / Float64(t / Float64(a - z))));
	else
		tmp = Float64(x + Float64(y - Float64(y / Float64(Float64(a - t) / Float64(z - t)))));
	end
	return tmp
end
function tmp = code(x, y, z, t, a)
	tmp = (x + y) - (((z - t) * y) / (a - t));
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (x + y) + ((y * (t - z)) / (a - t));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = x + ((z - a) / (t / y));
	elseif (t_1 <= -5e-275)
		tmp = t_1;
	elseif (t_1 <= 0.0)
		tmp = x - (y / (t / (a - z)));
	else
		tmp = x + (y - (y / ((a - t) / (z - t))));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x + y), $MachinePrecision] + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(z - a), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -5e-275], t$95$1, If[LessEqual[t$95$1, 0.0], N[(x - N[(y / N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := \left(x + y\right) + \frac{y \cdot \left(t - z\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{z - a}{\frac{t}{y}}\\

\mathbf{elif}\;t_1 \leq -5 \cdot 10^{-275}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original74.5%
Target86.4%
Herbie92.7%
\[\begin{array}{l} \mathbf{if}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} < -1.3664970889390727 \cdot 10^{-7}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \mathbf{elif}\;\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} < 1.4754293444577233 \cdot 10^{-239}:\\ \;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\ \end{array} \]

Derivation?

  1. Split input into 4 regimes
  2. if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -inf.0

    1. Initial program 0.0%

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
    2. Simplified68.7%

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

      [Start]0.0

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

      +-rgt-identity [<=]0.0

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

      associate-+l+ [=>]0.0

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

      associate-+r- [<=]0.0

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

      +-rgt-identity [=>]0.0

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

      *-commutative [=>]0.0

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

      associate-/l* [=>]68.7

      \[ x + \left(y - \color{blue}{\frac{y}{\frac{a - t}{z - t}}}\right) \]
    3. Taylor expanded in t around -inf 48.6%

      \[\leadsto x + \left(y - \frac{y}{\color{blue}{1 + -1 \cdot \frac{a - z}{t}}}\right) \]
    4. Simplified48.6%

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

      [Start]48.6

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

      mul-1-neg [=>]48.6

      \[ x + \left(y - \frac{y}{1 + \color{blue}{\left(-\frac{a - z}{t}\right)}}\right) \]
    5. Taylor expanded in t around inf 37.6%

      \[\leadsto x + \color{blue}{\frac{y \cdot \left(z - a\right)}{t}} \]
    6. Simplified70.0%

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

      [Start]37.6

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

      *-commutative [=>]37.6

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

      associate-/l* [=>]70.0

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

    if -inf.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.99999999999999983e-275

    1. Initial program 97.6%

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

    if -4.99999999999999983e-275 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0

    1. Initial program 5.9%

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
    2. Simplified47.1%

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

      [Start]5.9

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

      +-rgt-identity [<=]5.9

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

      associate-+l+ [=>]5.9

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

      associate-+r- [<=]46.9

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

      +-rgt-identity [=>]46.9

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

      *-commutative [=>]46.9

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

      associate-/l* [=>]47.1

      \[ x + \left(y - \color{blue}{\frac{y}{\frac{a - t}{z - t}}}\right) \]
    3. Taylor expanded in t around inf 98.7%

      \[\leadsto x + \color{blue}{\frac{-1 \cdot \left(a \cdot y\right) - -1 \cdot \left(y \cdot z\right)}{t}} \]
    4. Simplified98.7%

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

      [Start]98.7

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

      *-commutative [<=]98.7

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

      distribute-lft-out-- [=>]98.7

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

      distribute-lft-out-- [=>]98.7

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

      associate-*r* [=>]98.7

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

      neg-mul-1 [<=]98.7

      \[ x + \frac{\color{blue}{\left(-y\right)} \cdot \left(a - z\right)}{t} \]
    5. Taylor expanded in x around 0 98.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(a - z\right)}{t} + x} \]
    6. Simplified98.8%

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

      [Start]98.7

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

      +-commutative [=>]98.7

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

      metadata-eval [<=]98.7

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

      associate-*r/ [<=]98.8

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

      cancel-sign-sub-inv [<=]98.8

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

      *-lft-identity [=>]98.8

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

      associate-*r/ [=>]98.7

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

      associate-/l* [=>]98.8

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

    if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t)))

    1. Initial program 80.6%

      \[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
    2. Simplified91.9%

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

      [Start]80.6

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

      +-rgt-identity [<=]80.6

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

      associate-+l+ [=>]80.6

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

      associate-+r- [<=]80.7

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

      +-rgt-identity [=>]80.7

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

      *-commutative [=>]80.7

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

      associate-/l* [=>]91.9

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

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

Alternatives

Alternative 1
Accuracy81.1%
Cost1104
\[\begin{array}{l} t_1 := x + \frac{z - a}{\frac{t}{y}}\\ \mathbf{if}\;t \leq -5.8 \cdot 10^{+94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.1 \cdot 10^{+31}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq -5.2 \cdot 10^{-44}:\\ \;\;\;\;x + \frac{y \cdot z}{t}\\ \mathbf{elif}\;t \leq 1.4 \cdot 10^{-31}:\\ \;\;\;\;\left(x + y\right) - \frac{z}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy87.8%
Cost1100
\[\begin{array}{l} t_1 := x + \frac{z - a}{\frac{t}{y}}\\ \mathbf{if}\;t \leq -9.5 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -6.6 \cdot 10^{-12}:\\ \;\;\;\;x + \left(y - \frac{y}{1 - \frac{a}{t}}\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+62}:\\ \;\;\;\;\left(x + y\right) - \frac{z}{\frac{a - t}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy89.7%
Cost1097
\[\begin{array}{l} \mathbf{if}\;a \leq -5.6 \cdot 10^{-185} \lor \neg \left(a \leq 1.22 \cdot 10^{-207}\right):\\ \;\;\;\;x + \left(y - \frac{y}{\frac{a - t}{z - t}}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - a}{\frac{t}{y}}\\ \end{array} \]
Alternative 4
Accuracy81.7%
Cost972
\[\begin{array}{l} t_1 := x + \frac{z - a}{\frac{t}{y}}\\ \mathbf{if}\;t \leq -5 \cdot 10^{+143}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -4.4 \cdot 10^{-66}:\\ \;\;\;\;x + \left(y - \frac{y}{1 - \frac{a}{t}}\right)\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-33}:\\ \;\;\;\;\left(x + y\right) - \frac{z}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy78.7%
Cost841
\[\begin{array}{l} \mathbf{if}\;a \leq -3.7 \cdot 10^{-81} \lor \neg \left(a \leq 1700000\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - a}{\frac{t}{y}}\\ \end{array} \]
Alternative 6
Accuracy77.0%
Cost712
\[\begin{array}{l} \mathbf{if}\;a \leq -3.3 \cdot 10^{-81}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq 2.1 \cdot 10^{-48}:\\ \;\;\;\;x + z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 7
Accuracy55.1%
Cost592
\[\begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{+267}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-57}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-98}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{+85}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 8
Accuracy68.8%
Cost456
\[\begin{array}{l} \mathbf{if}\;a \leq -9 \cdot 10^{-80}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{-74}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 9
Accuracy54.4%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
  :precision binary64

  :herbie-target
  (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))

  (- (+ x y) (/ (* (- z t) y) (- a t))))