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

Percentage Accurate: 93.0% → 97.8%
Time: 7.8s
Alternatives: 14
Speedup: 1.0×

Specification

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

\\
x + \frac{y \cdot \left(z - x\right)}{t}
\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 14 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.0% accurate, 1.0× speedup?

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

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

Alternative 1: 97.8% accurate, 0.1× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
  4. Applied egg-rr98.8%

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

Alternative 2: 53.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot y}{t}\\ \mathbf{if}\;t \leq -1.6 \cdot 10^{+115}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -5.5 \cdot 10^{-88}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -1.1 \cdot 10^{-126}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{-298}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{-144}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-26}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z y) t)))
   (if (<= t -1.6e+115)
     x
     (if (<= t -5.5e-88)
       t_1
       (if (<= t -1.1e-126)
         (* z (/ x z))
         (if (<= t 1.85e-298)
           (* z (/ y t))
           (if (<= t 2.45e-144)
             (* x (/ y (- t)))
             (if (<= t 8.5e-26) t_1 x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * y) / t;
	double tmp;
	if (t <= -1.6e+115) {
		tmp = x;
	} else if (t <= -5.5e-88) {
		tmp = t_1;
	} else if (t <= -1.1e-126) {
		tmp = z * (x / z);
	} else if (t <= 1.85e-298) {
		tmp = z * (y / t);
	} else if (t <= 2.45e-144) {
		tmp = x * (y / -t);
	} else if (t <= 8.5e-26) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * y) / t
    if (t <= (-1.6d+115)) then
        tmp = x
    else if (t <= (-5.5d-88)) then
        tmp = t_1
    else if (t <= (-1.1d-126)) then
        tmp = z * (x / z)
    else if (t <= 1.85d-298) then
        tmp = z * (y / t)
    else if (t <= 2.45d-144) then
        tmp = x * (y / -t)
    else if (t <= 8.5d-26) 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 t_1 = (z * y) / t;
	double tmp;
	if (t <= -1.6e+115) {
		tmp = x;
	} else if (t <= -5.5e-88) {
		tmp = t_1;
	} else if (t <= -1.1e-126) {
		tmp = z * (x / z);
	} else if (t <= 1.85e-298) {
		tmp = z * (y / t);
	} else if (t <= 2.45e-144) {
		tmp = x * (y / -t);
	} else if (t <= 8.5e-26) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * y) / t
	tmp = 0
	if t <= -1.6e+115:
		tmp = x
	elif t <= -5.5e-88:
		tmp = t_1
	elif t <= -1.1e-126:
		tmp = z * (x / z)
	elif t <= 1.85e-298:
		tmp = z * (y / t)
	elif t <= 2.45e-144:
		tmp = x * (y / -t)
	elif t <= 8.5e-26:
		tmp = t_1
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * y) / t)
	tmp = 0.0
	if (t <= -1.6e+115)
		tmp = x;
	elseif (t <= -5.5e-88)
		tmp = t_1;
	elseif (t <= -1.1e-126)
		tmp = Float64(z * Float64(x / z));
	elseif (t <= 1.85e-298)
		tmp = Float64(z * Float64(y / t));
	elseif (t <= 2.45e-144)
		tmp = Float64(x * Float64(y / Float64(-t)));
	elseif (t <= 8.5e-26)
		tmp = t_1;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * y) / t;
	tmp = 0.0;
	if (t <= -1.6e+115)
		tmp = x;
	elseif (t <= -5.5e-88)
		tmp = t_1;
	elseif (t <= -1.1e-126)
		tmp = z * (x / z);
	elseif (t <= 1.85e-298)
		tmp = z * (y / t);
	elseif (t <= 2.45e-144)
		tmp = x * (y / -t);
	elseif (t <= 8.5e-26)
		tmp = t_1;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -1.6e+115], x, If[LessEqual[t, -5.5e-88], t$95$1, If[LessEqual[t, -1.1e-126], N[(z * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.85e-298], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.45e-144], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-26], t$95$1, x]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot y}{t}\\
\mathbf{if}\;t \leq -1.6 \cdot 10^{+115}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;t \leq -1.1 \cdot 10^{-126}:\\
\;\;\;\;z \cdot \frac{x}{z}\\

\mathbf{elif}\;t \leq 1.85 \cdot 10^{-298}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;t \leq 2.45 \cdot 10^{-144}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\

\mathbf{elif}\;t \leq 8.5 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if t < -1.6e115 or 8.50000000000000004e-26 < t

    1. Initial program 89.0%

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

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

    if -1.6e115 < t < -5.49999999999999971e-88 or 2.45000000000000005e-144 < t < 8.50000000000000004e-26

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr99.7%

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

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

    if -5.49999999999999971e-88 < t < -1.10000000000000007e-126

    1. Initial program 100.0%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 74.8%

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

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

    if -1.10000000000000007e-126 < t < 1.8499999999999999e-298

    1. Initial program 99.9%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 73.5%

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

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

    if 1.8499999999999999e-298 < t < 2.45000000000000005e-144

    1. Initial program 96.1%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr96.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(-x\right)} \]
    10. Simplified70.1%

      \[\leadsto \color{blue}{\frac{y}{t} \cdot \left(-x\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification67.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{+115}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -5.5 \cdot 10^{-88}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;t \leq -1.1 \cdot 10^{-126}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 1.85 \cdot 10^{-298}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;t \leq 2.45 \cdot 10^{-144}:\\ \;\;\;\;x \cdot \frac{y}{-t}\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-26}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 52.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{z \cdot y}{t}\\ \mathbf{if}\;t \leq -1.6 \cdot 10^{+115}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.4 \cdot 10^{-82}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -1.2 \cdot 10^{-126}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 4.9 \cdot 10^{-297}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;t \leq 1.22 \cdot 10^{-145}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-26}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (* z y) t)))
   (if (<= t -1.6e+115)
     x
     (if (<= t -1.4e-82)
       t_1
       (if (<= t -1.2e-126)
         (* z (/ x z))
         (if (<= t 4.9e-297)
           (* z (/ y t))
           (if (<= t 1.22e-145)
             (* (/ x t) (- y))
             (if (<= t 3.4e-26) t_1 x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (z * y) / t;
	double tmp;
	if (t <= -1.6e+115) {
		tmp = x;
	} else if (t <= -1.4e-82) {
		tmp = t_1;
	} else if (t <= -1.2e-126) {
		tmp = z * (x / z);
	} else if (t <= 4.9e-297) {
		tmp = z * (y / t);
	} else if (t <= 1.22e-145) {
		tmp = (x / t) * -y;
	} else if (t <= 3.4e-26) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = (z * y) / t
    if (t <= (-1.6d+115)) then
        tmp = x
    else if (t <= (-1.4d-82)) then
        tmp = t_1
    else if (t <= (-1.2d-126)) then
        tmp = z * (x / z)
    else if (t <= 4.9d-297) then
        tmp = z * (y / t)
    else if (t <= 1.22d-145) then
        tmp = (x / t) * -y
    else if (t <= 3.4d-26) 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 t_1 = (z * y) / t;
	double tmp;
	if (t <= -1.6e+115) {
		tmp = x;
	} else if (t <= -1.4e-82) {
		tmp = t_1;
	} else if (t <= -1.2e-126) {
		tmp = z * (x / z);
	} else if (t <= 4.9e-297) {
		tmp = z * (y / t);
	} else if (t <= 1.22e-145) {
		tmp = (x / t) * -y;
	} else if (t <= 3.4e-26) {
		tmp = t_1;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (z * y) / t
	tmp = 0
	if t <= -1.6e+115:
		tmp = x
	elif t <= -1.4e-82:
		tmp = t_1
	elif t <= -1.2e-126:
		tmp = z * (x / z)
	elif t <= 4.9e-297:
		tmp = z * (y / t)
	elif t <= 1.22e-145:
		tmp = (x / t) * -y
	elif t <= 3.4e-26:
		tmp = t_1
	else:
		tmp = x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(z * y) / t)
	tmp = 0.0
	if (t <= -1.6e+115)
		tmp = x;
	elseif (t <= -1.4e-82)
		tmp = t_1;
	elseif (t <= -1.2e-126)
		tmp = Float64(z * Float64(x / z));
	elseif (t <= 4.9e-297)
		tmp = Float64(z * Float64(y / t));
	elseif (t <= 1.22e-145)
		tmp = Float64(Float64(x / t) * Float64(-y));
	elseif (t <= 3.4e-26)
		tmp = t_1;
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (z * y) / t;
	tmp = 0.0;
	if (t <= -1.6e+115)
		tmp = x;
	elseif (t <= -1.4e-82)
		tmp = t_1;
	elseif (t <= -1.2e-126)
		tmp = z * (x / z);
	elseif (t <= 4.9e-297)
		tmp = z * (y / t);
	elseif (t <= 1.22e-145)
		tmp = (x / t) * -y;
	elseif (t <= 3.4e-26)
		tmp = t_1;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -1.6e+115], x, If[LessEqual[t, -1.4e-82], t$95$1, If[LessEqual[t, -1.2e-126], N[(z * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.9e-297], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.22e-145], N[(N[(x / t), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[t, 3.4e-26], t$95$1, x]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{z \cdot y}{t}\\
\mathbf{if}\;t \leq -1.6 \cdot 10^{+115}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -1.4 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -1.2 \cdot 10^{-126}:\\
\;\;\;\;z \cdot \frac{x}{z}\\

\mathbf{elif}\;t \leq 4.9 \cdot 10^{-297}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

\mathbf{elif}\;t \leq 1.22 \cdot 10^{-145}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\

\mathbf{elif}\;t \leq 3.4 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if t < -1.6e115 or 3.40000000000000013e-26 < t

    1. Initial program 89.0%

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

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

    if -1.6e115 < t < -1.40000000000000012e-82 or 1.2199999999999999e-145 < t < 3.40000000000000013e-26

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr99.7%

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

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

    if -1.40000000000000012e-82 < t < -1.20000000000000003e-126

    1. Initial program 100.0%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 74.8%

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

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

    if -1.20000000000000003e-126 < t < 4.89999999999999997e-297

    1. Initial program 99.9%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 73.5%

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

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

    if 4.89999999999999997e-297 < t < 1.2199999999999999e-145

    1. Initial program 96.1%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr96.6%

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{x \cdot \frac{y}{t}} \]
      3. distribute-rgt-neg-in70.1%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{y}{t}\right)} \]
      4. distribute-frac-neg70.1%

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

        \[\leadsto \color{blue}{\frac{x \cdot \left(-y\right)}{t}} \]
    10. Simplified66.9%

      \[\leadsto \color{blue}{\frac{x \cdot \left(-y\right)}{t}} \]
    11. Taylor expanded in x around 0 66.9%

      \[\leadsto \color{blue}{-1 \cdot \frac{x \cdot y}{t}} \]
    12. Step-by-step derivation
      1. mul-1-neg66.9%

        \[\leadsto \color{blue}{-\frac{x \cdot y}{t}} \]
      2. associate-*r/70.1%

        \[\leadsto -\color{blue}{x \cdot \frac{y}{t}} \]
      3. *-commutative70.1%

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

        \[\leadsto -\color{blue}{\frac{y \cdot x}{t}} \]
      5. distribute-frac-neg266.9%

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{-t}} \]
    13. Simplified70.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{+115}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -1.4 \cdot 10^{-82}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;t \leq -1.2 \cdot 10^{-126}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 4.9 \cdot 10^{-297}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;t \leq 1.22 \cdot 10^{-145}:\\ \;\;\;\;\frac{x}{t} \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-26}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.0% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \frac{y}{t}\\ t_2 := x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{+165}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+110}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+46}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+123}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (/ y t))) (t_2 (* x (- 1.0 (/ y t)))))
   (if (<= z -3.2e+165)
     t_1
     (if (<= z -1.26e+110)
       t_2
       (if (<= z -5.2e+46) (/ (* z y) t) (if (<= z 1.8e+123) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double t_2 = x * (1.0 - (y / t));
	double tmp;
	if (z <= -3.2e+165) {
		tmp = t_1;
	} else if (z <= -1.26e+110) {
		tmp = t_2;
	} else if (z <= -5.2e+46) {
		tmp = (z * y) / t;
	} else if (z <= 1.8e+123) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = z * (y / t)
    t_2 = x * (1.0d0 - (y / t))
    if (z <= (-3.2d+165)) then
        tmp = t_1
    else if (z <= (-1.26d+110)) then
        tmp = t_2
    else if (z <= (-5.2d+46)) then
        tmp = (z * y) / t
    else if (z <= 1.8d+123) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * (y / t);
	double t_2 = x * (1.0 - (y / t));
	double tmp;
	if (z <= -3.2e+165) {
		tmp = t_1;
	} else if (z <= -1.26e+110) {
		tmp = t_2;
	} else if (z <= -5.2e+46) {
		tmp = (z * y) / t;
	} else if (z <= 1.8e+123) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (y / t)
	t_2 = x * (1.0 - (y / t))
	tmp = 0
	if z <= -3.2e+165:
		tmp = t_1
	elif z <= -1.26e+110:
		tmp = t_2
	elif z <= -5.2e+46:
		tmp = (z * y) / t
	elif z <= 1.8e+123:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(y / t))
	t_2 = Float64(x * Float64(1.0 - Float64(y / t)))
	tmp = 0.0
	if (z <= -3.2e+165)
		tmp = t_1;
	elseif (z <= -1.26e+110)
		tmp = t_2;
	elseif (z <= -5.2e+46)
		tmp = Float64(Float64(z * y) / t);
	elseif (z <= 1.8e+123)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (y / t);
	t_2 = x * (1.0 - (y / t));
	tmp = 0.0;
	if (z <= -3.2e+165)
		tmp = t_1;
	elseif (z <= -1.26e+110)
		tmp = t_2;
	elseif (z <= -5.2e+46)
		tmp = (z * y) / t;
	elseif (z <= 1.8e+123)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+165], t$95$1, If[LessEqual[z, -1.26e+110], t$95$2, If[LessEqual[z, -5.2e+46], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.8e+123], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.26 \cdot 10^{+110}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;z \leq -5.2 \cdot 10^{+46}:\\
\;\;\;\;\frac{z \cdot y}{t}\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{+123}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.2e165 or 1.79999999999999999e123 < z

    1. Initial program 91.0%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 92.1%

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

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

    if -3.2e165 < z < -1.25999999999999992e110 or -5.20000000000000027e46 < z < 1.79999999999999999e123

    1. Initial program 95.5%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg81.9%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y}{t}\right)}\right) \]
      2. unsub-neg81.9%

        \[\leadsto x \cdot \color{blue}{\left(1 - \frac{y}{t}\right)} \]
    5. Simplified81.9%

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

    if -1.25999999999999992e110 < z < -5.20000000000000027e46

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr99.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{+165}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+110}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{elif}\;z \leq -5.2 \cdot 10^{+46}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{+123}:\\ \;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 54.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+116}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -2.9 \cdot 10^{-85}:\\
\;\;\;\;\frac{z \cdot y}{t}\\

\mathbf{elif}\;t \leq -1.2 \cdot 10^{-126}:\\
\;\;\;\;z \cdot \frac{x}{z}\\

\mathbf{elif}\;t \leq 4.4 \cdot 10^{-26}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.4500000000000001e116 or 4.4000000000000002e-26 < t

    1. Initial program 89.0%

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

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

    if -1.4500000000000001e116 < t < -2.9000000000000002e-85

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr99.7%

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

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

    if -2.9000000000000002e-85 < t < -1.20000000000000003e-126

    1. Initial program 100.0%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 74.8%

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

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

    if -1.20000000000000003e-126 < t < 4.4000000000000002e-26

    1. Initial program 98.9%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 66.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.45 \cdot 10^{+116}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq -2.9 \cdot 10^{-85}:\\ \;\;\;\;\frac{z \cdot y}{t}\\ \mathbf{elif}\;t \leq -1.2 \cdot 10^{-126}:\\ \;\;\;\;z \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{-26}:\\ \;\;\;\;z \cdot \frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 54.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+115}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq -9.8 \cdot 10^{-88}:\\
\;\;\;\;y \cdot \frac{z}{t}\\

\mathbf{elif}\;t \leq -1.2 \cdot 10^{-126}:\\
\;\;\;\;z \cdot \frac{x}{z}\\

\mathbf{elif}\;t \leq 6.5 \cdot 10^{-26}:\\
\;\;\;\;z \cdot \frac{y}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -1.65000000000000003e115 or 6.5e-26 < t

    1. Initial program 89.0%

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

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

    if -1.65000000000000003e115 < t < -9.80000000000000055e-88

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr99.7%

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

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

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

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

    if -9.80000000000000055e-88 < t < -1.20000000000000003e-126

    1. Initial program 100.0%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 74.8%

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

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

    if -1.20000000000000003e-126 < t < 6.5e-26

    1. Initial program 98.9%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 66.8%

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

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

Alternative 7: 84.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-58}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\

\mathbf{elif}\;z \leq 4 \cdot 10^{-38}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.60000000000000007e-58

    1. Initial program 97.5%

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

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

    if -2.60000000000000007e-58 < z < 3.9999999999999998e-38

    1. Initial program 94.5%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg91.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y}{t}\right)}\right) \]
      2. unsub-neg91.5%

        \[\leadsto x \cdot \color{blue}{\left(1 - \frac{y}{t}\right)} \]
    5. Simplified91.5%

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

    if 3.9999999999999998e-38 < z

    1. Initial program 91.8%

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

      \[\leadsto x + \color{blue}{\frac{y \cdot z}{t}} \]
    4. Taylor expanded in z around inf 92.4%

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

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

Alternative 8: 84.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-100} \lor \neg \left(t \leq 5.4 \cdot 10^{-98}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.14999999999999997e-100 or 5.3999999999999997e-98 < t

    1. Initial program 92.5%

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified90.7%

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

    if -1.14999999999999997e-100 < t < 5.3999999999999997e-98

    1. Initial program 98.8%

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

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

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

Alternative 9: 84.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-104} \lor \neg \left(t \leq 7 \cdot 10^{-96}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.4999999999999998e-104 or 6.9999999999999998e-96 < t

    1. Initial program 92.5%

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

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

        \[\leadsto x + \color{blue}{y \cdot \frac{z}{t}} \]
    5. Simplified90.7%

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

    if -5.4999999999999998e-104 < t < 6.9999999999999998e-96

    1. Initial program 98.8%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr97.8%

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

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

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

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

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

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

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

Alternative 10: 75.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{+71} \lor \neg \left(t \leq 6.4 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.55000000000000009e71 or 6.4000000000000002e-26 < t

    1. Initial program 89.6%

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\frac{y}{t}\right)}\right) \]
      2. unsub-neg78.6%

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

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

    if -1.55000000000000009e71 < t < 6.4000000000000002e-26

    1. Initial program 99.2%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr98.5%

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

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

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

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

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

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

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

Alternative 11: 77.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-83} \lor \neg \left(x \leq 3.1 \cdot 10^{-25}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.00000000000000061e-83 or 3.09999999999999995e-25 < x

    1. Initial program 94.1%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{y}{t}\right)} \]
    4. Step-by-step derivation
      1. mul-1-neg84.1%

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \frac{y}{t}\right)} \]
    5. Simplified84.1%

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

    if -7.00000000000000061e-83 < x < 3.09999999999999995e-25

    1. Initial program 95.8%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr96.8%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{z - x}{t}} \]
    7. Simplified69.6%

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

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

Alternative 12: 51.7% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{+46} \lor \neg \left(z \leq 3.7 \cdot 10^{-53}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.0199999999999999e46 or 3.69999999999999982e-53 < z

    1. Initial program 94.2%

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(z - x, \frac{y}{t}, x\right)} \]
    4. Applied egg-rr98.5%

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

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

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

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

    if -1.0199999999999999e46 < z < 3.69999999999999982e-53

    1. Initial program 95.2%

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

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

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

Alternative 13: 97.8% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto x + \left(\color{blue}{z \cdot \frac{y}{t}} + -1 \cdot \frac{x \cdot y}{t}\right) \]
    4. mul-1-neg89.6%

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

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

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

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

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

    \[\leadsto x + \color{blue}{\frac{y}{t} \cdot \left(z - x\right)} \]
  6. Final simplification98.8%

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

Alternative 14: 38.5% accurate, 9.0× speedup?

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

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

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

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

Developer target: 91.2% accurate, 0.6× speedup?

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

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

Reproduce

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

  :alt
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

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