?

Average Accuracy: 74.3% → 89.4%
Time: 14.6s
Precision: binary64
Cost: 1096

?

\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
\[\begin{array}{l} \mathbf{if}\;t \leq -3.6 \cdot 10^{+85}:\\ \;\;\;\;\left(x - \frac{y}{t} \cdot a\right) + \frac{y}{t} \cdot z\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+33}:\\ \;\;\;\;x + \left(y + \frac{t - z}{\frac{a - t}{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\ \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
 (if (<= t -3.6e+85)
   (+ (- x (* (/ y t) a)) (* (/ y t) z))
   (if (<= t 2.3e+33)
     (+ x (+ y (/ (- t z) (/ (- a t) y))))
     (- x (/ y (/ t (- a z)))))))
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 tmp;
	if (t <= -3.6e+85) {
		tmp = (x - ((y / t) * a)) + ((y / t) * z);
	} else if (t <= 2.3e+33) {
		tmp = x + (y + ((t - z) / ((a - t) / y)));
	} else {
		tmp = x - (y / (t / (a - z)));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = (x + y) - (((z - t) * y) / (a - t))
end function
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= (-3.6d+85)) then
        tmp = (x - ((y / t) * a)) + ((y / t) * z)
    else if (t <= 2.3d+33) then
        tmp = x + (y + ((t - z) / ((a - t) / y)))
    else
        tmp = x - (y / (t / (a - z)))
    end if
    code = tmp
end function
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 tmp;
	if (t <= -3.6e+85) {
		tmp = (x - ((y / t) * a)) + ((y / t) * z);
	} else if (t <= 2.3e+33) {
		tmp = x + (y + ((t - z) / ((a - t) / y)));
	} else {
		tmp = x - (y / (t / (a - z)));
	}
	return tmp;
}
def code(x, y, z, t, a):
	return (x + y) - (((z - t) * y) / (a - t))
def code(x, y, z, t, a):
	tmp = 0
	if t <= -3.6e+85:
		tmp = (x - ((y / t) * a)) + ((y / t) * z)
	elif t <= 2.3e+33:
		tmp = x + (y + ((t - z) / ((a - t) / y)))
	else:
		tmp = x - (y / (t / (a - z)))
	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)
	tmp = 0.0
	if (t <= -3.6e+85)
		tmp = Float64(Float64(x - Float64(Float64(y / t) * a)) + Float64(Float64(y / t) * z));
	elseif (t <= 2.3e+33)
		tmp = Float64(x + Float64(y + Float64(Float64(t - z) / Float64(Float64(a - t) / y))));
	else
		tmp = Float64(x - Float64(y / Float64(t / Float64(a - z))));
	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)
	tmp = 0.0;
	if (t <= -3.6e+85)
		tmp = (x - ((y / t) * a)) + ((y / t) * z);
	elseif (t <= 2.3e+33)
		tmp = x + (y + ((t - z) / ((a - t) / y)));
	else
		tmp = x - (y / (t / (a - z)));
	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_] := If[LessEqual[t, -3.6e+85], N[(N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e+33], N[(x + N[(y + N[(N[(t - z), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+85}:\\
\;\;\;\;\left(x - \frac{y}{t} \cdot a\right) + \frac{y}{t} \cdot z\\

\mathbf{elif}\;t \leq 2.3 \cdot 10^{+33}:\\
\;\;\;\;x + \left(y + \frac{t - z}{\frac{a - t}{y}}\right)\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original74.3%
Target86.5%
Herbie89.4%
\[\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 3 regimes
  2. if t < -3.5999999999999998e85

    1. Initial program 55.0%

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

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

      [Start]55.0

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

      associate-/l* [=>]68.9

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

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

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

      [Start]72.7

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

      sub-neg [=>]72.7

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

      +-commutative [=>]72.7

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

      mul-1-neg [=>]72.7

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

      unsub-neg [=>]72.7

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

      associate-/l* [=>]76.7

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

      associate-/r/ [=>]77.0

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

      mul-1-neg [=>]77.0

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

      remove-double-neg [=>]77.0

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

      associate-/l* [=>]85.9

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

      associate-/r/ [=>]84.8

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

    if -3.5999999999999998e85 < t < 2.30000000000000011e33

    1. Initial program 89.0%

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

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

      [Start]89.0

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

      +-rgt-identity [<=]89.0

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

      associate-+l+ [=>]89.0

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

      associate-+r- [<=]90.2

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

      +-rgt-identity [=>]90.2

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

      associate-/l* [=>]93.0

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

    if 2.30000000000000011e33 < t

    1. Initial program 54.2%

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

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

      [Start]54.2

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

      associate-/l* [=>]68.5

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot a - y \cdot z}{t} + x} \]
    4. Simplified84.3%

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

      [Start]72.7

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

      +-commutative [=>]72.7

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

      mul-1-neg [=>]72.7

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

      unsub-neg [=>]72.7

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

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

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

      associate-/l* [=>]84.3

      \[ x - \color{blue}{\frac{y}{\frac{t}{a - z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.4%

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

Alternatives

Alternative 1
Accuracy71.2%
Cost1108
\[\begin{array}{l} t_1 := x + \frac{y}{t} \cdot z\\ \mathbf{if}\;t \leq -1.65 \cdot 10^{+41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -9.2 \cdot 10^{-266}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{-307}:\\ \;\;\;\;y \cdot \left(1 - \frac{z}{a}\right)\\ \mathbf{elif}\;t \leq 68000000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x - \frac{a}{\frac{t}{y}}\\ \end{array} \]
Alternative 2
Accuracy71.1%
Cost1108
\[\begin{array}{l} t_1 := x + \frac{y}{t} \cdot z\\ \mathbf{if}\;t \leq -2.02 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -9.2 \cdot 10^{-266}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-307}:\\ \;\;\;\;y \cdot \left(1 - \frac{z}{a}\right)\\ \mathbf{elif}\;t \leq 64000000000:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.7 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{t}{a}}\\ \end{array} \]
Alternative 3
Accuracy89.5%
Cost1097
\[\begin{array}{l} \mathbf{if}\;t \leq -3.6 \cdot 10^{+86} \lor \neg \left(t \leq 6.6 \cdot 10^{+31}\right):\\ \;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - \frac{y}{\frac{a - t}{z - t}}\right)\\ \end{array} \]
Alternative 4
Accuracy89.6%
Cost1097
\[\begin{array}{l} \mathbf{if}\;t \leq -8.6 \cdot 10^{+86} \lor \neg \left(t \leq 1.45 \cdot 10^{+33}\right):\\ \;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y + \frac{t - z}{\frac{a - t}{y}}\right)\\ \end{array} \]
Alternative 5
Accuracy66.2%
Cost844
\[\begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{+61}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -9.2 \cdot 10^{-266}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-307}:\\ \;\;\;\;y \cdot \left(1 - \frac{z}{a}\right)\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+33}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Accuracy81.5%
Cost841
\[\begin{array}{l} \mathbf{if}\;a \leq -8.2 \cdot 10^{-10} \lor \neg \left(a \leq 1.15 \cdot 10^{-81}\right):\\ \;\;\;\;x + \left(y - \frac{z}{\frac{a}{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \end{array} \]
Alternative 7
Accuracy80.1%
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -23000000000000:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \mathbf{elif}\;t \leq 8.2 \cdot 10^{+25}:\\ \;\;\;\;x + \left(y - \frac{z}{\frac{a}{y}}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{t}{a - z}}\\ \end{array} \]
Alternative 8
Accuracy76.9%
Cost713
\[\begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-8} \lor \neg \left(a \leq 4.7 \cdot 10^{-82}\right):\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{t} \cdot z\\ \end{array} \]
Alternative 9
Accuracy66.6%
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -1.65 \cdot 10^{+58}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+33}:\\ \;\;\;\;x + y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy54.1%
Cost64
\[x \]

Error

Reproduce?

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