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

Percentage Accurate: 93.4% → 96.3%
Time: 8.0s
Alternatives: 9
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 9 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.4% 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.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.7 \cdot 10^{-46}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < 2.7e-46

    1. Initial program 98.8%

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

    if 2.7e-46 < a

    1. Initial program 90.7%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified98.8%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 75.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{+175}:\\ \;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\ \mathbf{elif}\;t \leq -1.1 \cdot 10^{+96} \lor \neg \left(t \leq -1.75 \cdot 10^{+42}\right) \land t \leq 9 \cdot 10^{+183}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{-a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t -5.8e+175)
   (/ (* t (- y)) a)
   (if (or (<= t -1.1e+96) (and (not (<= t -1.75e+42)) (<= t 9e+183)))
     (+ x (* z (/ y a)))
     (* t (/ y (- a))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -5.8e+175) {
		tmp = (t * -y) / a;
	} else if ((t <= -1.1e+96) || (!(t <= -1.75e+42) && (t <= 9e+183))) {
		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 <= (-5.8d+175)) then
        tmp = (t * -y) / a
    else if ((t <= (-1.1d+96)) .or. (.not. (t <= (-1.75d+42))) .and. (t <= 9d+183)) 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 <= -5.8e+175) {
		tmp = (t * -y) / a;
	} else if ((t <= -1.1e+96) || (!(t <= -1.75e+42) && (t <= 9e+183))) {
		tmp = x + (z * (y / a));
	} else {
		tmp = t * (y / -a);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= -5.8e+175:
		tmp = (t * -y) / a
	elif (t <= -1.1e+96) or (not (t <= -1.75e+42) and (t <= 9e+183)):
		tmp = x + (z * (y / a))
	else:
		tmp = t * (y / -a)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= -5.8e+175)
		tmp = Float64(Float64(t * Float64(-y)) / a);
	elseif ((t <= -1.1e+96) || (!(t <= -1.75e+42) && (t <= 9e+183)))
		tmp = Float64(x + Float64(z * Float64(y / a)));
	else
		tmp = Float64(t * Float64(y / Float64(-a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= -5.8e+175)
		tmp = (t * -y) / a;
	elseif ((t <= -1.1e+96) || (~((t <= -1.75e+42)) && (t <= 9e+183)))
		tmp = x + (z * (y / a));
	else
		tmp = t * (y / -a);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.8e+175], N[(N[(t * (-y)), $MachinePrecision] / a), $MachinePrecision], If[Or[LessEqual[t, -1.1e+96], And[N[Not[LessEqual[t, -1.75e+42]], $MachinePrecision], LessEqual[t, 9e+183]]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{+175}:\\
\;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\

\mathbf{elif}\;t \leq -1.1 \cdot 10^{+96} \lor \neg \left(t \leq -1.75 \cdot 10^{+42}\right) \land t \leq 9 \cdot 10^{+183}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.8e175

    1. Initial program 99.8%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified89.5%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 94.5%

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

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

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

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

        \[\leadsto x - \color{blue}{y \cdot \frac{t}{a}} \]
    7. Simplified85.8%

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot \frac{y}{-a}} \]
    12. Step-by-step derivation
      1. *-commutative82.2%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(-y\right) \cdot t}{a}} \]
    13. Applied egg-rr87.1%

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

    if -5.8e175 < t < -1.0999999999999999e96 or -1.75000000000000012e42 < t < 9.00000000000000034e183

    1. Initial program 96.9%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified94.2%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 96.9%

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    9. Step-by-step derivation
      1. associate-*l/83.5%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot z} \]
      2. *-commutative83.5%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    10. Simplified83.5%

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

    if -1.0999999999999999e96 < t < -1.75000000000000012e42 or 9.00000000000000034e183 < t

    1. Initial program 91.9%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified89.2%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 89.7%

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

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

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. *-commutative89.7%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{t}{a}} \]
    7. Simplified84.2%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    10. Step-by-step derivation
      1. mul-1-neg65.4%

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

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

        \[\leadsto \color{blue}{t \cdot \frac{y}{-a}} \]
    11. Simplified67.7%

      \[\leadsto \color{blue}{t \cdot \frac{y}{-a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{+175}:\\ \;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\ \mathbf{elif}\;t \leq -1.1 \cdot 10^{+96} \lor \neg \left(t \leq -1.75 \cdot 10^{+42}\right) \land t \leq 9 \cdot 10^{+183}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{-a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 85.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.05 \cdot 10^{+39} \lor \neg \left(t \leq 2 \cdot 10^{-52}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.05000000000000002e39 or 2e-52 < t

    1. Initial program 96.1%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified92.5%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 96.1%

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

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

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

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    9. Step-by-step derivation
      1. associate-*r/87.7%

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

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

        \[\leadsto x + \color{blue}{\left(-t\right)} \cdot \frac{y}{a} \]
      4. cancel-sign-sub-inv87.7%

        \[\leadsto \color{blue}{x - t \cdot \frac{y}{a}} \]
    10. Simplified87.7%

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

    if -2.05000000000000002e39 < t < 2e-52

    1. Initial program 97.0%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified93.5%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 97.0%

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    9. Step-by-step derivation
      1. associate-*l/91.7%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot z} \]
      2. *-commutative91.7%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    10. Simplified91.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.05 \cdot 10^{+39} \lor \neg \left(t \leq 2 \cdot 10^{-52}\right):\\ \;\;\;\;x - t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.4% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;t \leq 3.05 \cdot 10^{-52}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.1999999999999999e36

    1. Initial program 97.8%

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

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

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 91.8%

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

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

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. *-commutative91.8%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{t}{a}} \]
    7. Simplified83.5%

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

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

    if -6.1999999999999999e36 < t < 3.04999999999999995e-52

    1. Initial program 97.0%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified93.5%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 97.0%

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

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

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

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{a}} \]
    9. Step-by-step derivation
      1. associate-*l/91.7%

        \[\leadsto x + \color{blue}{\frac{y}{a} \cdot z} \]
      2. *-commutative91.7%

        \[\leadsto x + \color{blue}{z \cdot \frac{y}{a}} \]
    10. Simplified91.7%

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

    if 3.04999999999999995e-52 < t

    1. Initial program 95.0%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified93.7%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 95.0%

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

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

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

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

      \[\leadsto \color{blue}{x + -1 \cdot \frac{t \cdot y}{a}} \]
    9. Step-by-step derivation
      1. associate-*r/86.7%

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

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

        \[\leadsto x + \color{blue}{\left(-t\right)} \cdot \frac{y}{a} \]
      4. cancel-sign-sub-inv86.7%

        \[\leadsto \color{blue}{x - t \cdot \frac{y}{a}} \]
    10. Simplified86.7%

      \[\leadsto \color{blue}{x - t \cdot \frac{y}{a}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification90.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{+36}:\\ \;\;\;\;x - \frac{y \cdot t}{a}\\ \mathbf{elif}\;t \leq 3.05 \cdot 10^{-52}:\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x - t \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 51.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.4 \cdot 10^{+41} \lor \neg \left(t \leq 2.4 \cdot 10^{+95}\right):\\
\;\;\;\;t \cdot \frac{y}{-a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.3999999999999998e41 or 2.4e95 < t

    1. Initial program 95.2%

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

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

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 88.0%

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

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

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. *-commutative88.0%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{t}{a}} \]
    7. Simplified82.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    10. Step-by-step derivation
      1. mul-1-neg64.2%

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

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

        \[\leadsto \color{blue}{t \cdot \frac{y}{-a}} \]
    11. Simplified63.7%

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

    if -8.3999999999999998e41 < t < 2.4e95

    1. Initial program 97.5%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified93.9%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 50.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8.4 \cdot 10^{+41} \lor \neg \left(t \leq 2.4 \cdot 10^{+95}\right):\\ \;\;\;\;t \cdot \frac{y}{-a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 50.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+38}:\\
\;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\

\mathbf{elif}\;t \leq 1.7 \cdot 10^{+95}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.1e38

    1. Initial program 97.8%

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

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

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 91.8%

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

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

        \[\leadsto \color{blue}{x - \frac{t \cdot y}{a}} \]
      3. *-commutative91.8%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{t}{a}} \]
    7. Simplified83.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{a}} \]
    10. Step-by-step derivation
      1. mul-1-neg71.6%

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

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

        \[\leadsto \color{blue}{t \cdot \frac{y}{-a}} \]
    11. Simplified69.0%

      \[\leadsto \color{blue}{t \cdot \frac{y}{-a}} \]
    12. Step-by-step derivation
      1. *-commutative69.0%

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

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

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

        \[\leadsto \color{blue}{\frac{\left(-y\right) \cdot t}{a}} \]
    13. Applied egg-rr71.6%

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

    if -2.1e38 < t < 1.70000000000000011e95

    1. Initial program 97.5%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified93.9%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 50.4%

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

    if 1.70000000000000011e95 < t

    1. Initial program 92.7%

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified92.5%

      \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 84.3%

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

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

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

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

        \[\leadsto x - \color{blue}{y \cdot \frac{t}{a}} \]
    7. Simplified80.5%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{+38}:\\ \;\;\;\;\frac{t \cdot \left(-y\right)}{a}\\ \mathbf{elif}\;t \leq 1.7 \cdot 10^{+95}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{-a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 97.5% 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 96.6%

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

      \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
  3. Simplified93.0%

    \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 96.6%

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

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

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

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

Alternative 8: 93.3% accurate, 1.0× speedup?

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

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

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

      \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
  3. Simplified93.0%

    \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 9: 39.5% 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 96.6%

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

      \[\leadsto x + \color{blue}{y \cdot \frac{z - t}{a}} \]
  3. Simplified93.0%

    \[\leadsto \color{blue}{x + y \cdot \frac{z - t}{a}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around inf 41.2%

    \[\leadsto \color{blue}{x} \]
  6. Add Preprocessing

Developer target: 99.2% accurate, 0.5× 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 2024087 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :precision binary64

  :alt
  (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)))