Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C

Percentage Accurate: 94.6% → 97.9%
Time: 8.9s
Alternatives: 12
Speedup: 0.3×

Specification

?
\[\begin{array}{l} \\ x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
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) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t):
	return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t)
	return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
end
function tmp = code(x, y, z, t)
	tmp = x * ((y / z) - (t / (1.0 - z)));
end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

\[\begin{array}{l} \\ x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
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) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
	return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t):
	return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t)
	return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
end
function tmp = code(x, y, z, t)
	tmp = x * ((y / z) - (t / (1.0 - z)));
end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 97.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{y}{z} + \frac{t}{-1 + z}\\ \mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 4 \cdot 10^{+291}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (/ y z) (/ t (+ -1.0 z)))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e+291)))
     (* y (/ x z))
     (* x t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = (y / z) + (t / (-1.0 + z));
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 4e+291)) {
		tmp = y * (x / z);
	} else {
		tmp = x * t_1;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (y / z) + (t / (-1.0 + z));
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 4e+291)) {
		tmp = y * (x / z);
	} else {
		tmp = x * t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (y / z) + (t / (-1.0 + z))
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 4e+291):
		tmp = y * (x / z)
	else:
		tmp = x * t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(y / z) + Float64(t / Float64(-1.0 + z)))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 4e+291))
		tmp = Float64(y * Float64(x / z));
	else
		tmp = Float64(x * t_1);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (y / z) + (t / (-1.0 + z));
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 4e+291)))
		tmp = y * (x / z);
	else
		tmp = x * t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e+291]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * t$95$1), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{-1 + z}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 4 \cdot 10^{+291}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 3.9999999999999998e291 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z)))

    1. Initial program 65.6%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. associate-/r/66.3%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified66.3%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr99.9%

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

    if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 3.9999999999999998e291

    1. Initial program 99.3%

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

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

Alternative 2: 70.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \frac{x}{-1 + z}\\ t_2 := y \cdot \frac{x}{z}\\ \mathbf{if}\;t \leq -4.8 \cdot 10^{+157}:\\ \;\;\;\;\frac{x}{\frac{z}{t}}\\ \mathbf{elif}\;t \leq -4.8 \cdot 10^{+93}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -4.5 \cdot 10^{+55}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.06 \cdot 10^{-298}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+48}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (/ x (+ -1.0 z)))) (t_2 (* y (/ x z))))
   (if (<= t -4.8e+157)
     (/ x (/ z t))
     (if (<= t -4.8e+93)
       t_2
       (if (<= t -4.5e+55)
         t_1
         (if (<= t 1.06e-298) (* x (/ y z)) (if (<= t 2.3e+48) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (x / (-1.0 + z));
	double t_2 = y * (x / z);
	double tmp;
	if (t <= -4.8e+157) {
		tmp = x / (z / t);
	} else if (t <= -4.8e+93) {
		tmp = t_2;
	} else if (t <= -4.5e+55) {
		tmp = t_1;
	} else if (t <= 1.06e-298) {
		tmp = x * (y / z);
	} else if (t <= 2.3e+48) {
		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 = t * (x / ((-1.0d0) + z))
    t_2 = y * (x / z)
    if (t <= (-4.8d+157)) then
        tmp = x / (z / t)
    else if (t <= (-4.8d+93)) then
        tmp = t_2
    else if (t <= (-4.5d+55)) then
        tmp = t_1
    else if (t <= 1.06d-298) then
        tmp = x * (y / z)
    else if (t <= 2.3d+48) 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 = t * (x / (-1.0 + z));
	double t_2 = y * (x / z);
	double tmp;
	if (t <= -4.8e+157) {
		tmp = x / (z / t);
	} else if (t <= -4.8e+93) {
		tmp = t_2;
	} else if (t <= -4.5e+55) {
		tmp = t_1;
	} else if (t <= 1.06e-298) {
		tmp = x * (y / z);
	} else if (t <= 2.3e+48) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (x / (-1.0 + z))
	t_2 = y * (x / z)
	tmp = 0
	if t <= -4.8e+157:
		tmp = x / (z / t)
	elif t <= -4.8e+93:
		tmp = t_2
	elif t <= -4.5e+55:
		tmp = t_1
	elif t <= 1.06e-298:
		tmp = x * (y / z)
	elif t <= 2.3e+48:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(x / Float64(-1.0 + z)))
	t_2 = Float64(y * Float64(x / z))
	tmp = 0.0
	if (t <= -4.8e+157)
		tmp = Float64(x / Float64(z / t));
	elseif (t <= -4.8e+93)
		tmp = t_2;
	elseif (t <= -4.5e+55)
		tmp = t_1;
	elseif (t <= 1.06e-298)
		tmp = Float64(x * Float64(y / z));
	elseif (t <= 2.3e+48)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (x / (-1.0 + z));
	t_2 = y * (x / z);
	tmp = 0.0;
	if (t <= -4.8e+157)
		tmp = x / (z / t);
	elseif (t <= -4.8e+93)
		tmp = t_2;
	elseif (t <= -4.5e+55)
		tmp = t_1;
	elseif (t <= 1.06e-298)
		tmp = x * (y / z);
	elseif (t <= 2.3e+48)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.8e+157], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.8e+93], t$95$2, If[LessEqual[t, -4.5e+55], t$95$1, If[LessEqual[t, 1.06e-298], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e+48], t$95$2, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{-1 + z}\\
t_2 := y \cdot \frac{x}{z}\\
\mathbf{if}\;t \leq -4.8 \cdot 10^{+157}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\

\mathbf{elif}\;t \leq -4.8 \cdot 10^{+93}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq -4.5 \cdot 10^{+55}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;t \leq 2.3 \cdot 10^{+48}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -4.7999999999999999e157

    1. Initial program 97.3%

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

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

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg83.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv83.0%

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-183.0%

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

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

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

        \[\leadsto \frac{-\color{blue}{x \cdot \left(-1 \cdot y - t\right)}}{z} \]
      11. distribute-neg-frac83.0%

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

        \[\leadsto -\color{blue}{x \cdot \frac{-1 \cdot y - t}{z}} \]
      13. distribute-rgt-neg-in87.7%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{-1 \cdot y - t}{z}\right)} \]
      14. distribute-neg-frac87.7%

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

      \[\leadsto \color{blue}{x \cdot \frac{t + y}{z}} \]
    6. Step-by-step derivation
      1. clear-num87.7%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{t + y}}} \]
      2. un-div-inv87.8%

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

        \[\leadsto \frac{x}{\frac{z}{\color{blue}{y + t}}} \]
    7. Applied egg-rr87.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + t}}} \]
    8. Taylor expanded in y around 0 83.0%

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

    if -4.7999999999999999e157 < t < -4.80000000000000021e93 or 1.0600000000000001e-298 < t < 2.3e48

    1. Initial program 92.3%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified73.6%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr76.2%

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

    if -4.80000000000000021e93 < t < -4.49999999999999998e55 or 2.3e48 < t

    1. Initial program 95.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg68.8%

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

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

        \[\leadsto \color{blue}{t \cdot \left(-\frac{x}{1 - z}\right)} \]
      4. distribute-neg-frac268.7%

        \[\leadsto t \cdot \color{blue}{\frac{x}{-\left(1 - z\right)}} \]
      5. neg-sub068.7%

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-68.7%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval68.7%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified68.7%

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

    if -4.49999999999999998e55 < t < 1.0600000000000001e-298

    1. Initial program 96.3%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    5. Simplified89.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.8 \cdot 10^{+157}:\\ \;\;\;\;\frac{x}{\frac{z}{t}}\\ \mathbf{elif}\;t \leq -4.8 \cdot 10^{+93}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;t \leq -4.5 \cdot 10^{+55}:\\ \;\;\;\;t \cdot \frac{x}{-1 + z}\\ \mathbf{elif}\;t \leq 1.06 \cdot 10^{-298}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;t \leq 2.3 \cdot 10^{+48}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{-1 + z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 73.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\frac{y}{z} - t\right)\\ \mathbf{if}\;z \leq -1.65 \cdot 10^{+54}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-217}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-144}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+26}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{t}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- (/ y z) t))))
   (if (<= z -1.65e+54)
     (* x (/ t z))
     (if (<= z 3.2e-217)
       t_1
       (if (<= z 1.65e-144)
         (* y (/ x z))
         (if (<= z 3.5e+26) t_1 (/ x (/ z t))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - t);
	double tmp;
	if (z <= -1.65e+54) {
		tmp = x * (t / z);
	} else if (z <= 3.2e-217) {
		tmp = t_1;
	} else if (z <= 1.65e-144) {
		tmp = y * (x / z);
	} else if (z <= 3.5e+26) {
		tmp = t_1;
	} else {
		tmp = x / (z / 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) :: t_1
    real(8) :: tmp
    t_1 = x * ((y / z) - t)
    if (z <= (-1.65d+54)) then
        tmp = x * (t / z)
    else if (z <= 3.2d-217) then
        tmp = t_1
    else if (z <= 1.65d-144) then
        tmp = y * (x / z)
    else if (z <= 3.5d+26) then
        tmp = t_1
    else
        tmp = x / (z / t)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - t);
	double tmp;
	if (z <= -1.65e+54) {
		tmp = x * (t / z);
	} else if (z <= 3.2e-217) {
		tmp = t_1;
	} else if (z <= 1.65e-144) {
		tmp = y * (x / z);
	} else if (z <= 3.5e+26) {
		tmp = t_1;
	} else {
		tmp = x / (z / t);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * ((y / z) - t)
	tmp = 0
	if z <= -1.65e+54:
		tmp = x * (t / z)
	elif z <= 3.2e-217:
		tmp = t_1
	elif z <= 1.65e-144:
		tmp = y * (x / z)
	elif z <= 3.5e+26:
		tmp = t_1
	else:
		tmp = x / (z / t)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(Float64(y / z) - t))
	tmp = 0.0
	if (z <= -1.65e+54)
		tmp = Float64(x * Float64(t / z));
	elseif (z <= 3.2e-217)
		tmp = t_1;
	elseif (z <= 1.65e-144)
		tmp = Float64(y * Float64(x / z));
	elseif (z <= 3.5e+26)
		tmp = t_1;
	else
		tmp = Float64(x / Float64(z / t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * ((y / z) - t);
	tmp = 0.0;
	if (z <= -1.65e+54)
		tmp = x * (t / z);
	elseif (z <= 3.2e-217)
		tmp = t_1;
	elseif (z <= 1.65e-144)
		tmp = y * (x / z);
	elseif (z <= 3.5e+26)
		tmp = t_1;
	else
		tmp = x / (z / t);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.65e+54], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e-217], t$95$1, If[LessEqual[z, 1.65e-144], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.5e+26], t$95$1, N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-217}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 3.5 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\


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

    1. Initial program 97.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg72.6%

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

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

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

        \[\leadsto t \cdot \color{blue}{\frac{x}{-\left(1 - z\right)}} \]
      5. neg-sub067.4%

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-67.4%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval67.4%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified67.4%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around inf 72.6%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. *-commutative72.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
    8. Simplified76.1%

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

    if -1.65e54 < z < 3.2000000000000001e-217 or 1.64999999999999998e-144 < z < 3.4999999999999999e26

    1. Initial program 94.9%

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

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

    if 3.2000000000000001e-217 < z < 1.64999999999999998e-144

    1. Initial program 73.1%

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{1 - z} \cdot t}\right) \]
    4. Applied egg-rr73.1%

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. associate-/r/74.5%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified74.5%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr99.5%

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

    if 3.4999999999999999e26 < z

    1. Initial program 99.8%

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

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

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg92.7%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv92.7%

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-192.7%

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

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

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

        \[\leadsto \frac{-\color{blue}{x \cdot \left(-1 \cdot y - t\right)}}{z} \]
      11. distribute-neg-frac92.7%

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

        \[\leadsto -\color{blue}{x \cdot \frac{-1 \cdot y - t}{z}} \]
      13. distribute-rgt-neg-in99.8%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{-1 \cdot y - t}{z}\right)} \]
      14. distribute-neg-frac99.8%

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

      \[\leadsto \color{blue}{x \cdot \frac{t + y}{z}} \]
    6. Step-by-step derivation
      1. clear-num99.6%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{t + y}}} \]
      2. un-div-inv99.6%

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

        \[\leadsto \frac{x}{\frac{z}{\color{blue}{y + t}}} \]
    7. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + t}}} \]
    8. Taylor expanded in y around 0 72.5%

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{t}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification83.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+54}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-217}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-144}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{t}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 92.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\frac{y}{z} - t\right)\\ t_2 := x \cdot \frac{y + t}{z}\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-217}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-144}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- (/ y z) t))) (t_2 (* x (/ (+ y t) z))))
   (if (<= z -1.0)
     t_2
     (if (<= z 5.5e-217)
       t_1
       (if (<= z 1.65e-144) (* y (/ x z)) (if (<= z 1.0) t_1 t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - t);
	double t_2 = x * ((y + t) / z);
	double tmp;
	if (z <= -1.0) {
		tmp = t_2;
	} else if (z <= 5.5e-217) {
		tmp = t_1;
	} else if (z <= 1.65e-144) {
		tmp = y * (x / z);
	} else if (z <= 1.0) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	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 = x * ((y / z) - t)
    t_2 = x * ((y + t) / z)
    if (z <= (-1.0d0)) then
        tmp = t_2
    else if (z <= 5.5d-217) then
        tmp = t_1
    else if (z <= 1.65d-144) then
        tmp = y * (x / z)
    else if (z <= 1.0d0) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - t);
	double t_2 = x * ((y + t) / z);
	double tmp;
	if (z <= -1.0) {
		tmp = t_2;
	} else if (z <= 5.5e-217) {
		tmp = t_1;
	} else if (z <= 1.65e-144) {
		tmp = y * (x / z);
	} else if (z <= 1.0) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * ((y / z) - t)
	t_2 = x * ((y + t) / z)
	tmp = 0
	if z <= -1.0:
		tmp = t_2
	elif z <= 5.5e-217:
		tmp = t_1
	elif z <= 1.65e-144:
		tmp = y * (x / z)
	elif z <= 1.0:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(Float64(y / z) - t))
	t_2 = Float64(x * Float64(Float64(y + t) / z))
	tmp = 0.0
	if (z <= -1.0)
		tmp = t_2;
	elseif (z <= 5.5e-217)
		tmp = t_1;
	elseif (z <= 1.65e-144)
		tmp = Float64(y * Float64(x / z));
	elseif (z <= 1.0)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * ((y / z) - t);
	t_2 = x * ((y + t) / z);
	tmp = 0.0;
	if (z <= -1.0)
		tmp = t_2;
	elseif (z <= 5.5e-217)
		tmp = t_1;
	elseif (z <= 1.65e-144)
		tmp = y * (x / z);
	elseif (z <= 1.0)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$2, If[LessEqual[z, 5.5e-217], t$95$1, If[LessEqual[z, 1.65e-144], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 99.0%

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

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

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg90.2%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv90.2%

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-190.2%

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

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

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

        \[\leadsto \frac{-\color{blue}{x \cdot \left(-1 \cdot y - t\right)}}{z} \]
      11. distribute-neg-frac90.2%

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

        \[\leadsto -\color{blue}{x \cdot \frac{-1 \cdot y - t}{z}} \]
      13. distribute-rgt-neg-in98.4%

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

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

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

    if -1 < z < 5.49999999999999975e-217 or 1.64999999999999998e-144 < z < 1

    1. Initial program 94.1%

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

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

    if 5.49999999999999975e-217 < z < 1.64999999999999998e-144

    1. Initial program 73.1%

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{1 - z} \cdot t}\right) \]
    4. Applied egg-rr73.1%

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. associate-/r/74.5%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified74.5%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr99.5%

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

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

Alternative 5: 92.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\frac{y}{z} - t\right)\\ \mathbf{if}\;z \leq -1:\\ \;\;\;\;x \cdot \left(\frac{y}{z} + \frac{t}{z}\right)\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-217}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-144}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y + t}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- (/ y z) t))))
   (if (<= z -1.0)
     (* x (+ (/ y z) (/ t z)))
     (if (<= z 5.4e-217)
       t_1
       (if (<= z 1.65e-144)
         (* y (/ x z))
         (if (<= z 1.0) t_1 (* x (/ (+ y t) z))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - t);
	double tmp;
	if (z <= -1.0) {
		tmp = x * ((y / z) + (t / z));
	} else if (z <= 5.4e-217) {
		tmp = t_1;
	} else if (z <= 1.65e-144) {
		tmp = y * (x / z);
	} else if (z <= 1.0) {
		tmp = t_1;
	} else {
		tmp = x * ((y + t) / 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) :: t_1
    real(8) :: tmp
    t_1 = x * ((y / z) - t)
    if (z <= (-1.0d0)) then
        tmp = x * ((y / z) + (t / z))
    else if (z <= 5.4d-217) then
        tmp = t_1
    else if (z <= 1.65d-144) then
        tmp = y * (x / z)
    else if (z <= 1.0d0) then
        tmp = t_1
    else
        tmp = x * ((y + t) / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - t);
	double tmp;
	if (z <= -1.0) {
		tmp = x * ((y / z) + (t / z));
	} else if (z <= 5.4e-217) {
		tmp = t_1;
	} else if (z <= 1.65e-144) {
		tmp = y * (x / z);
	} else if (z <= 1.0) {
		tmp = t_1;
	} else {
		tmp = x * ((y + t) / z);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * ((y / z) - t)
	tmp = 0
	if z <= -1.0:
		tmp = x * ((y / z) + (t / z))
	elif z <= 5.4e-217:
		tmp = t_1
	elif z <= 1.65e-144:
		tmp = y * (x / z)
	elif z <= 1.0:
		tmp = t_1
	else:
		tmp = x * ((y + t) / z)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(Float64(y / z) - t))
	tmp = 0.0
	if (z <= -1.0)
		tmp = Float64(x * Float64(Float64(y / z) + Float64(t / z)));
	elseif (z <= 5.4e-217)
		tmp = t_1;
	elseif (z <= 1.65e-144)
		tmp = Float64(y * Float64(x / z));
	elseif (z <= 1.0)
		tmp = t_1;
	else
		tmp = Float64(x * Float64(Float64(y + t) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * ((y / z) - t);
	tmp = 0.0;
	if (z <= -1.0)
		tmp = x * ((y / z) + (t / z));
	elseif (z <= 5.4e-217)
		tmp = t_1;
	elseif (z <= 1.65e-144)
		tmp = y * (x / z);
	elseif (z <= 1.0)
		tmp = t_1;
	else
		tmp = x * ((y + t) / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.4e-217], t$95$1, If[LessEqual[z, 1.65e-144], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], t$95$1, N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq 5.4 \cdot 10^{-217}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 98.3%

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

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

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg87.6%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv87.6%

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-187.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \left(-\frac{-1 \cdot y - t}{z}\right)} \]
      14. distribute-neg-frac97.3%

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

      \[\leadsto \color{blue}{x \cdot \frac{t + y}{z}} \]
    6. Taylor expanded in t around 0 97.3%

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

    if -1 < z < 5.40000000000000032e-217 or 1.64999999999999998e-144 < z < 1

    1. Initial program 94.1%

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

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

    if 5.40000000000000032e-217 < z < 1.64999999999999998e-144

    1. Initial program 73.1%

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

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

        \[\leadsto x \cdot \left(\frac{y}{z} - \color{blue}{\frac{1}{1 - z} \cdot t}\right) \]
    4. Applied egg-rr73.1%

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. associate-/r/74.5%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified74.5%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr99.5%

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

    if 1 < z

    1. Initial program 99.8%

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

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

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg93.3%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv93.3%

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-193.3%

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

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

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

        \[\leadsto \frac{-\color{blue}{x \cdot \left(-1 \cdot y - t\right)}}{z} \]
      11. distribute-neg-frac93.3%

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

        \[\leadsto -\color{blue}{x \cdot \frac{-1 \cdot y - t}{z}} \]
      13. distribute-rgt-neg-in99.8%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{-1 \cdot y - t}{z}\right)} \]
      14. distribute-neg-frac99.8%

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

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

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

Alternative 6: 88.5% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 7.9999999999999998e-154

    1. Initial program 93.2%

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

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

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

        \[\leadsto y \cdot \left(\color{blue}{\frac{t \cdot x}{-y \cdot \left(1 - z\right)}} + \frac{x}{z}\right) \]
      3. distribute-rgt-neg-in85.4%

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

        \[\leadsto y \cdot \left(\frac{t \cdot x}{y \cdot \color{blue}{\left(0 - \left(1 - z\right)\right)}} + \frac{x}{z}\right) \]
      5. associate--r-85.4%

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

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

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

    if 7.9999999999999998e-154 < x

    1. Initial program 97.9%

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

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

Alternative 7: 43.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\

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


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

    1. Initial program 99.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg64.3%

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

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

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

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

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-59.1%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval59.1%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified59.1%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around inf 63.8%

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

        \[\leadsto \color{blue}{t \cdot \frac{x}{z}} \]
    8. Simplified58.6%

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

    if -1 < z < 1

    1. Initial program 91.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg34.6%

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

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

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

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

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-34.6%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval34.6%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified34.6%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around 0 33.3%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    7. Step-by-step derivation
      1. associate-*r*33.3%

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot x} \]
      2. neg-mul-133.3%

        \[\leadsto \color{blue}{\left(-t\right)} \cdot x \]
      3. *-commutative33.3%

        \[\leadsto \color{blue}{x \cdot \left(-t\right)} \]
    8. Simplified33.3%

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

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

Alternative 8: 45.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\

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


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

    1. Initial program 99.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg64.3%

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

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

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

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

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-59.1%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval59.1%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified59.1%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around inf 63.8%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. *-commutative63.8%

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

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
    8. Simplified67.5%

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

    if -1 < z < 1

    1. Initial program 91.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg34.6%

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

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

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

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

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-34.6%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval34.6%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified34.6%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around 0 33.3%

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
    7. Step-by-step derivation
      1. associate-*r*33.3%

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot x} \]
      2. neg-mul-133.3%

        \[\leadsto \color{blue}{\left(-t\right)} \cdot x \]
      3. *-commutative33.3%

        \[\leadsto \color{blue}{x \cdot \left(-t\right)} \]
    8. Simplified33.3%

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

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

Alternative 9: 69.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.8 \cdot 10^{+157} \lor \neg \left(t \leq 3.3 \cdot 10^{+66}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -7.79999999999999941e157 or 3.3000000000000001e66 < t

    1. Initial program 95.5%

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-\frac{x}{1 - z}\right)} \]
      4. distribute-neg-frac266.7%

        \[\leadsto t \cdot \color{blue}{\frac{x}{-\left(1 - z\right)}} \]
      5. neg-sub066.7%

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-66.7%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval66.7%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified66.7%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around inf 60.7%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. *-commutative60.7%

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

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
    8. Simplified66.9%

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

    if -7.79999999999999941e157 < t < 3.3000000000000001e66

    1. Initial program 94.7%

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

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

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

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

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

Alternative 10: 67.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+163} \lor \neg \left(t \leq 3.7 \cdot 10^{+139}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.1e163 or 3.69999999999999992e139 < t

    1. Initial program 98.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg76.8%

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

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

        \[\leadsto \color{blue}{t \cdot \left(-\frac{x}{1 - z}\right)} \]
      4. distribute-neg-frac268.2%

        \[\leadsto t \cdot \color{blue}{\frac{x}{-\left(1 - z\right)}} \]
      5. neg-sub068.2%

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-68.2%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval68.2%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified68.2%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around inf 65.1%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. *-commutative65.1%

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

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
    8. Simplified72.5%

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

    if -2.1e163 < t < 3.69999999999999992e139

    1. Initial program 93.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. associate-/r/75.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified75.4%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr76.9%

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

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

Alternative 11: 67.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.6 \cdot 10^{+158}:\\ \;\;\;\;\frac{x}{\frac{z}{t}}\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{+138}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t -2.6e+158)
   (/ x (/ z t))
   (if (<= t 4.4e+138) (* y (/ x z)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.6e+158) {
		tmp = x / (z / t);
	} else if (t <= 4.4e+138) {
		tmp = y * (x / z);
	} else {
		tmp = x * (t / 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 (t <= (-2.6d+158)) then
        tmp = x / (z / t)
    else if (t <= 4.4d+138) then
        tmp = y * (x / z)
    else
        tmp = x * (t / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= -2.6e+158) {
		tmp = x / (z / t);
	} else if (t <= 4.4e+138) {
		tmp = y * (x / z);
	} else {
		tmp = x * (t / z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= -2.6e+158:
		tmp = x / (z / t)
	elif t <= 4.4e+138:
		tmp = y * (x / z)
	else:
		tmp = x * (t / z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= -2.6e+158)
		tmp = Float64(x / Float64(z / t));
	elseif (t <= 4.4e+138)
		tmp = Float64(y * Float64(x / z));
	else
		tmp = Float64(x * Float64(t / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= -2.6e+158)
		tmp = x / (z / t);
	elseif (t <= 4.4e+138)
		tmp = y * (x / z);
	else
		tmp = x * (t / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.6e+158], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e+138], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 97.3%

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

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

        \[\leadsto \frac{\color{blue}{\left(y - -1 \cdot t\right) \cdot x}}{z} \]
      2. remove-double-neg83.0%

        \[\leadsto \frac{\color{blue}{\left(-\left(-\left(y - -1 \cdot t\right)\right)\right)} \cdot x}{z} \]
      3. cancel-sign-sub-inv83.0%

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

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

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

        \[\leadsto \frac{\left(-\color{blue}{\left(\left(-y\right) + \left(-t\right)\right)}\right) \cdot x}{z} \]
      7. neg-mul-183.0%

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

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

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

        \[\leadsto \frac{-\color{blue}{x \cdot \left(-1 \cdot y - t\right)}}{z} \]
      11. distribute-neg-frac83.0%

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

        \[\leadsto -\color{blue}{x \cdot \frac{-1 \cdot y - t}{z}} \]
      13. distribute-rgt-neg-in87.7%

        \[\leadsto \color{blue}{x \cdot \left(-\frac{-1 \cdot y - t}{z}\right)} \]
      14. distribute-neg-frac87.7%

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

      \[\leadsto \color{blue}{x \cdot \frac{t + y}{z}} \]
    6. Step-by-step derivation
      1. clear-num87.7%

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{z}{t + y}}} \]
      2. un-div-inv87.8%

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

        \[\leadsto \frac{x}{\frac{z}{\color{blue}{y + t}}} \]
    7. Applied egg-rr87.8%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + t}}} \]
    8. Taylor expanded in y around 0 83.0%

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

    if -2.6e158 < t < 4.4000000000000001e138

    1. Initial program 93.5%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. associate-/r/75.4%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    7. Simplified75.4%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
    9. Applied egg-rr76.9%

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

    if 4.4000000000000001e138 < t

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
    4. Step-by-step derivation
      1. mul-1-neg70.2%

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

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

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

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

        \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
      6. associate--r-70.1%

        \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
      7. metadata-eval70.1%

        \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
    5. Simplified70.1%

      \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
    6. Taylor expanded in z around inf 51.0%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    7. Step-by-step derivation
      1. *-commutative51.0%

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

        \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
    8. Simplified61.2%

      \[\leadsto \color{blue}{x \cdot \frac{t}{z}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.6%

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

Alternative 12: 23.2% accurate, 2.8× speedup?

\[\begin{array}{l} \\ x \cdot \left(-t\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
	return 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 * -t
end function
public static double code(double x, double y, double z, double t) {
	return x * -t;
}
def code(x, y, z, t):
	return x * -t
function code(x, y, z, t)
	return Float64(x * Float64(-t))
end
function tmp = code(x, y, z, t)
	tmp = x * -t;
end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(-t\right)
\end{array}
Derivation
  1. Initial program 95.0%

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

    \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{1 - z}} \]
  4. Step-by-step derivation
    1. mul-1-neg49.0%

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

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

      \[\leadsto \color{blue}{t \cdot \left(-\frac{x}{1 - z}\right)} \]
    4. distribute-neg-frac246.5%

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

      \[\leadsto t \cdot \frac{x}{\color{blue}{0 - \left(1 - z\right)}} \]
    6. associate--r-46.5%

      \[\leadsto t \cdot \frac{x}{\color{blue}{\left(0 - 1\right) + z}} \]
    7. metadata-eval46.5%

      \[\leadsto t \cdot \frac{x}{\color{blue}{-1} + z} \]
  5. Simplified46.5%

    \[\leadsto \color{blue}{t \cdot \frac{x}{-1 + z}} \]
  6. Taylor expanded in z around 0 23.6%

    \[\leadsto \color{blue}{-1 \cdot \left(t \cdot x\right)} \]
  7. Step-by-step derivation
    1. associate-*r*23.6%

      \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot x} \]
    2. neg-mul-123.6%

      \[\leadsto \color{blue}{\left(-t\right)} \cdot x \]
    3. *-commutative23.6%

      \[\leadsto \color{blue}{x \cdot \left(-t\right)} \]
  8. Simplified23.6%

    \[\leadsto \color{blue}{x \cdot \left(-t\right)} \]
  9. Final simplification23.6%

    \[\leadsto x \cdot \left(-t\right) \]
  10. Add Preprocessing

Developer target: 95.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
        (t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
   (if (< t_2 -7.623226303312042e-196)
     t_1
     (if (< t_2 1.4133944927702302e-211)
       (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
       t_1))))
double code(double x, double y, double z, double t) {
	double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
	double t_2 = x * ((y / z) - (t / (1.0 - z)));
	double tmp;
	if (t_2 < -7.623226303312042e-196) {
		tmp = t_1;
	} else if (t_2 < 1.4133944927702302e-211) {
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
	} 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 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
    t_2 = x * ((y / z) - (t / (1.0d0 - z)))
    if (t_2 < (-7.623226303312042d-196)) then
        tmp = t_1
    else if (t_2 < 1.4133944927702302d-211) then
        tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
    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 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
	double t_2 = x * ((y / z) - (t / (1.0 - z)));
	double tmp;
	if (t_2 < -7.623226303312042e-196) {
		tmp = t_1;
	} else if (t_2 < 1.4133944927702302e-211) {
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))))
	t_2 = x * ((y / z) - (t / (1.0 - z)))
	tmp = 0
	if t_2 < -7.623226303312042e-196:
		tmp = t_1
	elif t_2 < 1.4133944927702302e-211:
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z)))))
	t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))))
	tmp = 0.0
	if (t_2 < -7.623226303312042e-196)
		tmp = t_1;
	elseif (t_2 < 1.4133944927702302e-211)
		tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z))));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
	t_2 = x * ((y / z) - (t / (1.0 - z)));
	tmp = 0.0;
	if (t_2 < -7.623226303312042e-196)
		tmp = t_1;
	elseif (t_2 < 1.4133944927702302e-211)
		tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024095 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
  :precision binary64

  :alt
  (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))

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