?

Average Error: 16.1 → 9.7
Time: 12.2s
Precision: binary64
Cost: 1228

?

\[\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t} \]
\[\begin{array}{l} t_1 := \left(-\frac{y \cdot \left(a - z\right)}{t}\right) + x\\ \mathbf{if}\;t \leq -6.6 \cdot 10^{+206}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-289}:\\ \;\;\;\;y + \left(x + y \cdot \left(-\frac{z - t}{a - t}\right)\right)\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+76}:\\ \;\;\;\;x + \left(y - \frac{y \cdot \left(z - t\right)}{a - t}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 (+ (- (/ (* y (- a z)) t)) x)))
   (if (<= t -6.6e+206)
     t_1
     (if (<= t -5e-289)
       (+ y (+ x (* y (- (/ (- z t) (- a t))))))
       (if (<= t 1.8e+76) (+ x (- y (/ (* y (- z t)) (- a t)))) t_1)))))
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 = -((y * (a - z)) / t) + x;
	double tmp;
	if (t <= -6.6e+206) {
		tmp = t_1;
	} else if (t <= -5e-289) {
		tmp = y + (x + (y * -((z - t) / (a - t))));
	} else if (t <= 1.8e+76) {
		tmp = x + (y - ((y * (z - t)) / (a - t)));
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = -((y * (a - z)) / t) + x
    if (t <= (-6.6d+206)) then
        tmp = t_1
    else if (t <= (-5d-289)) then
        tmp = y + (x + (y * -((z - t) / (a - t))))
    else if (t <= 1.8d+76) then
        tmp = x + (y - ((y * (z - t)) / (a - t)))
    else
        tmp = t_1
    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 t_1 = -((y * (a - z)) / t) + x;
	double tmp;
	if (t <= -6.6e+206) {
		tmp = t_1;
	} else if (t <= -5e-289) {
		tmp = y + (x + (y * -((z - t) / (a - t))));
	} else if (t <= 1.8e+76) {
		tmp = x + (y - ((y * (z - t)) / (a - t)));
	} else {
		tmp = t_1;
	}
	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 = -((y * (a - z)) / t) + x
	tmp = 0
	if t <= -6.6e+206:
		tmp = t_1
	elif t <= -5e-289:
		tmp = y + (x + (y * -((z - t) / (a - t))))
	elif t <= 1.8e+76:
		tmp = x + (y - ((y * (z - t)) / (a - t)))
	else:
		tmp = t_1
	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(-Float64(Float64(y * Float64(a - z)) / t)) + x)
	tmp = 0.0
	if (t <= -6.6e+206)
		tmp = t_1;
	elseif (t <= -5e-289)
		tmp = Float64(y + Float64(x + Float64(y * Float64(-Float64(Float64(z - t) / Float64(a - t))))));
	elseif (t <= 1.8e+76)
		tmp = Float64(x + Float64(y - Float64(Float64(y * Float64(z - t)) / Float64(a - t))));
	else
		tmp = t_1;
	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 = -((y * (a - z)) / t) + x;
	tmp = 0.0;
	if (t <= -6.6e+206)
		tmp = t_1;
	elseif (t <= -5e-289)
		tmp = y + (x + (y * -((z - t) / (a - t))));
	elseif (t <= 1.8e+76)
		tmp = x + (y - ((y * (z - t)) / (a - t)));
	else
		tmp = t_1;
	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[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]) + x), $MachinePrecision]}, If[LessEqual[t, -6.6e+206], t$95$1, If[LessEqual[t, -5e-289], N[(y + N[(x + N[(y * (-N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.8e+76], N[(x + N[(y - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\begin{array}{l}
t_1 := \left(-\frac{y \cdot \left(a - z\right)}{t}\right) + x\\
\mathbf{if}\;t \leq -6.6 \cdot 10^{+206}:\\
\;\;\;\;t_1\\

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original16.1
Target8.4
Herbie9.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 3 regimes
  2. if t < -6.59999999999999969e206 or 1.8000000000000001e76 < t

    1. Initial program 30.3

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

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

      [Start]30.3

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]30.3

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

      rational_best_oopsla_all_46_json_45_simplify-107 [=>]26.4

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]26.4

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

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

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

      [Start]14.6

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]14.6

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

      rational_best_oopsla_all_46_json_45_simplify-92 [=>]14.6

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

      rational_best_oopsla_all_46_json_45_simplify-74 [<=]14.6

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

      rational_best_oopsla_all_46_json_45_simplify-102 [=>]14.6

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

    if -6.59999999999999969e206 < t < -5.00000000000000029e-289

    1. Initial program 12.5

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

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

      [Start]12.5

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]12.5

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

      rational_best_oopsla_all_46_json_45_simplify-107 [=>]10.7

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]10.7

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

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

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

      [Start]6.2

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]6.2

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

      rational_best_oopsla_all_46_json_45_simplify-37 [=>]6.2

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

      rational_best_oopsla_all_46_json_45_simplify-74 [<=]6.2

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

      rational_best_oopsla_all_46_json_45_simplify-52 [=>]6.2

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

      rational_best_oopsla_all_46_json_45_simplify-82 [=>]8.9

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]8.9

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

      rational_best_oopsla_all_46_json_45_simplify-92 [=>]8.9

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

    if -5.00000000000000029e-289 < t < 1.8000000000000001e76

    1. Initial program 7.2

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

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

      [Start]7.2

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]7.2

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

      rational_best_oopsla_all_46_json_45_simplify-107 [=>]6.2

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]6.2

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

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

Alternatives

Alternative 1
Error7.9
Cost3404
\[\begin{array}{l} t_1 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\ t_2 := \frac{z}{a - t}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;y \cdot \left(\left(-\frac{a}{t}\right) - t_2\right)\\ \mathbf{elif}\;t_1 \leq -2 \cdot 10^{-232}:\\ \;\;\;\;x + \left(y - \frac{y \cdot \left(z - t\right)}{a - t}\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{-264}:\\ \;\;\;\;\left(-\frac{y \cdot \left(a - z\right)}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;\left(y + x\right) - y \cdot t_2\\ \end{array} \]
Alternative 2
Error21.5
Cost1304
\[\begin{array}{l} \mathbf{if}\;a \leq -6.2 \cdot 10^{-124}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;a \leq -3.8 \cdot 10^{-157}:\\ \;\;\;\;-\frac{y \cdot z}{a - t}\\ \mathbf{elif}\;a \leq -5 \cdot 10^{-214}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{-271}:\\ \;\;\;\;y \cdot \left(-\frac{z}{a - t}\right)\\ \mathbf{elif}\;a \leq 3000000000:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 9.5 \cdot 10^{+26}:\\ \;\;\;\;y \cdot \frac{z + \left(-a\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 3
Error20.8
Cost1172
\[\begin{array}{l} \mathbf{if}\;a \leq -6.2 \cdot 10^{-124}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;a \leq -3.1 \cdot 10^{-158}:\\ \;\;\;\;-\frac{y \cdot z}{a - t}\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{-216}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -3.3 \cdot 10^{-271}:\\ \;\;\;\;y \cdot \left(-\frac{z}{a - t}\right)\\ \mathbf{elif}\;a \leq 88000000000:\\ \;\;\;\;\left(-\frac{y \cdot a}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 4
Error20.2
Cost1104
\[\begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{+95}:\\ \;\;\;\;\left(-\frac{y \cdot a}{t}\right) + x\\ \mathbf{elif}\;t \leq -5.6 \cdot 10^{-191}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{-296}:\\ \;\;\;\;y - \frac{z}{a - t} \cdot y\\ \mathbf{elif}\;t \leq 6.2 \cdot 10^{+24}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(-\frac{y \cdot z}{t}\right)\right) + x\\ \end{array} \]
Alternative 5
Error12.6
Cost972
\[\begin{array}{l} t_1 := \left(y + x\right) - y \cdot \frac{z}{a}\\ \mathbf{if}\;a \leq -1.4 \cdot 10^{-65}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{-150}:\\ \;\;\;\;\left(-\left(-\frac{y \cdot z}{t}\right)\right) + x\\ \mathbf{elif}\;a \leq 4500000000:\\ \;\;\;\;\left(-\frac{y \cdot a}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error10.6
Cost968
\[\begin{array}{l} t_1 := \left(-\frac{y \cdot \left(a - z\right)}{t}\right) + x\\ \mathbf{if}\;t \leq -3.7 \cdot 10^{+108}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 6.8 \cdot 10^{+25}:\\ \;\;\;\;\left(y + x\right) - y \cdot \frac{z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error15.0
Cost908
\[\begin{array}{l} \mathbf{if}\;a \leq -2.6 \cdot 10^{+14}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;a \leq 7.5 \cdot 10^{-150}:\\ \;\;\;\;\left(-\left(-\frac{y \cdot z}{t}\right)\right) + x\\ \mathbf{elif}\;a \leq 26000000000:\\ \;\;\;\;\left(-\frac{y \cdot a}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 8
Error11.4
Cost904
\[\begin{array}{l} t_1 := \left(y + x\right) - y \cdot \frac{z}{a}\\ \mathbf{if}\;a \leq -9 \cdot 10^{-66}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{+20}:\\ \;\;\;\;\left(-\frac{y \cdot \left(a - z\right)}{t}\right) + x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error20.5
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -6.3 \cdot 10^{+206}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 10^{+25}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error27.3
Cost328
\[\begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+94}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+125}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Alternative 11
Error28.7
Cost64
\[x \]

Error

Reproduce?

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