Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E

Percentage Accurate: 93.5% → 96.9%
Time: 9.4s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ x + \frac{y \cdot \left(z - t\right)}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
	return x + ((y * (z - t)) / a);
}
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)
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a):
	return x + ((y * (z - t)) / a)
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y * Float64(z - t)) / a))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y * (z - t)) / a);
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 93.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y \cdot \left(z - t\right)}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
	return x + ((y * (z - t)) / a);
}
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)
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a):
	return x + ((y * (z - t)) / a)
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(y * Float64(z - t)) / a))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((y * (z - t)) / a);
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 96.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{z - t}{\frac{a}{y}} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
	return x + ((z - t) / (a / y));
}
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 + ((z - t) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a):
	return x + ((z - t) / (a / y))
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(z - t) / Float64(a / y)))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((z - t) / (a / y));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Derivation
  1. Initial program 92.9%

    \[x + \frac{y \cdot \left(z - t\right)}{a} \]
  2. Step-by-step derivation
    1. associate-*l/96.5%

      \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
  3. Simplified96.5%

    \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
  4. Step-by-step derivation
    1. *-commutative96.5%

      \[\leadsto x + \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    2. clear-num96.5%

      \[\leadsto x + \left(z - t\right) \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
    3. un-div-inv96.9%

      \[\leadsto x + \color{blue}{\frac{z - t}{\frac{a}{y}}} \]
  5. Applied egg-rr96.9%

    \[\leadsto x + \color{blue}{\frac{z - t}{\frac{a}{y}}} \]
  6. Final simplification96.9%

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

Alternative 2: 74.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := x + z \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -1.2 \cdot 10^{+133}:\\
\;\;\;\;\frac{-y}{\frac{a}{t}}\\

\mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 4.1 \cdot 10^{+139}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\

\mathbf{elif}\;t \leq 7.8 \cdot 10^{+242}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.1999999999999999e133

    1. Initial program 84.9%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/97.4%

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

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 84.9%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg84.9%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg84.9%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*94.9%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified94.9%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 66.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*74.4%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/74.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-174.4%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/74.5%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative74.5%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg74.5%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified74.5%

      \[\leadsto \color{blue}{y \cdot \left(-\frac{t}{a}\right)} \]
    10. Step-by-step derivation
      1. distribute-rgt-neg-out74.5%

        \[\leadsto \color{blue}{-y \cdot \frac{t}{a}} \]
      2. clear-num74.4%

        \[\leadsto -y \cdot \color{blue}{\frac{1}{\frac{a}{t}}} \]
      3. div-inv74.5%

        \[\leadsto -\color{blue}{\frac{y}{\frac{a}{t}}} \]
      4. distribute-neg-frac74.5%

        \[\leadsto \color{blue}{\frac{-y}{\frac{a}{t}}} \]
    11. Applied egg-rr74.5%

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

    if -1.1999999999999999e133 < t < 4.5e108 or 4.1000000000000002e139 < t < 7.8000000000000003e242

    1. Initial program 95.0%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/96.4%

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

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. *-commutative77.1%

        \[\leadsto x + \frac{\color{blue}{z \cdot y}}{a} \]
      2. associate-*r/80.6%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    6. Simplified80.6%

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

    if 4.5e108 < t < 4.1000000000000002e139

    1. Initial program 82.7%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/99.6%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 82.7%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg82.7%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg82.7%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*99.7%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified99.7%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 65.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*82.0%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/82.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-182.0%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/82.3%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative82.3%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg82.3%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified82.3%

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

    if 7.8000000000000003e242 < t

    1. Initial program 93.1%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/92.9%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified92.9%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 93.1%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg93.1%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg93.1%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*92.9%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified92.9%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 86.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*85.8%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/85.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-185.8%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/79.6%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative79.6%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg79.6%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified79.6%

      \[\leadsto \color{blue}{y \cdot \left(-\frac{t}{a}\right)} \]
    10. Step-by-step derivation
      1. distribute-neg-frac79.6%

        \[\leadsto y \cdot \color{blue}{\frac{-t}{a}} \]
      2. associate-*r/86.0%

        \[\leadsto \color{blue}{\frac{y \cdot \left(-t\right)}{a}} \]
    11. Applied egg-rr86.0%

      \[\leadsto \color{blue}{\frac{y \cdot \left(-t\right)}{a}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification80.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.2 \cdot 10^{+133}:\\ \;\;\;\;\frac{-y}{\frac{a}{t}}\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 4.1 \cdot 10^{+139}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{+242}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\ \end{array} \]

Alternative 3: 74.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+133}:\\ \;\;\;\;\frac{-y}{\frac{a}{t}}\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\ \;\;\;\;x + \frac{z}{\frac{a}{y}}\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{+140}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{elif}\;t \leq 4.1 \cdot 10^{+244}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t -1.5e+133)
   (/ (- y) (/ a t))
   (if (<= t 4.5e+108)
     (+ x (/ z (/ a y)))
     (if (<= t 2.8e+140)
       (* y (/ (- t) a))
       (if (<= t 4.1e+244) (+ x (* z (/ y a))) (/ (* t (- y)) a))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -1.5e+133) {
		tmp = -y / (a / t);
	} else if (t <= 4.5e+108) {
		tmp = x + (z / (a / y));
	} else if (t <= 2.8e+140) {
		tmp = y * (-t / a);
	} else if (t <= 4.1e+244) {
		tmp = x + (z * (y / a));
	} else {
		tmp = (t * -y) / a;
	}
	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
    real(8) :: tmp
    if (t <= (-1.5d+133)) then
        tmp = -y / (a / t)
    else if (t <= 4.5d+108) then
        tmp = x + (z / (a / y))
    else if (t <= 2.8d+140) then
        tmp = y * (-t / a)
    else if (t <= 4.1d+244) then
        tmp = x + (z * (y / a))
    else
        tmp = (t * -y) / a
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -1.5e+133) {
		tmp = -y / (a / t);
	} else if (t <= 4.5e+108) {
		tmp = x + (z / (a / y));
	} else if (t <= 2.8e+140) {
		tmp = y * (-t / a);
	} else if (t <= 4.1e+244) {
		tmp = x + (z * (y / a));
	} else {
		tmp = (t * -y) / a;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= -1.5e+133:
		tmp = -y / (a / t)
	elif t <= 4.5e+108:
		tmp = x + (z / (a / y))
	elif t <= 2.8e+140:
		tmp = y * (-t / a)
	elif t <= 4.1e+244:
		tmp = x + (z * (y / a))
	else:
		tmp = (t * -y) / a
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= -1.5e+133)
		tmp = Float64(Float64(-y) / Float64(a / t));
	elseif (t <= 4.5e+108)
		tmp = Float64(x + Float64(z / Float64(a / y)));
	elseif (t <= 2.8e+140)
		tmp = Float64(y * Float64(Float64(-t) / a));
	elseif (t <= 4.1e+244)
		tmp = Float64(x + Float64(z * Float64(y / a)));
	else
		tmp = Float64(Float64(t * Float64(-y)) / a);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= -1.5e+133)
		tmp = -y / (a / t);
	elseif (t <= 4.5e+108)
		tmp = x + (z / (a / y));
	elseif (t <= 2.8e+140)
		tmp = y * (-t / a);
	elseif (t <= 4.1e+244)
		tmp = x + (z * (y / a));
	else
		tmp = (t * -y) / a;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.5e+133], N[((-y) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.5e+108], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+140], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.1e+244], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * (-y)), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+133}:\\
\;\;\;\;\frac{-y}{\frac{a}{t}}\\

\mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\

\mathbf{elif}\;t \leq 2.8 \cdot 10^{+140}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\

\mathbf{elif}\;t \leq 4.1 \cdot 10^{+244}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if t < -1.50000000000000003e133

    1. Initial program 84.9%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/97.4%

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

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 84.9%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg84.9%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg84.9%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*94.9%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified94.9%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 66.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*74.4%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/74.4%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-174.4%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/74.5%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative74.5%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg74.5%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified74.5%

      \[\leadsto \color{blue}{y \cdot \left(-\frac{t}{a}\right)} \]
    10. Step-by-step derivation
      1. distribute-rgt-neg-out74.5%

        \[\leadsto \color{blue}{-y \cdot \frac{t}{a}} \]
      2. clear-num74.4%

        \[\leadsto -y \cdot \color{blue}{\frac{1}{\frac{a}{t}}} \]
      3. div-inv74.5%

        \[\leadsto -\color{blue}{\frac{y}{\frac{a}{t}}} \]
      4. distribute-neg-frac74.5%

        \[\leadsto \color{blue}{\frac{-y}{\frac{a}{t}}} \]
    11. Applied egg-rr74.5%

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

    if -1.50000000000000003e133 < t < 4.5e108

    1. Initial program 95.1%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/96.6%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified96.6%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. *-commutative79.1%

        \[\leadsto x + \frac{\color{blue}{z \cdot y}}{a} \]
      2. associate-*r/82.4%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    6. Simplified82.4%

      \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    7. Step-by-step derivation
      1. clear-num82.4%

        \[\leadsto x + z \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
      2. div-inv82.9%

        \[\leadsto x + \color{blue}{\frac{z}{\frac{a}{y}}} \]
    8. Applied egg-rr82.9%

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

    if 4.5e108 < t < 2.79999999999999983e140

    1. Initial program 82.7%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/99.6%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified99.6%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 82.7%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg82.7%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg82.7%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*99.7%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified99.7%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 65.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*82.0%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/82.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-182.0%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/82.3%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative82.3%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg82.3%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified82.3%

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

    if 2.79999999999999983e140 < t < 4.09999999999999993e244

    1. Initial program 94.4%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/94.7%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified94.7%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. *-commutative57.7%

        \[\leadsto x + \frac{\color{blue}{z \cdot y}}{a} \]
      2. associate-*r/63.0%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    6. Simplified63.0%

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

    if 4.09999999999999993e244 < t

    1. Initial program 93.1%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/92.9%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified92.9%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 93.1%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg93.1%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg93.1%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*92.9%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified92.9%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 86.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*85.8%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/85.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-185.8%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/79.6%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative79.6%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg79.6%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified79.6%

      \[\leadsto \color{blue}{y \cdot \left(-\frac{t}{a}\right)} \]
    10. Step-by-step derivation
      1. distribute-neg-frac79.6%

        \[\leadsto y \cdot \color{blue}{\frac{-t}{a}} \]
      2. associate-*r/86.0%

        \[\leadsto \color{blue}{\frac{y \cdot \left(-t\right)}{a}} \]
    11. Applied egg-rr86.0%

      \[\leadsto \color{blue}{\frac{y \cdot \left(-t\right)}{a}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification80.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+133}:\\ \;\;\;\;\frac{-y}{\frac{a}{t}}\\ \mathbf{elif}\;t \leq 4.5 \cdot 10^{+108}:\\ \;\;\;\;x + \frac{z}{\frac{a}{y}}\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{+140}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{elif}\;t \leq 4.1 \cdot 10^{+244}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\ \end{array} \]

Alternative 4: 85.1% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -880000000000:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\

\mathbf{elif}\;z \leq 6.2 \cdot 10^{-29}:\\
\;\;\;\;x - \frac{t}{\frac{a}{y}}\\

\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.8e11

    1. Initial program 94.3%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/94.1%

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

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. *-commutative83.0%

        \[\leadsto x + \frac{\color{blue}{z \cdot y}}{a} \]
      2. associate-*r/84.3%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    6. Simplified84.3%

      \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    7. Step-by-step derivation
      1. clear-num84.3%

        \[\leadsto x + z \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
      2. div-inv84.4%

        \[\leadsto x + \color{blue}{\frac{z}{\frac{a}{y}}} \]
    8. Applied egg-rr84.4%

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

    if -8.8e11 < z < 6.20000000000000052e-29

    1. Initial program 95.5%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/95.3%

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

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 90.9%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg90.9%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg90.9%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*91.7%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified91.7%

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

    if 6.20000000000000052e-29 < z

    1. Initial program 88.7%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/99.8%

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

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. *-commutative77.6%

        \[\leadsto x + \frac{\color{blue}{z \cdot y}}{a} \]
      2. associate-*r/84.3%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    6. Simplified84.3%

      \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification87.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -880000000000:\\ \;\;\;\;x + \frac{z}{\frac{a}{y}}\\ \mathbf{elif}\;z \leq 6.2 \cdot 10^{-29}:\\ \;\;\;\;x - \frac{t}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \end{array} \]

Alternative 5: 49.9% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+114} \lor \neg \left(y \leq 5.4\right):\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (or (<= y -1.5e+114) (not (<= y 5.4))) (* y (/ (- t) a)) x))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -1.5e+114) || !(y <= 5.4)) {
		tmp = y * (-t / a);
	} 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
    real(8) :: tmp
    if ((y <= (-1.5d+114)) .or. (.not. (y <= 5.4d0))) then
        tmp = y * (-t / a)
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((y <= -1.5e+114) || !(y <= 5.4)) {
		tmp = y * (-t / a);
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (y <= -1.5e+114) or not (y <= 5.4):
		tmp = y * (-t / a)
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if ((y <= -1.5e+114) || !(y <= 5.4))
		tmp = Float64(y * Float64(Float64(-t) / a));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if ((y <= -1.5e+114) || ~((y <= 5.4)))
		tmp = y * (-t / a);
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.5e+114], N[Not[LessEqual[y, 5.4]], $MachinePrecision]], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+114} \lor \neg \left(y \leq 5.4\right):\\
\;\;\;\;y \cdot \frac{-t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.5e114 or 5.4000000000000004 < y

    1. Initial program 87.5%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/96.5%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified96.5%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 63.3%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg63.3%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg63.3%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*68.3%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified68.3%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 49.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*54.0%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/54.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-154.0%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/54.1%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative54.1%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg54.1%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified54.1%

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

    if -1.5e114 < y < 5.4000000000000004

    1. Initial program 97.3%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/96.5%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified96.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+114} \lor \neg \left(y \leq 5.4\right):\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 6: 50.4% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+51}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\

\mathbf{elif}\;y \leq 600:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.5e51

    1. Initial program 91.4%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/97.9%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified97.9%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 61.1%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg61.1%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg61.1%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*63.3%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified63.3%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 45.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. mul-1-neg45.9%

        \[\leadsto \color{blue}{-\frac{t \cdot y}{a}} \]
      2. associate-*r/48.2%

        \[\leadsto -\color{blue}{t \cdot \frac{y}{a}} \]
      3. distribute-rgt-neg-out48.2%

        \[\leadsto \color{blue}{t \cdot \left(-\frac{y}{a}\right)} \]
      4. distribute-neg-frac48.2%

        \[\leadsto t \cdot \color{blue}{\frac{-y}{a}} \]
      5. associate-*r/45.9%

        \[\leadsto \color{blue}{\frac{t \cdot \left(-y\right)}{a}} \]
      6. associate-/l*46.2%

        \[\leadsto \color{blue}{\frac{t}{\frac{a}{-y}}} \]
    9. Simplified46.2%

      \[\leadsto \color{blue}{\frac{t}{\frac{a}{-y}}} \]
    10. Step-by-step derivation
      1. associate-/l*45.9%

        \[\leadsto \color{blue}{\frac{t \cdot \left(-y\right)}{a}} \]
      2. associate-*r/48.2%

        \[\leadsto \color{blue}{t \cdot \frac{-y}{a}} \]
      3. *-commutative48.2%

        \[\leadsto \color{blue}{\frac{-y}{a} \cdot t} \]
      4. frac-2neg48.2%

        \[\leadsto \color{blue}{\frac{-\left(-y\right)}{-a}} \cdot t \]
      5. remove-double-neg48.2%

        \[\leadsto \frac{\color{blue}{y}}{-a} \cdot t \]
    11. Applied egg-rr48.2%

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

    if -1.5e51 < y < 600

    1. Initial program 98.5%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/96.2%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified96.2%

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

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

    if 600 < y

    1. Initial program 84.4%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. associate-*l/96.2%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    3. Simplified96.2%

      \[\leadsto \color{blue}{x + \frac{y}{a} \cdot \left(z - t\right)} \]
    4. Taylor expanded in z around 0 62.1%

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg62.1%

        \[\leadsto x + \color{blue}{\left(-\frac{t \cdot y}{a}\right)} \]
      2. unsub-neg62.1%

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. associate-/l*69.3%

        \[\leadsto x - \color{blue}{\frac{t}{\frac{a}{y}}} \]
    6. Simplified69.3%

      \[\leadsto \color{blue}{x - \frac{t}{\frac{a}{y}}} \]
    7. Taylor expanded in x around 0 48.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    8. Step-by-step derivation
      1. associate-/l*54.7%

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{a}{y}}} \]
      2. associate-*r/54.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot t}{\frac{a}{y}}} \]
      3. neg-mul-154.7%

        \[\leadsto \frac{\color{blue}{-t}}{\frac{a}{y}} \]
      4. associate-/r/55.0%

        \[\leadsto \color{blue}{\frac{-t}{a} \cdot y} \]
      5. *-commutative55.0%

        \[\leadsto \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-frac-neg55.0%

        \[\leadsto y \cdot \color{blue}{\left(-\frac{t}{a}\right)} \]
    9. Simplified55.0%

      \[\leadsto \color{blue}{y \cdot \left(-\frac{t}{a}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{+51}:\\ \;\;\;\;t \cdot \frac{y}{-a}\\ \mathbf{elif}\;y \leq 600:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \end{array} \]

Alternative 7: 96.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \left(z - t\right) \cdot \frac{y}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
	return x + ((z - t) * (y / a));
}
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 + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a):
	return x + ((z - t) * (y / a))
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(z - t) * Float64(y / a)))
end
function tmp = code(x, y, z, t, a)
	tmp = x + ((z - t) * (y / a));
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Derivation
  1. Initial program 92.9%

    \[x + \frac{y \cdot \left(z - t\right)}{a} \]
  2. Step-by-step derivation
    1. associate-*l/96.5%

      \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
  3. Simplified96.5%

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

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

Alternative 8: 39.8% accurate, 9.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
	return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
	return x;
}
def code(x, y, z, t, a):
	return x
function code(x, y, z, t, a)
	return x
end
function tmp = code(x, y, z, t, a)
	tmp = x;
end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 92.9%

    \[x + \frac{y \cdot \left(z - t\right)}{a} \]
  2. Step-by-step derivation
    1. associate-*l/96.5%

      \[\leadsto x + \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
  3. Simplified96.5%

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification36.4%

    \[\leadsto x \]

Developer target: 99.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t_1}{y}}\\

\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t_1}\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023297 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :precision binary64

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

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