Average Error: 11.1 → 17.3
Time: 5.2s
Precision: binary64
Cost: 976
\[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
\[\begin{array}{l} t_1 := x + \frac{t}{\frac{a}{y}}\\ \mathbf{if}\;a \leq -1.2587048728210297 \cdot 10^{+73}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3072121097693.241:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 9.19233818797568 \cdot 10^{+263}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.0133670706392526 \cdot 10^{+295}:\\ \;\;\;\;\frac{t}{1 - \frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (/ t (/ a y)))))
   (if (<= a -1.2587048728210297e+73)
     t_1
     (if (<= a 3072121097693.241)
       (+ x t)
       (if (<= a 9.19233818797568e+263)
         t_1
         (if (<= a 1.0133670706392526e+295) (/ t (- 1.0 (/ a z))) x))))))
double code(double x, double y, double z, double t, double a) {
	return x + (((y - z) * t) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t / (a / y));
	double tmp;
	if (a <= -1.2587048728210297e+73) {
		tmp = t_1;
	} else if (a <= 3072121097693.241) {
		tmp = x + t;
	} else if (a <= 9.19233818797568e+263) {
		tmp = t_1;
	} else if (a <= 1.0133670706392526e+295) {
		tmp = t / (1.0 - (a / z));
	} else {
		tmp = x;
	}
	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 - z))
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 + (t / (a / y))
    if (a <= (-1.2587048728210297d+73)) then
        tmp = t_1
    else if (a <= 3072121097693.241d0) then
        tmp = x + t
    else if (a <= 9.19233818797568d+263) then
        tmp = t_1
    else if (a <= 1.0133670706392526d+295) then
        tmp = t / (1.0d0 - (a / z))
    else
        tmp = x
    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 - z));
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t / (a / y));
	double tmp;
	if (a <= -1.2587048728210297e+73) {
		tmp = t_1;
	} else if (a <= 3072121097693.241) {
		tmp = x + t;
	} else if (a <= 9.19233818797568e+263) {
		tmp = t_1;
	} else if (a <= 1.0133670706392526e+295) {
		tmp = t / (1.0 - (a / z));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	return x + (((y - z) * t) / (a - z))
def code(x, y, z, t, a):
	t_1 = x + (t / (a / y))
	tmp = 0
	if a <= -1.2587048728210297e+73:
		tmp = t_1
	elif a <= 3072121097693.241:
		tmp = x + t
	elif a <= 9.19233818797568e+263:
		tmp = t_1
	elif a <= 1.0133670706392526e+295:
		tmp = t / (1.0 - (a / z))
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z)))
end
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(t / Float64(a / y)))
	tmp = 0.0
	if (a <= -1.2587048728210297e+73)
		tmp = t_1;
	elseif (a <= 3072121097693.241)
		tmp = Float64(x + t);
	elseif (a <= 9.19233818797568e+263)
		tmp = t_1;
	elseif (a <= 1.0133670706392526e+295)
		tmp = Float64(t / Float64(1.0 - Float64(a / z)));
	else
		tmp = x;
	end
	return tmp
end
function tmp = code(x, y, z, t, a)
	tmp = x + (((y - z) * t) / (a - z));
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (t / (a / y));
	tmp = 0.0;
	if (a <= -1.2587048728210297e+73)
		tmp = t_1;
	elseif (a <= 3072121097693.241)
		tmp = x + t;
	elseif (a <= 9.19233818797568e+263)
		tmp = t_1;
	elseif (a <= 1.0133670706392526e+295)
		tmp = t / (1.0 - (a / z));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.2587048728210297e+73], t$95$1, If[LessEqual[a, 3072121097693.241], N[(x + t), $MachinePrecision], If[LessEqual[a, 9.19233818797568e+263], t$95$1, If[LessEqual[a, 1.0133670706392526e+295], N[(t / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]]]]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
t_1 := x + \frac{t}{\frac{a}{y}}\\
\mathbf{if}\;a \leq -1.2587048728210297 \cdot 10^{+73}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 3072121097693.241:\\
\;\;\;\;x + t\\

\mathbf{elif}\;a \leq 9.19233818797568 \cdot 10^{+263}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 1.0133670706392526 \cdot 10^{+295}:\\
\;\;\;\;\frac{t}{1 - \frac{a}{z}}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.1
Target0.5
Herbie17.3
\[\begin{array}{l} \mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array} \]

Derivation

  1. Split input into 4 regimes
  2. if a < -1.2587048728210297e73 or 3072121097693.2412 < a < 9.1923381879756797e263

    1. Initial program 12.3

      \[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
    2. Taylor expanded in z around 0 19.2

      \[\leadsto x + \color{blue}{\frac{y \cdot t}{a}} \]
    3. Simplified15.3

      \[\leadsto x + \color{blue}{\frac{t}{a} \cdot y} \]
    4. Applied egg-rr14.6

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

    if -1.2587048728210297e73 < a < 3072121097693.2412

    1. Initial program 10.0

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)} \]
    3. Taylor expanded in z around inf 17.6

      \[\leadsto \color{blue}{t + x} \]

    if 9.1923381879756797e263 < a < 1.0133670706392526e295

    1. Initial program 10.8

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, \frac{t}{a - z}, x\right)} \]
    3. Taylor expanded in t around inf 46.1

      \[\leadsto \color{blue}{t \cdot \left(\frac{y}{a - z} - \frac{z}{a - z}\right)} \]
    4. Simplified46.3

      \[\leadsto \color{blue}{\frac{t}{\frac{a - z}{y - z}}} \]
    5. Taylor expanded in y around 0 53.6

      \[\leadsto \frac{t}{\color{blue}{-1 \cdot \frac{a - z}{z}}} \]
    6. Simplified53.6

      \[\leadsto \frac{t}{\color{blue}{1 - \frac{a}{z}}} \]

    if 1.0133670706392526e295 < a

    1. Initial program 18.5

      \[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
    2. Taylor expanded in z around 0 15.8

      \[\leadsto x + \color{blue}{\frac{y \cdot t}{a}} \]
    3. Simplified7.6

      \[\leadsto x + \color{blue}{\frac{t}{a} \cdot y} \]
    4. Applied egg-rr6.7

      \[\leadsto x + \color{blue}{\frac{t}{\frac{a}{y}}} \]
    5. Taylor expanded in x around inf 14.0

      \[\leadsto \color{blue}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification17.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.2587048728210297 \cdot 10^{+73}:\\ \;\;\;\;x + \frac{t}{\frac{a}{y}}\\ \mathbf{elif}\;a \leq 3072121097693.241:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 9.19233818797568 \cdot 10^{+263}:\\ \;\;\;\;x + \frac{t}{\frac{a}{y}}\\ \mathbf{elif}\;a \leq 1.0133670706392526 \cdot 10^{+295}:\\ \;\;\;\;\frac{t}{1 - \frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternatives

Alternative 1
Error21.4
Cost844
\[\begin{array}{l} \mathbf{if}\;a \leq -2.833305028450987 \cdot 10^{+129}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 9.19233818797568 \cdot 10^{+263}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 1.0133670706392526 \cdot 10^{+295}:\\ \;\;\;\;\frac{t}{1 - \frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error21.4
Cost780
\[\begin{array}{l} \mathbf{if}\;a \leq -2.833305028450987 \cdot 10^{+129}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 9.19233818797568 \cdot 10^{+263}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;a \leq 1.0133670706392526 \cdot 10^{+295}:\\ \;\;\;\;t \cdot \frac{-z}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error19.3
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -1.8733572384770914 \cdot 10^{-71}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 6045291524358315:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 4
Error26.4
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -8.8952717139431 \cdot 10^{-228}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 5.410168044199416 \cdot 10^{-169}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error51.1
Cost64
\[t \]

Error

Reproduce

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

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

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