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

Percentage Accurate: 93.3% → 98.1%
Time: 10.0s
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.3% 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: 98.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+275} \lor \neg \left(t_1 \leq 2 \cdot 10^{+285}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y (-.f64 z t)) < -3.99999999999999984e275 or 2e285 < (*.f64 y (-.f64 z t))

    1. Initial program 70.2%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 70.2%

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    4. Applied egg-rr96.2%

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

    if -3.99999999999999984e275 < (*.f64 y (-.f64 z t)) < 2e285

    1. Initial program 98.4%

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

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

Alternative 2: 83.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-26} \lor \neg \left(t_1 \leq 2 \cdot 10^{+162}\right):\\
\;\;\;\;\left(z - t\right) \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 (/.f64 (*.f64 y (-.f64 z t)) a) < -2.0000000000000001e-26 or 1.9999999999999999e162 < (/.f64 (*.f64 y (-.f64 z t)) a)

    1. Initial program 87.6%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 84.2%

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    4. Applied egg-rr94.3%

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

    if -2.0000000000000001e-26 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1.9999999999999999e162

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

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

Alternative 3: 50.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \frac{-t}{a}\\
\mathbf{if}\;a \leq -1.3:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq -8.5 \cdot 10^{-209}:\\
\;\;\;\;\frac{y \cdot z}{a}\\

\mathbf{elif}\;a \leq -5 \cdot 10^{-256}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 0.00385:\\
\;\;\;\;z \cdot \frac{y}{a}\\

\mathbf{elif}\;a \leq 1.12 \cdot 10^{+33}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -1.30000000000000004 or 1.12e33 < a

    1. Initial program 85.3%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around inf 63.6%

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

    if -1.30000000000000004 < a < -8.5e-209

    1. Initial program 99.8%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 80.7%

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

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

    if -8.5e-209 < a < -5e-256 or 0.0038500000000000001 < a < 1.12e33

    1. Initial program 99.9%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 91.7%

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

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

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

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

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

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

    if -5e-256 < a < 0.0038500000000000001

    1. Initial program 96.0%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 78.9%

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{y}{a}} \]
    5. Simplified56.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.3:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -8.5 \cdot 10^{-209}:\\ \;\;\;\;\frac{y \cdot z}{a}\\ \mathbf{elif}\;a \leq -5 \cdot 10^{-256}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{elif}\;a \leq 0.00385:\\ \;\;\;\;z \cdot \frac{y}{a}\\ \mathbf{elif}\;a \leq 1.12 \cdot 10^{+33}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 4: 51.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := t \cdot \frac{-y}{a}\\
\mathbf{if}\;a \leq -15:\\
\;\;\;\;x\\

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

\mathbf{elif}\;a \leq -2.1 \cdot 10^{-260}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;a \leq 0.0045:\\
\;\;\;\;z \cdot \frac{y}{a}\\

\mathbf{elif}\;a \leq 1.25 \cdot 10^{+33}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if a < -15 or 1.24999999999999993e33 < a

    1. Initial program 85.3%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around inf 63.6%

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

    if -15 < a < -8.0000000000000008e-208

    1. Initial program 99.8%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 80.7%

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

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

    if -8.0000000000000008e-208 < a < -2.10000000000000005e-260 or 0.00449999999999999966 < a < 1.24999999999999993e33

    1. Initial program 99.9%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in z around 0 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.10000000000000005e-260 < a < 0.00449999999999999966

    1. Initial program 96.0%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 78.9%

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{y}{a}} \]
    5. Simplified56.9%

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

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

Alternative 5: 77.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -7 \cdot 10^{-38} \lor \neg \left(a \leq 1.95 \cdot 10^{-75} \lor \neg \left(a \leq 1.6 \cdot 10^{-20}\right) \land a \leq 5.5 \cdot 10^{+31}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -7.0000000000000003e-38 or 1.9500000000000001e-75 < a < 1.59999999999999985e-20 or 5.50000000000000002e31 < a

    1. Initial program 87.9%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in z around inf 76.4%

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

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

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

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

    if -7.0000000000000003e-38 < a < 1.9500000000000001e-75 or 1.59999999999999985e-20 < a < 5.50000000000000002e31

    1. Initial program 97.4%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 87.2%

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    4. Applied egg-rr88.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -7 \cdot 10^{-38} \lor \neg \left(a \leq 1.95 \cdot 10^{-75} \lor \neg \left(a \leq 1.6 \cdot 10^{-20}\right) \land a \leq 5.5 \cdot 10^{+31}\right):\\ \;\;\;\;x + z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\ \end{array} \]

Alternative 6: 67.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;a \leq -4.8 \cdot 10^{+151} \lor \neg \left(a \leq -25\right) \land a \leq 1.15 \cdot 10^{+43}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.35e184 or -4.8000000000000002e151 < a < -25 or 1.1500000000000001e43 < a

    1. Initial program 87.3%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around inf 67.7%

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

    if -1.35e184 < a < -4.8000000000000002e151 or -25 < a < 1.1500000000000001e43

    1. Initial program 95.6%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 78.2%

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot \left(z - t\right)} \]
    4. Applied egg-rr81.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.35 \cdot 10^{+184}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -4.8 \cdot 10^{+151} \lor \neg \left(a \leq -25\right) \land a \leq 1.15 \cdot 10^{+43}:\\ \;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 7: 97.7% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 86.9%

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

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

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

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

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

    if -3e-11 < a

    1. Initial program 94.3%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -3 \cdot 10^{-11}:\\ \;\;\;\;x + y \cdot \left(\frac{1}{a} \cdot \left(z - t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\ \end{array} \]

Alternative 8: 52.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0275:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 0.065:\\
\;\;\;\;z \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -0.0275000000000000001 or 0.065000000000000002 < a

    1. Initial program 86.5%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around inf 60.2%

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

    if -0.0275000000000000001 < a < 0.065000000000000002

    1. Initial program 97.6%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 81.5%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.0275:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 0.065:\\ \;\;\;\;z \cdot \frac{y}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 9: 51.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9:\\
\;\;\;\;x\\

\mathbf{elif}\;a \leq 0.052:\\
\;\;\;\;\frac{z}{\frac{a}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -1.8999999999999999 or 0.0519999999999999976 < a

    1. Initial program 86.5%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around inf 60.2%

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

    if -1.8999999999999999 < a < 0.0519999999999999976

    1. Initial program 97.6%

      \[x + \frac{y \cdot \left(z - t\right)}{a} \]
    2. Taylor expanded in x around 0 81.5%

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

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

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

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

      \[\leadsto \color{blue}{z \cdot \frac{y}{a}} \]
    6. Step-by-step derivation
      1. clear-num51.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -1.9:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq 0.052:\\ \;\;\;\;\frac{z}{\frac{a}{y}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 10: 97.2% 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.4%

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

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

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

    \[\leadsto \color{blue}{x + \frac{z - t}{\frac{a}{y}}} \]
  4. Final simplification95.8%

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

Alternative 11: 39.1% 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.4%

    \[x + \frac{y \cdot \left(z - t\right)}{a} \]
  2. Taylor expanded in x around inf 37.5%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification37.5%

    \[\leadsto x \]

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

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

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