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

Percentage Accurate: 93.1% → 97.4%
Time: 10.8s
Alternatives: 12
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 12 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.1% 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: 97.4% 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 92.1%

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

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

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

    \[\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. Final simplification97.0%

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

Alternative 2: 83.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \frac{y}{a}\\ \mathbf{if}\;t \leq -6.2 \cdot 10^{+137}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{z \cdot y}{a}\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-21}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* t (/ y a)))))
   (if (<= t -6.2e+137)
     t_1
     (if (<= t 3.3e-65)
       (- x (/ (* z y) a))
       (if (<= t 5.2e-21)
         (+ x (/ y (/ a t)))
         (if (<= t 1.8e+16) (- x (* y (/ z a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t * (y / a));
	double tmp;
	if (t <= -6.2e+137) {
		tmp = t_1;
	} else if (t <= 3.3e-65) {
		tmp = x - ((z * y) / a);
	} else if (t <= 5.2e-21) {
		tmp = x + (y / (a / t));
	} else if (t <= 1.8e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (t * (y / a))
    if (t <= (-6.2d+137)) then
        tmp = t_1
    else if (t <= 3.3d-65) then
        tmp = x - ((z * y) / a)
    else if (t <= 5.2d-21) then
        tmp = x + (y / (a / t))
    else if (t <= 1.8d+16) then
        tmp = x - (y * (z / a))
    else
        tmp = 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 = x + (t * (y / a));
	double tmp;
	if (t <= -6.2e+137) {
		tmp = t_1;
	} else if (t <= 3.3e-65) {
		tmp = x - ((z * y) / a);
	} else if (t <= 5.2e-21) {
		tmp = x + (y / (a / t));
	} else if (t <= 1.8e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + (t * (y / a))
	tmp = 0
	if t <= -6.2e+137:
		tmp = t_1
	elif t <= 3.3e-65:
		tmp = x - ((z * y) / a)
	elif t <= 5.2e-21:
		tmp = x + (y / (a / t))
	elif t <= 1.8e+16:
		tmp = x - (y * (z / a))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(t * Float64(y / a)))
	tmp = 0.0
	if (t <= -6.2e+137)
		tmp = t_1;
	elseif (t <= 3.3e-65)
		tmp = Float64(x - Float64(Float64(z * y) / a));
	elseif (t <= 5.2e-21)
		tmp = Float64(x + Float64(y / Float64(a / t)));
	elseif (t <= 1.8e+16)
		tmp = Float64(x - Float64(y * Float64(z / a)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (t * (y / a));
	tmp = 0.0;
	if (t <= -6.2e+137)
		tmp = t_1;
	elseif (t <= 3.3e-65)
		tmp = x - ((z * y) / a);
	elseif (t <= 5.2e-21)
		tmp = x + (y / (a / t));
	elseif (t <= 1.8e+16)
		tmp = x - (y * (z / a));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.2e+137], t$95$1, If[LessEqual[t, 3.3e-65], N[(x - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e-21], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.8e+16], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t \leq 5.2 \cdot 10^{-21}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -6.1999999999999999e137 or 1.8e16 < t

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num97.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified87.6%

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

    if -6.1999999999999999e137 < t < 3.3000000000000001e-65

    1. Initial program 96.5%

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

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

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

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

    if 3.3000000000000001e-65 < t < 5.20000000000000035e-21

    1. Initial program 99.4%

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

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

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

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

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

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

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

        \[\leadsto x - \frac{y}{\color{blue}{\frac{-1 \cdot a}{t}}} \]
      2. neg-mul-199.8%

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

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

    if 5.20000000000000035e-21 < t < 1.8e16

    1. Initial program 87.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{+137}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{z \cdot y}{a}\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-21}:\\ \;\;\;\;x + \frac{y}{\frac{a}{t}}\\ \mathbf{elif}\;t \leq 1.8 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 83.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \frac{y}{a}\\ \mathbf{if}\;t \leq -5.2 \cdot 10^{+138}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{z \cdot y}{a}\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-21}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* t (/ y a)))))
   (if (<= t -5.2e+138)
     t_1
     (if (<= t 2e-65)
       (- x (/ (* z y) a))
       (if (<= t 3.5e-21)
         (+ x (* y (/ t a)))
         (if (<= t 5.5e+16) (- x (* y (/ z a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t * (y / a));
	double tmp;
	if (t <= -5.2e+138) {
		tmp = t_1;
	} else if (t <= 2e-65) {
		tmp = x - ((z * y) / a);
	} else if (t <= 3.5e-21) {
		tmp = x + (y * (t / a));
	} else if (t <= 5.5e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (t * (y / a))
    if (t <= (-5.2d+138)) then
        tmp = t_1
    else if (t <= 2d-65) then
        tmp = x - ((z * y) / a)
    else if (t <= 3.5d-21) then
        tmp = x + (y * (t / a))
    else if (t <= 5.5d+16) then
        tmp = x - (y * (z / a))
    else
        tmp = 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 = x + (t * (y / a));
	double tmp;
	if (t <= -5.2e+138) {
		tmp = t_1;
	} else if (t <= 2e-65) {
		tmp = x - ((z * y) / a);
	} else if (t <= 3.5e-21) {
		tmp = x + (y * (t / a));
	} else if (t <= 5.5e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + (t * (y / a))
	tmp = 0
	if t <= -5.2e+138:
		tmp = t_1
	elif t <= 2e-65:
		tmp = x - ((z * y) / a)
	elif t <= 3.5e-21:
		tmp = x + (y * (t / a))
	elif t <= 5.5e+16:
		tmp = x - (y * (z / a))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(t * Float64(y / a)))
	tmp = 0.0
	if (t <= -5.2e+138)
		tmp = t_1;
	elseif (t <= 2e-65)
		tmp = Float64(x - Float64(Float64(z * y) / a));
	elseif (t <= 3.5e-21)
		tmp = Float64(x + Float64(y * Float64(t / a)));
	elseif (t <= 5.5e+16)
		tmp = Float64(x - Float64(y * Float64(z / a)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (t * (y / a));
	tmp = 0.0;
	if (t <= -5.2e+138)
		tmp = t_1;
	elseif (t <= 2e-65)
		tmp = x - ((z * y) / a);
	elseif (t <= 3.5e-21)
		tmp = x + (y * (t / a));
	elseif (t <= 5.5e+16)
		tmp = x - (y * (z / a));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.2e+138], t$95$1, If[LessEqual[t, 2e-65], N[(x - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e-21], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.5e+16], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + t \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -5.2 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 3.5 \cdot 10^{-21}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -5.2000000000000002e138 or 5.5e16 < t

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num97.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified87.6%

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

    if -5.2000000000000002e138 < t < 1.99999999999999985e-65

    1. Initial program 96.5%

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

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

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

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

    if 1.99999999999999985e-65 < t < 3.5000000000000003e-21

    1. Initial program 99.4%

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{-1 \cdot \left(t \cdot y\right)}{a}} \]
      2. mul-1-neg99.4%

        \[\leadsto x - \frac{\color{blue}{-t \cdot y}}{a} \]
      3. distribute-lft-neg-out99.4%

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

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

        \[\leadsto x - \color{blue}{y \cdot \frac{-t}{a}} \]
      6. distribute-neg-frac99.7%

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

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

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

    if 3.5000000000000003e-21 < t < 5.5e16

    1. Initial program 87.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.2 \cdot 10^{+138}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{z \cdot y}{a}\\ \mathbf{elif}\;t \leq 3.5 \cdot 10^{-21}:\\ \;\;\;\;x + y \cdot \frac{t}{a}\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 83.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \frac{y}{a}\\ \mathbf{if}\;t \leq -6.2 \cdot 10^{+137}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{z \cdot y}{a}\\ \mathbf{elif}\;t \leq 1.9 \cdot 10^{-21}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* t (/ y a)))))
   (if (<= t -6.2e+137)
     t_1
     (if (<= t 1.15e-65)
       (- x (/ (* z y) a))
       (if (<= t 1.9e-21)
         (+ x (/ (* t y) a))
         (if (<= t 2.2e+16) (- x (* y (/ z a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t * (y / a));
	double tmp;
	if (t <= -6.2e+137) {
		tmp = t_1;
	} else if (t <= 1.15e-65) {
		tmp = x - ((z * y) / a);
	} else if (t <= 1.9e-21) {
		tmp = x + ((t * y) / a);
	} else if (t <= 2.2e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (t * (y / a))
    if (t <= (-6.2d+137)) then
        tmp = t_1
    else if (t <= 1.15d-65) then
        tmp = x - ((z * y) / a)
    else if (t <= 1.9d-21) then
        tmp = x + ((t * y) / a)
    else if (t <= 2.2d+16) then
        tmp = x - (y * (z / a))
    else
        tmp = 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 = x + (t * (y / a));
	double tmp;
	if (t <= -6.2e+137) {
		tmp = t_1;
	} else if (t <= 1.15e-65) {
		tmp = x - ((z * y) / a);
	} else if (t <= 1.9e-21) {
		tmp = x + ((t * y) / a);
	} else if (t <= 2.2e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + (t * (y / a))
	tmp = 0
	if t <= -6.2e+137:
		tmp = t_1
	elif t <= 1.15e-65:
		tmp = x - ((z * y) / a)
	elif t <= 1.9e-21:
		tmp = x + ((t * y) / a)
	elif t <= 2.2e+16:
		tmp = x - (y * (z / a))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(t * Float64(y / a)))
	tmp = 0.0
	if (t <= -6.2e+137)
		tmp = t_1;
	elseif (t <= 1.15e-65)
		tmp = Float64(x - Float64(Float64(z * y) / a));
	elseif (t <= 1.9e-21)
		tmp = Float64(x + Float64(Float64(t * y) / a));
	elseif (t <= 2.2e+16)
		tmp = Float64(x - Float64(y * Float64(z / a)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (t * (y / a));
	tmp = 0.0;
	if (t <= -6.2e+137)
		tmp = t_1;
	elseif (t <= 1.15e-65)
		tmp = x - ((z * y) / a);
	elseif (t <= 1.9e-21)
		tmp = x + ((t * y) / a);
	elseif (t <= 2.2e+16)
		tmp = x - (y * (z / a));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.2e+137], t$95$1, If[LessEqual[t, 1.15e-65], N[(x - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e-21], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e+16], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t \leq 1.9 \cdot 10^{-21}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -6.1999999999999999e137 or 2.2e16 < t

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num97.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified87.6%

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

    if -6.1999999999999999e137 < t < 1.15e-65

    1. Initial program 96.5%

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

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

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

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

    if 1.15e-65 < t < 1.8999999999999999e-21

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.8999999999999999e-21 < t < 2.2e16

    1. Initial program 87.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{+137}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{z \cdot y}{a}\\ \mathbf{elif}\;t \leq 1.9 \cdot 10^{-21}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;t \leq 2.2 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \frac{y}{a}\\ \mathbf{if}\;t \leq -1.8 \cdot 10^{+138}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-65}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z}}\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-21}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;t \leq 1.12 \cdot 10^{+16}:\\ \;\;\;\;x - y \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* t (/ y a)))))
   (if (<= t -1.8e+138)
     t_1
     (if (<= t 3.3e-65)
       (- x (/ y (/ a z)))
       (if (<= t 1.65e-21)
         (+ x (/ (* t y) a))
         (if (<= t 1.12e+16) (- x (* y (/ z a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t * (y / a));
	double tmp;
	if (t <= -1.8e+138) {
		tmp = t_1;
	} else if (t <= 3.3e-65) {
		tmp = x - (y / (a / z));
	} else if (t <= 1.65e-21) {
		tmp = x + ((t * y) / a);
	} else if (t <= 1.12e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x + (t * (y / a))
    if (t <= (-1.8d+138)) then
        tmp = t_1
    else if (t <= 3.3d-65) then
        tmp = x - (y / (a / z))
    else if (t <= 1.65d-21) then
        tmp = x + ((t * y) / a)
    else if (t <= 1.12d+16) then
        tmp = x - (y * (z / a))
    else
        tmp = 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 = x + (t * (y / a));
	double tmp;
	if (t <= -1.8e+138) {
		tmp = t_1;
	} else if (t <= 3.3e-65) {
		tmp = x - (y / (a / z));
	} else if (t <= 1.65e-21) {
		tmp = x + ((t * y) / a);
	} else if (t <= 1.12e+16) {
		tmp = x - (y * (z / a));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + (t * (y / a))
	tmp = 0
	if t <= -1.8e+138:
		tmp = t_1
	elif t <= 3.3e-65:
		tmp = x - (y / (a / z))
	elif t <= 1.65e-21:
		tmp = x + ((t * y) / a)
	elif t <= 1.12e+16:
		tmp = x - (y * (z / a))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(t * Float64(y / a)))
	tmp = 0.0
	if (t <= -1.8e+138)
		tmp = t_1;
	elseif (t <= 3.3e-65)
		tmp = Float64(x - Float64(y / Float64(a / z)));
	elseif (t <= 1.65e-21)
		tmp = Float64(x + Float64(Float64(t * y) / a));
	elseif (t <= 1.12e+16)
		tmp = Float64(x - Float64(y * Float64(z / a)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (t * (y / a));
	tmp = 0.0;
	if (t <= -1.8e+138)
		tmp = t_1;
	elseif (t <= 3.3e-65)
		tmp = x - (y / (a / z));
	elseif (t <= 1.65e-21)
		tmp = x + ((t * y) / a);
	elseif (t <= 1.12e+16)
		tmp = x - (y * (z / a));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8e+138], t$95$1, If[LessEqual[t, 3.3e-65], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.65e-21], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.12e+16], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x + t \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 1.65 \cdot 10^{-21}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\

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

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.8000000000000001e138 or 1.12e16 < t

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num97.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified87.6%

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

    if -1.8000000000000001e138 < t < 3.3000000000000001e-65

    1. Initial program 96.5%

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

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

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

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

        \[\leadsto x - \color{blue}{y \cdot \frac{z}{a}} \]
      2. *-commutative87.9%

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

      \[\leadsto x - \color{blue}{\frac{z}{a} \cdot y} \]
    8. Step-by-step derivation
      1. *-commutative87.9%

        \[\leadsto x - \color{blue}{y \cdot \frac{z}{a}} \]
      2. clear-num87.8%

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

        \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z}}} \]
    9. Applied egg-rr88.2%

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

    if 3.3000000000000001e-65 < t < 1.65000000000000004e-21

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.65000000000000004e-21 < t < 1.12e16

    1. Initial program 87.8%

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

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

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

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

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

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

Alternative 6: 83.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - y \cdot \frac{z}{a}\\ t_2 := x + t \cdot \frac{y}{a}\\ \mathbf{if}\;t \leq -6.2 \cdot 10^{+137}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{-65}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-21}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;t \leq 3.3 \cdot 10^{+16}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (- x (* y (/ z a)))) (t_2 (+ x (* t (/ y a)))))
   (if (<= t -6.2e+137)
     t_2
     (if (<= t 3.3e-65)
       t_1
       (if (<= t 1.65e-21) (+ x (/ (* t y) a)) (if (<= t 3.3e+16) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x - (y * (z / a));
	double t_2 = x + (t * (y / a));
	double tmp;
	if (t <= -6.2e+137) {
		tmp = t_2;
	} else if (t <= 3.3e-65) {
		tmp = t_1;
	} else if (t <= 1.65e-21) {
		tmp = x + ((t * y) / a);
	} else if (t <= 3.3e+16) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = x - (y * (z / a))
    t_2 = x + (t * (y / a))
    if (t <= (-6.2d+137)) then
        tmp = t_2
    else if (t <= 3.3d-65) then
        tmp = t_1
    else if (t <= 1.65d-21) then
        tmp = x + ((t * y) / a)
    else if (t <= 3.3d+16) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x - (y * (z / a));
	double t_2 = x + (t * (y / a));
	double tmp;
	if (t <= -6.2e+137) {
		tmp = t_2;
	} else if (t <= 3.3e-65) {
		tmp = t_1;
	} else if (t <= 1.65e-21) {
		tmp = x + ((t * y) / a);
	} else if (t <= 3.3e+16) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x - (y * (z / a))
	t_2 = x + (t * (y / a))
	tmp = 0
	if t <= -6.2e+137:
		tmp = t_2
	elif t <= 3.3e-65:
		tmp = t_1
	elif t <= 1.65e-21:
		tmp = x + ((t * y) / a)
	elif t <= 3.3e+16:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x - Float64(y * Float64(z / a)))
	t_2 = Float64(x + Float64(t * Float64(y / a)))
	tmp = 0.0
	if (t <= -6.2e+137)
		tmp = t_2;
	elseif (t <= 3.3e-65)
		tmp = t_1;
	elseif (t <= 1.65e-21)
		tmp = Float64(x + Float64(Float64(t * y) / a));
	elseif (t <= 3.3e+16)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x - (y * (z / a));
	t_2 = x + (t * (y / a));
	tmp = 0.0;
	if (t <= -6.2e+137)
		tmp = t_2;
	elseif (t <= 3.3e-65)
		tmp = t_1;
	elseif (t <= 1.65e-21)
		tmp = x + ((t * y) / a);
	elseif (t <= 3.3e+16)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.2e+137], t$95$2, If[LessEqual[t, 3.3e-65], t$95$1, If[LessEqual[t, 1.65e-21], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.3e+16], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 3.3 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.65 \cdot 10^{-21}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\

\mathbf{elif}\;t \leq 3.3 \cdot 10^{+16}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.1999999999999999e137 or 3.3e16 < t

    1. Initial program 85.6%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num97.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified87.6%

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

    if -6.1999999999999999e137 < t < 3.3000000000000001e-65 or 1.65000000000000004e-21 < t < 3.3e16

    1. Initial program 96.0%

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

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

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

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

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

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

    if 3.3000000000000001e-65 < t < 1.65000000000000004e-21

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 76.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \frac{y}{a}\\ t_2 := z \cdot \frac{-y}{a}\\ \mathbf{if}\;z \leq -6.2 \cdot 10^{+65}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-113}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{-257}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+158}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (+ x (* t (/ y a)))) (t_2 (* z (/ (- y) a))))
   (if (<= z -6.2e+65)
     t_2
     (if (<= z -2.3e-113)
       t_1
       (if (<= z -4.6e-257)
         (+ x (/ (* t y) a))
         (if (<= z 1.95e+158) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t * (y / a));
	double t_2 = z * (-y / a);
	double tmp;
	if (z <= -6.2e+65) {
		tmp = t_2;
	} else if (z <= -2.3e-113) {
		tmp = t_1;
	} else if (z <= -4.6e-257) {
		tmp = x + ((t * y) / a);
	} else if (z <= 1.95e+158) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = x + (t * (y / a))
    t_2 = z * (-y / a)
    if (z <= (-6.2d+65)) then
        tmp = t_2
    else if (z <= (-2.3d-113)) then
        tmp = t_1
    else if (z <= (-4.6d-257)) then
        tmp = x + ((t * y) / a)
    else if (z <= 1.95d+158) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = x + (t * (y / a));
	double t_2 = z * (-y / a);
	double tmp;
	if (z <= -6.2e+65) {
		tmp = t_2;
	} else if (z <= -2.3e-113) {
		tmp = t_1;
	} else if (z <= -4.6e-257) {
		tmp = x + ((t * y) / a);
	} else if (z <= 1.95e+158) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = x + (t * (y / a))
	t_2 = z * (-y / a)
	tmp = 0
	if z <= -6.2e+65:
		tmp = t_2
	elif z <= -2.3e-113:
		tmp = t_1
	elif z <= -4.6e-257:
		tmp = x + ((t * y) / a)
	elif z <= 1.95e+158:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(x + Float64(t * Float64(y / a)))
	t_2 = Float64(z * Float64(Float64(-y) / a))
	tmp = 0.0
	if (z <= -6.2e+65)
		tmp = t_2;
	elseif (z <= -2.3e-113)
		tmp = t_1;
	elseif (z <= -4.6e-257)
		tmp = Float64(x + Float64(Float64(t * y) / a));
	elseif (z <= 1.95e+158)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = x + (t * (y / a));
	t_2 = z * (-y / a);
	tmp = 0.0;
	if (z <= -6.2e+65)
		tmp = t_2;
	elseif (z <= -2.3e-113)
		tmp = t_1;
	elseif (z <= -4.6e-257)
		tmp = x + ((t * y) / a);
	elseif (z <= 1.95e+158)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.2e+65], t$95$2, If[LessEqual[z, -2.3e-113], t$95$1, If[LessEqual[z, -4.6e-257], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.95e+158], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.3 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 1.95 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -6.19999999999999981e65 or 1.95e158 < z

    1. Initial program 89.5%

      \[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 inf 65.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a}} \]
    6. Step-by-step derivation
      1. mul-1-neg65.0%

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

        \[\leadsto -\color{blue}{y \cdot \frac{z}{a}} \]
      3. distribute-rgt-neg-in65.3%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{z}{a}\right)} \]
      4. distribute-neg-frac265.3%

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

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

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

        \[\leadsto \color{blue}{-\frac{y \cdot z}{a}} \]
      3. *-commutative65.0%

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

        \[\leadsto -\color{blue}{z \cdot \frac{y}{a}} \]
    9. Applied egg-rr70.7%

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

    if -6.19999999999999981e65 < z < -2.30000000000000008e-113 or -4.6e-257 < z < 1.95e158

    1. Initial program 91.9%

      \[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. 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/99.2%

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num99.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified84.4%

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

    if -2.30000000000000008e-113 < z < -4.6e-257

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{+65}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-113}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{elif}\;z \leq -4.6 \cdot 10^{-257}:\\ \;\;\;\;x + \frac{t \cdot y}{a}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+158}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 50.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;a \leq -1.95 \cdot 10^{-255}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;a \leq 3.7 \cdot 10^{-51}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if a < -8.99999999999999957e26 or 3.69999999999999973e-51 < a

    1. Initial program 84.6%

      \[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 62.1%

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

    if -8.99999999999999957e26 < a < -1.95e-255 or 3.50000000000000029e-266 < a < 3.69999999999999973e-51

    1. Initial program 99.8%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a}} \]
    6. Step-by-step derivation
      1. mul-1-neg51.7%

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

        \[\leadsto -\color{blue}{y \cdot \frac{z}{a}} \]
      3. distribute-rgt-neg-in47.6%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{z}{a}\right)} \]
      4. distribute-neg-frac247.6%

        \[\leadsto y \cdot \color{blue}{\frac{z}{-a}} \]
    7. Simplified47.6%

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

        \[\leadsto \color{blue}{\frac{y \cdot z}{-a}} \]
      2. distribute-frac-neg251.7%

        \[\leadsto \color{blue}{-\frac{y \cdot z}{a}} \]
      3. *-commutative51.7%

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

        \[\leadsto -\color{blue}{z \cdot \frac{y}{a}} \]
    9. Applied egg-rr55.4%

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

    if -1.95e-255 < a < 3.50000000000000029e-266

    1. Initial program 99.8%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -9 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -1.95 \cdot 10^{-255}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{elif}\;a \leq 3.5 \cdot 10^{-266}:\\ \;\;\;\;\frac{t \cdot y}{a}\\ \mathbf{elif}\;a \leq 3.7 \cdot 10^{-51}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 76.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{+65} \lor \neg \left(z \leq 3.7 \cdot 10^{+158}\right):\\
\;\;\;\;z \cdot \frac{-y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -7.1000000000000003e65 or 3.70000000000000011e158 < z

    1. Initial program 89.5%

      \[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 inf 65.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a}} \]
    6. Step-by-step derivation
      1. mul-1-neg65.0%

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

        \[\leadsto -\color{blue}{y \cdot \frac{z}{a}} \]
      3. distribute-rgt-neg-in65.3%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{z}{a}\right)} \]
      4. distribute-neg-frac265.3%

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

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

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

        \[\leadsto \color{blue}{-\frac{y \cdot z}{a}} \]
      3. *-commutative65.0%

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

        \[\leadsto -\color{blue}{z \cdot \frac{y}{a}} \]
    9. Applied egg-rr70.7%

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

    if -7.1000000000000003e65 < z < 3.70000000000000011e158

    1. Initial program 93.3%

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{\left(z - t\right) \cdot \frac{y}{a}} \]
    8. Step-by-step derivation
      1. clear-num96.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{t \cdot \frac{y}{a}} \]
    12. Simplified84.0%

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

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

Alternative 10: 50.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.85 \cdot 10^{+163} \lor \neg \left(t \leq 1.1 \cdot 10^{+96}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.84999999999999996e163 or 1.0999999999999999e96 < t

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \frac{y}{a}} \]
    10. Simplified66.9%

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

    if -1.84999999999999996e163 < t < 1.0999999999999999e96

    1. Initial program 96.7%

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

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

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

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

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

Alternative 11: 93.4% accurate, 1.0× speedup?

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

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

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

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

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

    \[\leadsto x + y \cdot \frac{t - z}{a} \]
  6. Add Preprocessing

Alternative 12: 39.2% accurate, 9.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
	return x;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x
end function
public static double code(double x, double y, double z, double t, double a) {
	return x;
}
def code(x, y, z, t, a):
	return x
function code(x, y, z, t, a)
	return x
end
function tmp = code(x, y, z, t, a)
	tmp = x;
end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}

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

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

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

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

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

Developer target: 99.0% 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 2024086 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
  :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)))