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

Percentage Accurate: 92.9% → 99.5%
Time: 12.7s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 92.9% 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: 99.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(z - t\right)\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{+287} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+243}\right):\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \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 -1e+287) (not (<= t_1 2e+243)))
     (+ x (/ y (/ a (- z t))))
     (+ 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 <= -1e+287) || !(t_1 <= 2e+243)) {
		tmp = x + (y / (a / (z - t)));
	} 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 <= (-1d+287)) .or. (.not. (t_1 <= 2d+243))) then
        tmp = x + (y / (a / (z - t)))
    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 <= -1e+287) || !(t_1 <= 2e+243)) {
		tmp = x + (y / (a / (z - t)));
	} 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 <= -1e+287) or not (t_1 <= 2e+243):
		tmp = x + (y / (a / (z - t)))
	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 <= -1e+287) || !(t_1 <= 2e+243))
		tmp = Float64(x + Float64(y / Float64(a / Float64(z - t))));
	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 <= -1e+287) || ~((t_1 <= 2e+243)))
		tmp = x + (y / (a / (z - t)));
	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, -1e+287], N[Not[LessEqual[t$95$1, 2e+243]], $MachinePrecision]], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{+287} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+243}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\

\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)) < -1.0000000000000001e287 or 2.0000000000000001e243 < (*.f64 y (-.f64 z t))

    1. Initial program 66.6%

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

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

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

    if -1.0000000000000001e287 < (*.f64 y (-.f64 z t)) < 2.0000000000000001e243

    1. Initial program 99.6%

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

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

Alternative 2: 97.5% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{y}{a}, z - t, x\right) \end{array} \]
(FPCore (x y z t a) :precision binary64 (fma (/ y a) (- z t) x))
double code(double x, double y, double z, double t, double a) {
	return fma((y / a), (z - t), x);
}
function code(x, y, z, t, a)
	return fma(Float64(y / a), Float64(z - t), x)
end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)
\end{array}
Derivation
  1. Initial program 90.6%

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)} \]
  4. Add Preprocessing
  5. Final simplification97.7%

    \[\leadsto \mathsf{fma}\left(\frac{y}{a}, z - t, x\right) \]
  6. Add Preprocessing

Alternative 3: 49.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{a} \cdot \left(-t\right)\\ t_2 := \frac{y}{a} \cdot z\\ \mathbf{if}\;x \leq -4.9 \cdot 10^{+79}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-202}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-195}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-111}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+46}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (* (/ y a) (- t))) (t_2 (* (/ y a) z)))
   (if (<= x -4.9e+79)
     x
     (if (<= x -7.8e-202)
       t_2
       (if (<= x 5.5e-195)
         t_1
         (if (<= x 2.6e-111) t_2 (if (<= x 3.7e+46) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
	double t_1 = (y / a) * -t;
	double t_2 = (y / a) * z;
	double tmp;
	if (x <= -4.9e+79) {
		tmp = x;
	} else if (x <= -7.8e-202) {
		tmp = t_2;
	} else if (x <= 5.5e-195) {
		tmp = t_1;
	} else if (x <= 2.6e-111) {
		tmp = t_2;
	} else if (x <= 3.7e+46) {
		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) :: t_2
    real(8) :: tmp
    t_1 = (y / a) * -t
    t_2 = (y / a) * z
    if (x <= (-4.9d+79)) then
        tmp = x
    else if (x <= (-7.8d-202)) then
        tmp = t_2
    else if (x <= 5.5d-195) then
        tmp = t_1
    else if (x <= 2.6d-111) then
        tmp = t_2
    else if (x <= 3.7d+46) 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 / a) * -t;
	double t_2 = (y / a) * z;
	double tmp;
	if (x <= -4.9e+79) {
		tmp = x;
	} else if (x <= -7.8e-202) {
		tmp = t_2;
	} else if (x <= 5.5e-195) {
		tmp = t_1;
	} else if (x <= 2.6e-111) {
		tmp = t_2;
	} else if (x <= 3.7e+46) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t, a):
	t_1 = (y / a) * -t
	t_2 = (y / a) * z
	tmp = 0
	if x <= -4.9e+79:
		tmp = x
	elif x <= -7.8e-202:
		tmp = t_2
	elif x <= 5.5e-195:
		tmp = t_1
	elif x <= 2.6e-111:
		tmp = t_2
	elif x <= 3.7e+46:
		tmp = t_1
	else:
		tmp = x
	return tmp
function code(x, y, z, t, a)
	t_1 = Float64(Float64(y / a) * Float64(-t))
	t_2 = Float64(Float64(y / a) * z)
	tmp = 0.0
	if (x <= -4.9e+79)
		tmp = x;
	elseif (x <= -7.8e-202)
		tmp = t_2;
	elseif (x <= 5.5e-195)
		tmp = t_1;
	elseif (x <= 2.6e-111)
		tmp = t_2;
	elseif (x <= 3.7e+46)
		tmp = t_1;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = (y / a) * -t;
	t_2 = (y / a) * z;
	tmp = 0.0;
	if (x <= -4.9e+79)
		tmp = x;
	elseif (x <= -7.8e-202)
		tmp = t_2;
	elseif (x <= 5.5e-195)
		tmp = t_1;
	elseif (x <= 2.6e-111)
		tmp = t_2;
	elseif (x <= 3.7e+46)
		tmp = t_1;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[x, -4.9e+79], x, If[LessEqual[x, -7.8e-202], t$95$2, If[LessEqual[x, 5.5e-195], t$95$1, If[LessEqual[x, 2.6e-111], t$95$2, If[LessEqual[x, 3.7e+46], t$95$1, x]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(-t\right)\\
t_2 := \frac{y}{a} \cdot z\\
\mathbf{if}\;x \leq -4.9 \cdot 10^{+79}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq -7.8 \cdot 10^{-202}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 5.5 \cdot 10^{-195}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 2.6 \cdot 10^{-111}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 3.7 \cdot 10^{+46}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.8999999999999999e79 or 3.6999999999999999e46 < x

    1. Initial program 90.8%

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

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

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

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

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

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

    if -4.8999999999999999e79 < x < -7.7999999999999998e-202 or 5.5000000000000003e-195 < x < 2.59999999999999982e-111

    1. Initial program 90.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{z}}} \]
    7. Simplified51.4%

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

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

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

    if -7.7999999999999998e-202 < x < 5.5000000000000003e-195 or 2.59999999999999982e-111 < x < 3.6999999999999999e46

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.9 \cdot 10^{+79}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-202}:\\ \;\;\;\;\frac{y}{a} \cdot z\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-195}:\\ \;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\ \mathbf{elif}\;x \leq 2.6 \cdot 10^{-111}:\\ \;\;\;\;\frac{y}{a} \cdot z\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+46}:\\ \;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 84.3% accurate, 0.4× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.39999999999999979e32 or 5.00000000000000016e138 < z

    1. Initial program 83.9%

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z}}} \]
      2. associate-/r/93.4%

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

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

    if -3.39999999999999979e32 < z < -1.14999999999999993e-33

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

    if -1.14999999999999993e-33 < z < 5.00000000000000016e138

    1. Initial program 94.6%

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

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

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

        \[\leadsto x + \frac{y}{\color{blue}{\frac{1}{\frac{z - t}{a}}}} \]
      2. associate-/r/94.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{+32}:\\ \;\;\;\;x + \frac{y}{a} \cdot z\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-33}:\\ \;\;\;\;y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+138}:\\ \;\;\;\;x - \frac{y}{a} \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{a} \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 66.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.8 \cdot 10^{+132}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.79999999999999954e132 or 8.4000000000000002e55 < x

    1. Initial program 91.5%

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

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

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

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

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

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

    if -8.79999999999999954e132 < x < 8.4000000000000002e55

    1. Initial program 90.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{+132}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.4 \cdot 10^{+55}:\\ \;\;\;\;y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 78.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+147}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\

\mathbf{elif}\;t \leq 2.6 \cdot 10^{+162}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\

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


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

    1. Initial program 79.7%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-\frac{y}{a}\right)} \]
      4. distribute-neg-frac75.9%

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

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

    if -2.5000000000000001e147 < t < 2.6e162

    1. Initial program 93.1%

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z}}} \]
      2. associate-/r/83.0%

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

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

    if 2.6e162 < t

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

Alternative 7: 48.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-33} \lor \neg \left(z \leq 1.2 \cdot 10^{+147}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.14999999999999993e-33 or 1.20000000000000001e147 < z

    1. Initial program 84.6%

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

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

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

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

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

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

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

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

    if -1.14999999999999993e-33 < z < 1.20000000000000001e147

    1. Initial program 94.7%

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

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

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

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

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

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

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

Alternative 8: 50.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-36} \lor \neg \left(z \leq 2.7 \cdot 10^{+146}\right):\\
\;\;\;\;\frac{y}{a} \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.02e-36 or 2.69999999999999989e146 < z

    1. Initial program 84.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{a}{z}}} \]
    7. Simplified59.8%

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

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

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

    if -1.02e-36 < z < 2.69999999999999989e146

    1. Initial program 94.7%

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

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

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

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

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

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

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

Alternative 9: 93.4% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 10: 97.5% 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 90.6%

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

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

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

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

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

Alternative 11: 97.5% accurate, 1.0× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{a}, z - t, x\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. fma-udef97.7%

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

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

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

Alternative 12: 39.7% 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 90.6%

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification39.3%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 99.2% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024036 
(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)))