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

Percentage Accurate: 93.5% → 96.9%
Time: 10.6s
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.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x - \frac{y \cdot \left(z - t\right)}{a} \end{array} \]
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
	return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
	return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a):
	return x - ((y * (z - t)) / a)
function code(x, y, z, t, a)
	return Float64(x - Float64(Float64(y * Float64(z - t)) / a))
end
function tmp = code(x, y, z, t, a)
	tmp = x - ((y * (z - t)) / a);
end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 96.9% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 2: 65.0% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;a \leq -4.9 \cdot 10^{+131} \lor \neg \left(a \leq -2.1 \cdot 10^{+63}\right) \land a \leq 2.2 \cdot 10^{+106}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4.9999999999999996e180 or -4.90000000000000032e131 < a < -2.1000000000000002e63 or 2.19999999999999992e106 < a

    1. Initial program 87.2%

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

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

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

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

    if -4.9999999999999996e180 < a < -4.90000000000000032e131 or -2.1000000000000002e63 < a < 2.19999999999999992e106

    1. Initial program 95.6%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)} \]
    5. Step-by-step derivation
      1. div-sub76.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -5 \cdot 10^{+180}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -4.9 \cdot 10^{+131} \lor \neg \left(a \leq -2.1 \cdot 10^{+63}\right) \land a \leq 2.2 \cdot 10^{+106}:\\ \;\;\;\;y \cdot \frac{t - z}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 3: 49.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq 1.25 \cdot 10^{-60}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.65 \cdot 10^{+58}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.3000000000000001e51 or 1.25e-60 < y < 1.64999999999999991e58

    1. Initial program 93.8%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg49.2%

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

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

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

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

    if -1.3000000000000001e51 < y < 1.25e-60

    1. Initial program 98.4%

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

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

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

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

    if 1.64999999999999991e58 < y

    1. Initial program 80.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{+51}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-60}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{+58}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a}{y}}\\ \end{array} \]

Alternative 4: 49.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+51}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{+55}:\\ \;\;\;\;-\frac{z}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a}{y}}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= y -1.1e+51)
   (* z (/ (- y) a))
   (if (<= y 1.4e-59) x (if (<= y 1.12e+55) (- (/ z (/ a y))) (/ t (/ a y))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -1.1e+51) {
		tmp = z * (-y / a);
	} else if (y <= 1.4e-59) {
		tmp = x;
	} else if (y <= 1.12e+55) {
		tmp = -(z / (a / y));
	} else {
		tmp = t / (a / y);
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (y <= (-1.1d+51)) then
        tmp = z * (-y / a)
    else if (y <= 1.4d-59) then
        tmp = x
    else if (y <= 1.12d+55) then
        tmp = -(z / (a / y))
    else
        tmp = t / (a / y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (y <= -1.1e+51) {
		tmp = z * (-y / a);
	} else if (y <= 1.4e-59) {
		tmp = x;
	} else if (y <= 1.12e+55) {
		tmp = -(z / (a / y));
	} else {
		tmp = t / (a / y);
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if y <= -1.1e+51:
		tmp = z * (-y / a)
	elif y <= 1.4e-59:
		tmp = x
	elif y <= 1.12e+55:
		tmp = -(z / (a / y))
	else:
		tmp = t / (a / y)
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (y <= -1.1e+51)
		tmp = Float64(z * Float64(Float64(-y) / a));
	elseif (y <= 1.4e-59)
		tmp = x;
	elseif (y <= 1.12e+55)
		tmp = Float64(-Float64(z / Float64(a / y)));
	else
		tmp = Float64(t / Float64(a / y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (y <= -1.1e+51)
		tmp = z * (-y / a);
	elseif (y <= 1.4e-59)
		tmp = x;
	elseif (y <= 1.12e+55)
		tmp = -(z / (a / y));
	else
		tmp = t / (a / y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.1e+51], N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e-59], x, If[LessEqual[y, 1.12e+55], (-N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.4 \cdot 10^{-59}:\\
\;\;\;\;x\\

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

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


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

    1. Initial program 91.6%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot z}{a}} \]
    5. Step-by-step derivation
      1. mul-1-neg47.9%

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

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

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

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

    if -1.09999999999999996e51 < y < 1.3999999999999999e-59

    1. Initial program 98.4%

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

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

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

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

    if 1.3999999999999999e-59 < y < 1.12000000000000006e55

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{-y}{a} \cdot z} \]
    9. Step-by-step derivation
      1. neg-mul-151.3%

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

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

        \[\leadsto \color{blue}{\frac{-1 \cdot z}{\frac{a}{y}}} \]
      4. neg-mul-151.4%

        \[\leadsto \frac{\color{blue}{-z}}{\frac{a}{y}} \]
    10. Applied egg-rr51.4%

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

    if 1.12000000000000006e55 < y

    1. Initial program 80.2%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{+51}:\\ \;\;\;\;z \cdot \frac{-y}{a}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-59}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{+55}:\\ \;\;\;\;-\frac{z}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a}{y}}\\ \end{array} \]

Alternative 5: 77.5% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.6999999999999999e186 or 3.50000000000000007e120 < z

    1. Initial program 84.8%

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{t}{a} - \frac{z}{a}\right)} \]
    5. Step-by-step derivation
      1. div-sub78.0%

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

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

    if -2.6999999999999999e186 < z < 3.50000000000000007e120

    1. Initial program 95.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 84.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -4.1 \cdot 10^{+21} \lor \neg \left(t \leq 8.5 \cdot 10^{+14}\right):\\ \;\;\;\;x + t \cdot \frac{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 -4.1e+21) (not (<= t 8.5e+14)))
   (+ x (* t (/ y a)))
   (- x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if ((t <= -4.1e+21) || !(t <= 8.5e+14)) {
		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 <= (-4.1d+21)) .or. (.not. (t <= 8.5d+14))) 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 <= -4.1e+21) || !(t <= 8.5e+14)) {
		tmp = x + (t * (y / a));
	} else {
		tmp = x - (y / (a / z));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if (t <= -4.1e+21) or not (t <= 8.5e+14):
		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 <= -4.1e+21) || !(t <= 8.5e+14))
		tmp = Float64(x + Float64(t * Float64(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 <= -4.1e+21) || ~((t <= 8.5e+14)))
		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, -4.1e+21], N[Not[LessEqual[t, 8.5e+14]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.1e21 or 8.5e14 < t

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{1} \cdot \frac{t \cdot y}{a} \]
      3. *-lft-identity82.1%

        \[\leadsto x + \color{blue}{\frac{t \cdot y}{a}} \]
      4. +-commutative82.1%

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

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

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

    if -4.1e21 < t < 8.5e14

    1. Initial program 94.9%

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z}}} \]
    6. Simplified84.2%

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

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

Alternative 7: 83.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -1.25 \cdot 10^{+23}:\\ \;\;\;\;x - \frac{y}{\frac{-a}{t}}\\ \mathbf{elif}\;t \leq 10^{+15}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{y}{a}\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (if (<= t -1.25e+23)
   (- x (/ y (/ (- a) t)))
   (if (<= t 1e+15) (- x (/ y (/ a z))) (+ x (* t (/ y a))))))
double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -1.25e+23) {
		tmp = x - (y / (-a / t));
	} else if (t <= 1e+15) {
		tmp = x - (y / (a / z));
	} else {
		tmp = x + (t * (y / a));
	}
	return tmp;
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8) :: tmp
    if (t <= (-1.25d+23)) then
        tmp = x - (y / (-a / t))
    else if (t <= 1d+15) then
        tmp = x - (y / (a / z))
    else
        tmp = x + (t * (y / a))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
	double tmp;
	if (t <= -1.25e+23) {
		tmp = x - (y / (-a / t));
	} else if (t <= 1e+15) {
		tmp = x - (y / (a / z));
	} else {
		tmp = x + (t * (y / a));
	}
	return tmp;
}
def code(x, y, z, t, a):
	tmp = 0
	if t <= -1.25e+23:
		tmp = x - (y / (-a / t))
	elif t <= 1e+15:
		tmp = x - (y / (a / z))
	else:
		tmp = x + (t * (y / a))
	return tmp
function code(x, y, z, t, a)
	tmp = 0.0
	if (t <= -1.25e+23)
		tmp = Float64(x - Float64(y / Float64(Float64(-a) / t)));
	elseif (t <= 1e+15)
		tmp = Float64(x - Float64(y / Float64(a / z)));
	else
		tmp = Float64(x + Float64(t * Float64(y / a)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	tmp = 0.0;
	if (t <= -1.25e+23)
		tmp = x - (y / (-a / t));
	elseif (t <= 1e+15)
		tmp = x - (y / (a / z));
	else
		tmp = x + (t * (y / a));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.25e+23], N[(x - N[(y / N[((-a) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e+15], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 88.5%

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

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

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

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

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

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

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

    if -1.25e23 < t < 1e15

    1. Initial program 94.9%

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

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

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

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

        \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z}}} \]
    6. Simplified84.2%

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

    if 1e15 < t

    1. Initial program 92.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 49.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 87.4%

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

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

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

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

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

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

    if -1.35e114 < y < 26

    1. Initial program 97.3%

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

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

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

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

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

Alternative 9: 50.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 91.5%

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

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

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

      \[\leadsto \color{blue}{\frac{t \cdot y}{a}} \]
    5. Step-by-step derivation
      1. div-inv45.9%

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

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

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

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

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

    if -1.5e51 < y < 1400

    1. Initial program 98.5%

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

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

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

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

    if 1400 < y

    1. Initial program 84.2%

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

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

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

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

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

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

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

Alternative 10: 96.9% 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.9%

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

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

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

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

Alternative 11: 39.8% accurate, 9.0× speedup?

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

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

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

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

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

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

    \[\leadsto x \]

Developer target: 99.2% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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