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

Percentage Accurate: 93.2% → 93.7%
Time: 9.9s
Alternatives: 11
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 11 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.2% 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: 93.7% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.50000000000000005e-170 or 2.7e-194 < a

    1. Initial program 90.0%

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

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

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

    if -2.50000000000000005e-170 < a < 2.7e-194

    1. Initial program 98.2%

      \[x - \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. sub-neg98.2%

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{-a} + x} \]
      4. associate-/l*74.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{-a}, x\right)} \]
      6. distribute-frac-neg274.7%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\frac{z - t}{a}}, x\right) \]
      7. distribute-neg-frac74.7%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{-\left(z - t\right)}{a}}, x\right) \]
      8. sub-neg74.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{-\color{blue}{\left(z + \left(-t\right)\right)}}{a}, x\right) \]
      9. distribute-neg-in74.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\left(-z\right) + \left(-\left(-t\right)\right)}}{a}, x\right) \]
      10. remove-double-neg74.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\left(-z\right) + \color{blue}{t}}{a}, x\right) \]
      11. +-commutative74.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t + \left(-z\right)}}{a}, x\right) \]
      12. sub-neg74.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t - z}}{a}, x\right) \]
    3. Simplified74.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - z}{a}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around -inf 96.7%

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

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

Alternative 2: 82.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-40} \lor \neg \left(t \leq 1.95 \cdot 10^{+27}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.8e-40 or 1.9499999999999999e27 < t

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto x - \left(-\color{blue}{t \cdot \frac{y}{a}}\right) \]
      3. distribute-rgt-neg-in86.3%

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

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

        \[\leadsto x - \color{blue}{\frac{-y}{a}} \cdot t \]
      6. associate-/r/82.1%

        \[\leadsto x - \color{blue}{\frac{-y}{\frac{a}{t}}} \]
    10. Simplified82.1%

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

    if -2.8e-40 < t < 1.9499999999999999e27

    1. Initial program 95.2%

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

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

      \[\leadsto \color{blue}{x - y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num95.3%

        \[\leadsto x - y \cdot \color{blue}{\frac{1}{\frac{a}{z - t}}} \]
      2. un-div-inv96.1%

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

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

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

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

Alternative 3: 82.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-40} \lor \neg \left(t \leq 2.4 \cdot 10^{+28}\right):\\
\;\;\;\;x + \frac{t \cdot y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.7e-40 or 2.39999999999999981e28 < t

    1. Initial program 88.9%

      \[x - \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. sub-neg88.9%

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{-a} + x} \]
      4. associate-/l*88.7%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{-a}, x\right)} \]
      6. distribute-frac-neg288.7%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\frac{z - t}{a}}, x\right) \]
      7. distribute-neg-frac88.7%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{-\left(z - t\right)}{a}}, x\right) \]
      8. sub-neg88.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{-\color{blue}{\left(z + \left(-t\right)\right)}}{a}, x\right) \]
      9. distribute-neg-in88.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\left(-z\right) + \left(-\left(-t\right)\right)}}{a}, x\right) \]
      10. remove-double-neg88.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\left(-z\right) + \color{blue}{t}}{a}, x\right) \]
      11. +-commutative88.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t + \left(-z\right)}}{a}, x\right) \]
      12. sub-neg88.7%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t - z}}{a}, x\right) \]
    3. Simplified88.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - z}{a}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 81.1%

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

    if -2.7e-40 < t < 2.39999999999999981e28

    1. Initial program 95.2%

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

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

      \[\leadsto \color{blue}{x - y \cdot \frac{z - t}{a}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-num95.3%

        \[\leadsto x - y \cdot \color{blue}{\frac{1}{\frac{a}{z - t}}} \]
      2. un-div-inv96.1%

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

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

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

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

Alternative 4: 75.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{-170} \lor \neg \left(a \leq 3.7 \cdot 10^{-131}\right):\\
\;\;\;\;x + y \cdot \frac{t}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.50000000000000005e-170 or 3.7000000000000002e-131 < a

    1. Initial program 89.4%

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

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

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

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

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

      \[\leadsto x - y \cdot \frac{\color{blue}{-t}}{a} \]
    8. Step-by-step derivation
      1. cancel-sign-sub-inv78.7%

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

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

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

        \[\leadsto x + \left(-\color{blue}{\frac{\left(-t\right) \cdot y}{a}}\right) \]
      5. distribute-lft-neg-in75.5%

        \[\leadsto x + \left(-\frac{\color{blue}{-t \cdot y}}{a}\right) \]
      6. distribute-frac-neg275.5%

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

        \[\leadsto x + \color{blue}{\frac{t \cdot y}{a}} \]
      8. +-commutative75.5%

        \[\leadsto \color{blue}{\frac{t \cdot y}{a} + x} \]
      9. div-inv75.5%

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

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

        \[\leadsto \color{blue}{y \cdot \left(t \cdot \frac{1}{a}\right)} + x \]
      12. div-inv78.7%

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

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

    if -2.50000000000000005e-170 < a < 3.7000000000000002e-131

    1. Initial program 98.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-out--58.9%

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

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

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

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

        \[\leadsto \frac{y}{a} \cdot t - \color{blue}{\frac{y}{a} \cdot z} \]
      6. distribute-lft-out--89.1%

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

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

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

Alternative 5: 73.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.5 \cdot 10^{-170} \lor \neg \left(a \leq 8.5 \cdot 10^{-140}\right):\\
\;\;\;\;x + \frac{t \cdot y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.50000000000000005e-170 or 8.49999999999999997e-140 < a

    1. Initial program 89.5%

      \[x - \frac{y \cdot \left(z - t\right)}{a} \]
    2. Step-by-step derivation
      1. sub-neg89.5%

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

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

        \[\leadsto \color{blue}{\frac{y \cdot \left(z - t\right)}{-a} + x} \]
      4. associate-/l*96.8%

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{z - t}{-a}, x\right)} \]
      6. distribute-frac-neg296.8%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{-\frac{z - t}{a}}, x\right) \]
      7. distribute-neg-frac96.8%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{-\left(z - t\right)}{a}}, x\right) \]
      8. sub-neg96.8%

        \[\leadsto \mathsf{fma}\left(y, \frac{-\color{blue}{\left(z + \left(-t\right)\right)}}{a}, x\right) \]
      9. distribute-neg-in96.8%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{\left(-z\right) + \left(-\left(-t\right)\right)}}{a}, x\right) \]
      10. remove-double-neg96.8%

        \[\leadsto \mathsf{fma}\left(y, \frac{\left(-z\right) + \color{blue}{t}}{a}, x\right) \]
      11. +-commutative96.8%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t + \left(-z\right)}}{a}, x\right) \]
      12. sub-neg96.8%

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{t - z}}{a}, x\right) \]
    3. Simplified96.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{t - z}{a}, x\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 75.8%

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

    if -2.50000000000000005e-170 < a < 8.49999999999999997e-140

    1. Initial program 98.5%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified78.1%

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-out--59.2%

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

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

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

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

        \[\leadsto \frac{y}{a} \cdot t - \color{blue}{\frac{y}{a} \cdot z} \]
      6. distribute-lft-out--90.3%

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

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

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

Alternative 6: 69.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+80}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 7.6 \cdot 10^{+103}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -6.4999999999999998e80 or 7.5999999999999994e103 < a

    1. Initial program 85.2%

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

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

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

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

    if -6.4999999999999998e80 < a < 7.5999999999999994e103

    1. Initial program 95.1%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)} \]
    9. Step-by-step derivation
      1. distribute-lft-out--60.7%

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

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

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

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

        \[\leadsto \frac{y}{a} \cdot t - \color{blue}{\frac{y}{a} \cdot z} \]
      6. distribute-lft-out--73.8%

        \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(t - z\right)} \]
    10. Simplified73.8%

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

Alternative 7: 65.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.5 \cdot 10^{+80}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -5.49999999999999967e80 or 6.19999999999999973e102 < a

    1. Initial program 85.2%

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

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

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

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

    if -5.49999999999999967e80 < a < 6.19999999999999973e102

    1. Initial program 95.1%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot \left(z - t\right)}{a}} \]
    6. Step-by-step derivation
      1. mul-1-neg71.9%

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

        \[\leadsto \color{blue}{\frac{-y \cdot \left(z - t\right)}{a}} \]
      3. distribute-rgt-neg-in71.9%

        \[\leadsto \frac{\color{blue}{y \cdot \left(-\left(z - t\right)\right)}}{a} \]
      4. sub-neg71.9%

        \[\leadsto \frac{y \cdot \left(-\color{blue}{\left(z + \left(-t\right)\right)}\right)}{a} \]
      5. distribute-neg-in71.9%

        \[\leadsto \frac{y \cdot \color{blue}{\left(\left(-z\right) + \left(-\left(-t\right)\right)\right)}}{a} \]
      6. remove-double-neg71.9%

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

        \[\leadsto \frac{y \cdot \color{blue}{\left(t + \left(-z\right)\right)}}{a} \]
      8. sub-neg71.9%

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

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

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

Alternative 8: 50.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{-23}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.2000000000000002e-23 or 1.39999999999999992e-9 < a

    1. Initial program 84.7%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified99.1%

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

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

    if -4.2000000000000002e-23 < a < 1.39999999999999992e-9

    1. Initial program 99.2%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified84.4%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot t} \]
    7. Applied egg-rr51.6%

      \[\leadsto \color{blue}{\frac{y}{a} \cdot t} \]
    8. Step-by-step derivation
      1. *-commutative51.6%

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

        \[\leadsto t \cdot \color{blue}{\frac{1}{\frac{a}{y}}} \]
      3. un-div-inv51.8%

        \[\leadsto \color{blue}{\frac{t}{\frac{a}{y}}} \]
    9. Applied egg-rr51.8%

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

Alternative 9: 50.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.25 \cdot 10^{-26}:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 1.35 \cdot 10^{-8}:\\
\;\;\;\;t \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.2499999999999999e-26 or 1.35000000000000001e-8 < a

    1. Initial program 84.7%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified99.1%

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

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

    if -2.2499999999999999e-26 < a < 1.35000000000000001e-8

    1. Initial program 99.2%

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

        \[\leadsto x - \color{blue}{y \cdot \frac{z - t}{a}} \]
    3. Simplified84.4%

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

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

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} \]
    7. Simplified51.6%

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

Alternative 10: 97.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 11: 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 91.9%

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

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

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

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

Developer Target 1: 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 2024144 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t)))))))

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