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

Percentage Accurate: 93.1% → 97.2%
Time: 10.1s
Alternatives: 10
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 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 93.1% accurate, 1.0× speedup?

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

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

Alternative 1: 97.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.2%

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

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

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

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

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

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

    \[\leadsto x + \color{blue}{\frac{z - t}{\frac{a}{y}}} \]
  6. Final simplification97.5%

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

Alternative 2: 50.3% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq -2.3 \cdot 10^{-201}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.65 \cdot 10^{-273}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\

\mathbf{elif}\;z \leq 4.7 \cdot 10^{+67}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -5.4e134

    1. Initial program 94.0%

      \[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 y around inf 62.0%

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

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

    if -5.4e134 < z < -2.29999999999999986e-201 or 1.64999999999999995e-273 < z < 4.70000000000000017e67

    1. Initial program 92.4%

      \[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 x around inf 56.0%

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

    if -2.29999999999999986e-201 < z < 1.64999999999999995e-273

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\frac{-\left(-t\right)}{-a}} \]
      3. remove-double-neg62.1%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{-a}{t}}} \]
      2. associate-/r/59.9%

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

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

    if 4.70000000000000017e67 < z

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.4 \cdot 10^{+134}:\\ \;\;\;\;y \cdot \frac{z}{a}\\ \mathbf{elif}\;z \leq -2.3 \cdot 10^{-201}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-273}:\\ \;\;\;\;t \cdot \frac{y}{-a}\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{+67}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{a}\\ \end{array} \]

Alternative 3: 50.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq -5 \cdot 10^{-195}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.58 \cdot 10^{-273}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\

\mathbf{elif}\;z \leq 6.8 \cdot 10^{+67}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -5.4999999999999999e134

    1. Initial program 94.0%

      \[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 y around inf 62.0%

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

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

    if -5.4999999999999999e134 < z < -5.00000000000000009e-195 or 1.57999999999999994e-273 < z < 6.8000000000000003e67

    1. Initial program 92.4%

      \[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 x around inf 56.0%

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

    if -5.00000000000000009e-195 < z < 1.57999999999999994e-273

    1. Initial program 91.3%

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

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

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

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

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

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

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

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

    if 6.8000000000000003e67 < z

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+134}:\\ \;\;\;\;y \cdot \frac{z}{a}\\ \mathbf{elif}\;z \leq -5 \cdot 10^{-195}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.58 \cdot 10^{-273}:\\ \;\;\;\;y \cdot \frac{-t}{a}\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{+67}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{a}\\ \end{array} \]

Alternative 4: 68.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-42} \lor \neg \left(y \leq 1.45 \cdot 10^{-74}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.5000000000000002e-42 or 1.45e-74 < y

    1. Initial program 86.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot z} + -1 \cdot \frac{y \cdot t}{a} \]
      2. mul-1-neg60.1%

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

        \[\leadsto \frac{y}{a} \cdot z + \left(-\color{blue}{\frac{y}{\frac{a}{t}}}\right) \]
      4. fma-def65.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, z, -\frac{y}{\frac{a}{t}}\right)} \]
      5. fma-neg64.2%

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

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

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

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

    if -3.5000000000000002e-42 < y < 1.45e-74

    1. Initial program 98.6%

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

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

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

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

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

Alternative 5: 79.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -11.5 \lor \neg \left(t \leq 1.4 \cdot 10^{+145}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -11.5 or 1.3999999999999999e145 < t

    1. Initial program 87.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{a} \cdot z} + -1 \cdot \frac{y \cdot t}{a} \]
      2. mul-1-neg57.2%

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

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

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

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

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

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

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

    if -11.5 < t < 1.3999999999999999e145

    1. Initial program 95.7%

      \[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 0 84.9%

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

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

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

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

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

Alternative 6: 86.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \lor \neg \left(t \leq 6.1 \cdot 10^{+72}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.44999999999999996 or 6.09999999999999991e72 < t

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.44999999999999996 < t < 6.09999999999999991e72

    1. Initial program 96.2%

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

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

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

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

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

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

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

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

Alternative 7: 51.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+133} \lor \neg \left(z \leq 1.05 \cdot 10^{+68}\right):\\
\;\;\;\;z \cdot \frac{y}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.8000000000000002e133 or 1.05e68 < z

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

    if -3.8000000000000002e133 < z < 1.05e68

    1. Initial program 92.1%

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

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

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

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

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

Alternative 8: 50.6% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;z \leq 1.05 \cdot 10^{+67}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.8000000000000002e133

    1. Initial program 94.0%

      \[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 y around inf 62.0%

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

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

    if -3.8000000000000002e133 < z < 1.0500000000000001e67

    1. Initial program 92.1%

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

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

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

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

    if 1.0500000000000001e67 < z

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+133}:\\ \;\;\;\;y \cdot \frac{z}{a}\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+67}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{a}\\ \end{array} \]

Alternative 9: 97.2% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 10: 39.6% 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.2%

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification44.0%

    \[\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 2023279 
(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)))