?

Average Error: 1.4 → 0.6
Time: 12.4s
Precision: binary64
Cost: 1096

?

\[x + y \cdot \frac{z - t}{a - t} \]
\[\begin{array}{l} t_1 := x + y \cdot \frac{z - t}{a - t}\\ \mathbf{if}\;y \leq -2 \cdot 10^{-89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-99}:\\ \;\;\;\;x + \frac{\frac{y}{\frac{1}{z - t}}}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
   (if (<= y -2e-89)
     t_1
     (if (<= y 2.9e-99) (+ x (/ (/ y (/ 1.0 (- z t))) (- a t))) t_1))))
double code(double x, double y, double z, double t, double a) {
	return x + (y * ((z - t) / (a - t)));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (y * ((z - t) / (a - t)));
	double tmp;
	if (y <= -2e-89) {
		tmp = t_1;
	} else if (y <= 2.9e-99) {
		tmp = x + ((y / (1.0 / (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) / (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 = x + (y * ((z - t) / (a - t)))
    if (y <= (-2d-89)) then
        tmp = t_1
    else if (y <= 2.9d-99) then
        tmp = x + ((y / (1.0d0 / (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) / (a - t)));
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (y * ((z - t) / (a - t)));
	double tmp;
	if (y <= -2e-89) {
		tmp = t_1;
	} else if (y <= 2.9e-99) {
		tmp = x + ((y / (1.0 / (z - t))) / (a - t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	return x + (y * ((z - t) / (a - t)))
def code(x, y, z, t, a):
	t_1 = x + (y * ((z - t) / (a - t)))
	tmp = 0
	if y <= -2e-89:
		tmp = t_1
	elif y <= 2.9e-99:
		tmp = x + ((y / (1.0 / (z - t))) / (a - t))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t))))
end
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t))))
	tmp = 0.0
	if (y <= -2e-89)
		tmp = t_1;
	elseif (y <= 2.9e-99)
		tmp = Float64(x + Float64(Float64(y / Float64(1.0 / 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) / (a - t)));
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (y * ((z - t) / (a - t)));
	tmp = 0.0;
	if (y <= -2e-89)
		tmp = t_1;
	elseif (y <= 2.9e-99)
		tmp = x + ((y / (1.0 / (z - t))) / (a - t));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e-89], t$95$1, If[LessEqual[y, 2.9e-99], N[(x + N[(N[(y / N[(1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-89}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 2.9 \cdot 10^{-99}:\\
\;\;\;\;x + \frac{\frac{y}{\frac{1}{z - t}}}{a - t}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.4
Target0.4
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\ \;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if y < -2.00000000000000008e-89 or 2.89999999999999985e-99 < y

    1. Initial program 0.6

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

    if -2.00000000000000008e-89 < y < 2.89999999999999985e-99

    1. Initial program 2.6

      \[x + y \cdot \frac{z - t}{a - t} \]
    2. Applied egg-rr0.4

      \[\leadsto x + \color{blue}{\frac{\frac{y}{\frac{1}{z - t}}}{a - t}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-89}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-99}:\\ \;\;\;\;x + \frac{\frac{y}{\frac{1}{z - t}}}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a - t}\\ \end{array} \]

Alternatives

Alternative 1
Error8.6
Cost1300
\[\begin{array}{l} t_1 := x + \frac{z}{\frac{a - t}{y}}\\ t_2 := x + y \cdot \left(-\frac{t}{a - t}\right)\\ \mathbf{if}\;t \leq -2.95 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 88000:\\ \;\;\;\;x + \frac{y \cdot t}{t - a}\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.2 \cdot 10^{+131}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error9.9
Cost1236
\[\begin{array}{l} t_1 := x + y \cdot \frac{z}{a - t}\\ t_2 := x + t \cdot \frac{y}{t - a}\\ \mathbf{if}\;t \leq -3.15 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 5.4 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2050:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.22 \cdot 10^{+131}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error9.1
Cost1104
\[\begin{array}{l} t_1 := x + y \cdot \frac{z}{a - t}\\ t_2 := x + \frac{y}{\frac{t}{t - z}}\\ \mathbf{if}\;t \leq -3.1 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 4200000:\\ \;\;\;\;x + t \cdot \frac{y}{t - a}\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error8.9
Cost1104
\[\begin{array}{l} t_1 := x + \frac{z}{\frac{a - t}{y}}\\ t_2 := x + \frac{y}{\frac{t}{t - z}}\\ \mathbf{if}\;t \leq -1.45 \cdot 10^{+103}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 51000:\\ \;\;\;\;x + t \cdot \frac{y}{t - a}\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error8.9
Cost1104
\[\begin{array}{l} t_1 := x + \frac{z}{\frac{a - t}{y}}\\ t_2 := x + \frac{y}{\frac{t}{t - z}}\\ \mathbf{if}\;t \leq -2.75 \cdot 10^{+102}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 60000:\\ \;\;\;\;x + \frac{y \cdot t}{t - a}\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error14.4
Cost1040
\[\begin{array}{l} \mathbf{if}\;t \leq -2.2 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 6.2 \cdot 10^{-57}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 2.6 \cdot 10^{+20}:\\ \;\;\;\;x + \left(\left(y - -1\right) + -1\right)\\ \mathbf{elif}\;t \leq 2.05 \cdot 10^{+83}:\\ \;\;\;\;x + y \cdot \left(-\frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 7
Error14.4
Cost1040
\[\begin{array}{l} \mathbf{if}\;t \leq -2.12 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{-57}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 9.8 \cdot 10^{+19}:\\ \;\;\;\;x + \left(\left(y - -1\right) + -1\right)\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{+83}:\\ \;\;\;\;x + \frac{z}{-\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 8
Error1.3
Cost968
\[\begin{array}{l} t_1 := x + y \cdot \frac{z - t}{a - t}\\ \mathbf{if}\;y \leq -2 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-187}:\\ \;\;\;\;x + \frac{y \cdot z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error1.2
Cost968
\[\begin{array}{l} t_1 := x + y \cdot \frac{z - t}{a - t}\\ \mathbf{if}\;y \leq -2.85 \cdot 10^{-204}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-187}:\\ \;\;\;\;x + \frac{\frac{y}{\frac{1}{z}}}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error11.4
Cost840
\[\begin{array}{l} t_1 := x + t \cdot \frac{y}{t - a}\\ \mathbf{if}\;t \leq -2.45 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 9 \cdot 10^{-92}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error9.5
Cost840
\[\begin{array}{l} t_1 := x + t \cdot \frac{y}{t - a}\\ \mathbf{if}\;t \leq -3.1 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{-93}:\\ \;\;\;\;x + y \cdot \frac{z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error14.1
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -3.8 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 8.8 \cdot 10^{-57}:\\ \;\;\;\;x + y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 13
Error14.3
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -2.12 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{-58}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 14
Error20.1
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -9.2 \cdot 10^{-92}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 3.9 \cdot 10^{-109}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 15
Error28.7
Cost64
\[x \]

Error

Reproduce?

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

  :herbie-target
  (if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))

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