?

Average Error: 10.9 → 0.6
Time: 20.3s
Precision: binary64
Cost: 1096

?

\[x + \frac{y \cdot \left(z - t\right)}{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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $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 + \frac{y \cdot \left(z - t\right)}{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

Original10.9
Target1.2
Herbie0.6
\[x + \frac{y}{\frac{a - t}{z - t}} \]

Derivation?

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

    1. Initial program 17.0

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

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

      [Start]17.0

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

      rational.json-simplify-2 [=>]17.0

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

      rational.json-simplify-49 [=>]0.6

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

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

    1. Initial program 0.4

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

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

      [Start]0.4

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

      rational.json-simplify-2 [=>]0.4

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

      rational.json-simplify-49 [=>]2.6

      \[ x + \color{blue}{y \cdot \frac{z - t}{a - t}} \]
    3. 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.9
Cost1300
\[\begin{array}{l} t_1 := x + y \cdot \frac{z}{a - t}\\ t_2 := x + y \cdot \frac{t}{t - a}\\ \mathbf{if}\;t \leq -6 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 220000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.95 \cdot 10^{+84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.3 \cdot 10^{+131}:\\ \;\;\;\;x + \frac{z - t}{-\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error8.9
Cost1236
\[\begin{array}{l} t_1 := x + y \cdot \frac{z}{a - t}\\ t_2 := x + y \cdot \frac{t}{t - a}\\ \mathbf{if}\;t \leq -6.4 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 4 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 20000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 4.9 \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
Error11.0
Cost1104
\[\begin{array}{l} t_1 := x + y \cdot \frac{t}{t - a}\\ \mathbf{if}\;t \leq -350000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-78}:\\ \;\;\;\;x + \frac{-z}{\frac{t}{y}}\\ \mathbf{elif}\;t \leq -3.2 \cdot 10^{-121}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-89}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error1.3
Cost968
\[\begin{array}{l} t_1 := x + y \cdot \frac{z - t}{a - t}\\ \mathbf{if}\;y \leq -6 \cdot 10^{-205}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-187}:\\ \;\;\;\;x + \frac{y \cdot z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error0.6
Cost968
\[\begin{array}{l} t_1 := x + y \cdot \frac{z - t}{a - t}\\ \mathbf{if}\;y \leq -5 \cdot 10^{-94}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-101}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a - t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error8.4
Cost840
\[\begin{array}{l} t_1 := x + y \cdot \frac{t}{t - a}\\ \mathbf{if}\;t \leq -3.5 \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 7
Error14.1
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -2.3 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.75 \cdot 10^{-59}:\\ \;\;\;\;x + y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 8
Error14.3
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -2.6 \cdot 10^{-26}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{-58}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 9
Error20.1
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -8.5 \cdot 10^{-93}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-110}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 10
Error28.7
Cost64
\[x \]

Error

Reproduce?

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

  :herbie-target
  (+ x (/ y (/ (- a t) (- z t))))

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