Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.7s
Alternatives: 15
Speedup: 1.0×

Specification

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

\\
x + \left(y - z\right) \cdot \left(t - x\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 15 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: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

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

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

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Step-by-step derivation
    1. +-commutative100.0%

      \[\leadsto \color{blue}{\left(y - z\right) \cdot \left(t - x\right) + x} \]
    2. fma-def100.0%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t - x, x\right)} \]
  4. Final simplification100.0%

    \[\leadsto \mathsf{fma}\left(y - z, t - x, x\right) \]

Alternative 2: 53.3% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;y - z \leq -4 \cdot 10^{-11}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y - z \leq 10^{-78}:\\
\;\;\;\;x\\

\mathbf{elif}\;y - z \leq 4 \cdot 10^{+222}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y - z \leq 4 \cdot 10^{+248}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;y - z \leq 5 \cdot 10^{+279}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (-.f64 y z) < -3.99999999999999976e-11 or 9.99999999999999999e-79 < (-.f64 y z) < 4.0000000000000002e222 or 4.00000000000000018e248 < (-.f64 y z) < 5.0000000000000002e279

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 95.8%

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

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

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

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+95.8%

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

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

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

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

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

    if -3.99999999999999976e-11 < (-.f64 y z) < 9.99999999999999999e-79

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 83.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    6. Taylor expanded in z around 0 83.3%

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

    if 4.0000000000000002e222 < (-.f64 y z) < 4.00000000000000018e248

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 100.0%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg100.0%

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

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

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

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

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

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

    if 5.0000000000000002e279 < (-.f64 y z)

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around inf 84.9%

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--84.9%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity84.9%

        \[\leadsto \color{blue}{x} - x \cdot \left(y - z\right) \]
    4. Simplified84.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y - z \leq -4 \cdot 10^{-11}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y - z \leq 10^{-78}:\\ \;\;\;\;x\\ \mathbf{elif}\;y - z \leq 4 \cdot 10^{+222}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y - z \leq 4 \cdot 10^{+248}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y - z \leq 5 \cdot 10^{+279}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]

Alternative 3: 69.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(z + 1\right)\\ t_2 := y \cdot \left(t - x\right)\\ t_3 := x - z \cdot t\\ \mathbf{if}\;y \leq -1.8 \cdot 10^{+42}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-209}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{-296}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{-192}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ z 1.0))) (t_2 (* y (- t x))) (t_3 (- x (* z t))))
   (if (<= y -1.8e+42)
     t_2
     (if (<= y -1e-209)
       t_3
       (if (<= y 2.7e-296)
         t_1
         (if (<= y 1.6e-192) t_3 (if (<= y 2.1e-10) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (z + 1.0);
	double t_2 = y * (t - x);
	double t_3 = x - (z * t);
	double tmp;
	if (y <= -1.8e+42) {
		tmp = t_2;
	} else if (y <= -1e-209) {
		tmp = t_3;
	} else if (y <= 2.7e-296) {
		tmp = t_1;
	} else if (y <= 1.6e-192) {
		tmp = t_3;
	} else if (y <= 2.1e-10) {
		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) :: t_3
    real(8) :: tmp
    t_1 = x * (z + 1.0d0)
    t_2 = y * (t - x)
    t_3 = x - (z * t)
    if (y <= (-1.8d+42)) then
        tmp = t_2
    else if (y <= (-1d-209)) then
        tmp = t_3
    else if (y <= 2.7d-296) then
        tmp = t_1
    else if (y <= 1.6d-192) then
        tmp = t_3
    else if (y <= 2.1d-10) 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 * (z + 1.0);
	double t_2 = y * (t - x);
	double t_3 = x - (z * t);
	double tmp;
	if (y <= -1.8e+42) {
		tmp = t_2;
	} else if (y <= -1e-209) {
		tmp = t_3;
	} else if (y <= 2.7e-296) {
		tmp = t_1;
	} else if (y <= 1.6e-192) {
		tmp = t_3;
	} else if (y <= 2.1e-10) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (z + 1.0)
	t_2 = y * (t - x)
	t_3 = x - (z * t)
	tmp = 0
	if y <= -1.8e+42:
		tmp = t_2
	elif y <= -1e-209:
		tmp = t_3
	elif y <= 2.7e-296:
		tmp = t_1
	elif y <= 1.6e-192:
		tmp = t_3
	elif y <= 2.1e-10:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(z + 1.0))
	t_2 = Float64(y * Float64(t - x))
	t_3 = Float64(x - Float64(z * t))
	tmp = 0.0
	if (y <= -1.8e+42)
		tmp = t_2;
	elseif (y <= -1e-209)
		tmp = t_3;
	elseif (y <= 2.7e-296)
		tmp = t_1;
	elseif (y <= 1.6e-192)
		tmp = t_3;
	elseif (y <= 2.1e-10)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (z + 1.0);
	t_2 = y * (t - x);
	t_3 = x - (z * t);
	tmp = 0.0;
	if (y <= -1.8e+42)
		tmp = t_2;
	elseif (y <= -1e-209)
		tmp = t_3;
	elseif (y <= 2.7e-296)
		tmp = t_1;
	elseif (y <= 1.6e-192)
		tmp = t_3;
	elseif (y <= 2.1e-10)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+42], t$95$2, If[LessEqual[y, -1e-209], t$95$3, If[LessEqual[y, 2.7e-296], t$95$1, If[LessEqual[y, 1.6e-192], t$95$3, If[LessEqual[y, 2.1e-10], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1 \cdot 10^{-209}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;y \leq 2.7 \cdot 10^{-296}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{-192}:\\
\;\;\;\;t_3\\

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

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.8e42 or 2.1e-10 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 93.9%

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

        \[\leadsto \color{blue}{t \cdot \left(y - z\right) + -1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      2. mul-1-neg93.9%

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

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+93.9%

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

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

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

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

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

    if -1.8e42 < y < -1e-209 or 2.69999999999999999e-296 < y < 1.6000000000000001e-192

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in t around inf 81.3%

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

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

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

        \[\leadsto x + \left(-\color{blue}{z \cdot t}\right) \]
      3. distribute-rgt-neg-in79.5%

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

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

    if -1e-209 < y < 2.69999999999999999e-296 or 1.6000000000000001e-192 < y < 2.1e-10

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 71.9%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg71.9%

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

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

        \[\leadsto \color{blue}{\left(y - \left(1 + z\right)\right) \cdot \left(-x\right)} \]
      4. +-commutative71.9%

        \[\leadsto \left(y - \color{blue}{\left(z + 1\right)}\right) \cdot \left(-x\right) \]
    4. Simplified71.9%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification80.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+42}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1 \cdot 10^{-209}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{-296}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{-192}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-10}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 4: 76.3% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq -1.2 \cdot 10^{-208}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;y \leq 8.6 \cdot 10^{-296}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

\mathbf{elif}\;y \leq 2.25 \cdot 10^{+24}:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.00000000000000009e42 or 2.2500000000000001e24 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 93.5%

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

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

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

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+93.5%

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

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

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

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

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

    if -2.00000000000000009e42 < y < -1.1999999999999999e-208 or 8.59999999999999956e-296 < y < 2.2500000000000001e24

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in t around inf 76.1%

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

    if -1.1999999999999999e-208 < y < 8.59999999999999956e-296

    1. Initial program 99.9%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 83.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg83.8%

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

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

        \[\leadsto \color{blue}{\left(y - \left(1 + z\right)\right) \cdot \left(-x\right)} \]
      4. +-commutative83.8%

        \[\leadsto \left(y - \color{blue}{\left(z + 1\right)}\right) \cdot \left(-x\right) \]
    4. Simplified83.8%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification83.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{+42}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-208}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 8.6 \cdot 10^{-296}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{+24}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 5: 76.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot t\\ \mathbf{if}\;y \leq -2.1 \cdot 10^{+42}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-209}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-295}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* (- y z) t))))
   (if (<= y -2.1e+42)
     (* y (- t x))
     (if (<= y -2.05e-209)
       t_1
       (if (<= y 3.1e-295)
         (* x (+ z 1.0))
         (if (<= y 1.9e-13) t_1 (- x (* y (- x t)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + ((y - z) * t);
	double tmp;
	if (y <= -2.1e+42) {
		tmp = y * (t - x);
	} else if (y <= -2.05e-209) {
		tmp = t_1;
	} else if (y <= 3.1e-295) {
		tmp = x * (z + 1.0);
	} else if (y <= 1.9e-13) {
		tmp = t_1;
	} else {
		tmp = x - (y * (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) :: t_1
    real(8) :: tmp
    t_1 = x + ((y - z) * t)
    if (y <= (-2.1d+42)) then
        tmp = y * (t - x)
    else if (y <= (-2.05d-209)) then
        tmp = t_1
    else if (y <= 3.1d-295) then
        tmp = x * (z + 1.0d0)
    else if (y <= 1.9d-13) then
        tmp = t_1
    else
        tmp = x - (y * (x - 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 (y <= -2.1e+42) {
		tmp = y * (t - x);
	} else if (y <= -2.05e-209) {
		tmp = t_1;
	} else if (y <= 3.1e-295) {
		tmp = x * (z + 1.0);
	} else if (y <= 1.9e-13) {
		tmp = t_1;
	} else {
		tmp = x - (y * (x - t));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((y - z) * t)
	tmp = 0
	if y <= -2.1e+42:
		tmp = y * (t - x)
	elif y <= -2.05e-209:
		tmp = t_1
	elif y <= 3.1e-295:
		tmp = x * (z + 1.0)
	elif y <= 1.9e-13:
		tmp = t_1
	else:
		tmp = x - (y * (x - t))
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(Float64(y - z) * t))
	tmp = 0.0
	if (y <= -2.1e+42)
		tmp = Float64(y * Float64(t - x));
	elseif (y <= -2.05e-209)
		tmp = t_1;
	elseif (y <= 3.1e-295)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (y <= 1.9e-13)
		tmp = t_1;
	else
		tmp = Float64(x - Float64(y * Float64(x - t)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + ((y - z) * t);
	tmp = 0.0;
	if (y <= -2.1e+42)
		tmp = y * (t - x);
	elseif (y <= -2.05e-209)
		tmp = t_1;
	elseif (y <= 3.1e-295)
		tmp = x * (z + 1.0);
	elseif (y <= 1.9e-13)
		tmp = t_1;
	else
		tmp = x - (y * (x - 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[y, -2.1e+42], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.05e-209], t$95$1, If[LessEqual[y, 3.1e-295], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e-13], t$95$1, N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.05 \cdot 10^{-209}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{-295}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{-13}:\\
\;\;\;\;t_1\\

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


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

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 98.3%

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

        \[\leadsto \color{blue}{t \cdot \left(y - z\right) + -1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      2. mul-1-neg98.3%

        \[\leadsto t \cdot \left(y - z\right) + \color{blue}{\left(-x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      3. unsub-neg98.3%

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+98.3%

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

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

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

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

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

    if -2.09999999999999995e42 < y < -2.04999999999999989e-209 or 3.1000000000000002e-295 < y < 1.9e-13

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in t around inf 77.1%

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

    if -2.04999999999999989e-209 < y < 3.1000000000000002e-295

    1. Initial program 99.9%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 83.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg83.8%

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

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

        \[\leadsto \color{blue}{\left(y - \left(1 + z\right)\right) \cdot \left(-x\right)} \]
      4. +-commutative83.8%

        \[\leadsto \left(y - \color{blue}{\left(z + 1\right)}\right) \cdot \left(-x\right) \]
    4. Simplified83.8%

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

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

    if 1.9e-13 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around inf 88.7%

      \[\leadsto x + \color{blue}{y \cdot \left(t - x\right)} \]
    3. Step-by-step derivation
      1. *-commutative88.7%

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

      \[\leadsto x + \color{blue}{\left(t - x\right) \cdot y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification83.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{+42}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-209}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-295}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-13}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \end{array} \]

Alternative 6: 80.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + \left(y - z\right) \cdot t\\ t_2 := x + x \cdot \left(z - y\right)\\ \mathbf{if}\;x \leq -2.8 \cdot 10^{+79}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+64}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{+124}:\\ \;\;\;\;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 (* x (- z y)))))
   (if (<= x -2.8e+79)
     t_2
     (if (<= x 1.1e+19)
       t_1
       (if (<= x 5.6e+64) (- x (* y (- x t))) (if (<= x 6.4e+124) 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 + (x * (z - y));
	double tmp;
	if (x <= -2.8e+79) {
		tmp = t_2;
	} else if (x <= 1.1e+19) {
		tmp = t_1;
	} else if (x <= 5.6e+64) {
		tmp = x - (y * (x - t));
	} else if (x <= 6.4e+124) {
		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 + (x * (z - y))
    if (x <= (-2.8d+79)) then
        tmp = t_2
    else if (x <= 1.1d+19) then
        tmp = t_1
    else if (x <= 5.6d+64) then
        tmp = x - (y * (x - t))
    else if (x <= 6.4d+124) 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 + (x * (z - y));
	double tmp;
	if (x <= -2.8e+79) {
		tmp = t_2;
	} else if (x <= 1.1e+19) {
		tmp = t_1;
	} else if (x <= 5.6e+64) {
		tmp = x - (y * (x - t));
	} else if (x <= 6.4e+124) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + ((y - z) * t)
	t_2 = x + (x * (z - y))
	tmp = 0
	if x <= -2.8e+79:
		tmp = t_2
	elif x <= 1.1e+19:
		tmp = t_1
	elif x <= 5.6e+64:
		tmp = x - (y * (x - t))
	elif x <= 6.4e+124:
		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(x * Float64(z - y)))
	tmp = 0.0
	if (x <= -2.8e+79)
		tmp = t_2;
	elseif (x <= 1.1e+19)
		tmp = t_1;
	elseif (x <= 5.6e+64)
		tmp = Float64(x - Float64(y * Float64(x - t)));
	elseif (x <= 6.4e+124)
		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 + (x * (z - y));
	tmp = 0.0;
	if (x <= -2.8e+79)
		tmp = t_2;
	elseif (x <= 1.1e+19)
		tmp = t_1;
	elseif (x <= 5.6e+64)
		tmp = x - (y * (x - t));
	elseif (x <= 6.4e+124)
		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[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e+79], t$95$2, If[LessEqual[x, 1.1e+19], t$95$1, If[LessEqual[x, 5.6e+64], N[(x - N[(y * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.4e+124], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.1 \cdot 10^{+19}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 5.6 \cdot 10^{+64}:\\
\;\;\;\;x - y \cdot \left(x - t\right)\\

\mathbf{elif}\;x \leq 6.4 \cdot 10^{+124}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.8000000000000001e79 or 6.39999999999999986e124 < x

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around inf 92.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \left(y - z\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg92.2%

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--92.2%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity92.2%

        \[\leadsto \color{blue}{x} - x \cdot \left(y - z\right) \]
    4. Simplified92.2%

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

    if -2.8000000000000001e79 < x < 1.1e19 or 5.60000000000000047e64 < x < 6.39999999999999986e124

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in t around inf 80.0%

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

    if 1.1e19 < x < 5.60000000000000047e64

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around inf 100.0%

      \[\leadsto x + \color{blue}{y \cdot \left(t - x\right)} \]
    3. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot y} \]
    4. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.8 \cdot 10^{+79}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{+19}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+64}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \mathbf{elif}\;x \leq 6.4 \cdot 10^{+124}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \end{array} \]

Alternative 7: 62.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.85 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

\mathbf{elif}\;x \leq 5.4 \cdot 10^{+19} \lor \neg \left(x \leq 7.8 \cdot 10^{+66}\right) \land x \leq 2.4 \cdot 10^{+131}:\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.85e19

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 82.5%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg82.5%

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

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

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

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

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

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

    if -2.85e19 < x < 5.4e19 or 7.8000000000000007e66 < x < 2.3999999999999999e131

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 97.8%

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

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

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

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

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \color{blue}{\left(-1 + \left(\left(-z\right) + y\right)\right)} \]
      9. +-commutative97.8%

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

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

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

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

    if 5.4e19 < x < 7.8000000000000007e66 or 2.3999999999999999e131 < x

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around inf 92.2%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \left(y - z\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg92.2%

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--92.1%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity92.1%

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

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

      \[\leadsto x - \color{blue}{x \cdot y} \]
    6. Taylor expanded in x around 0 68.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.85 \cdot 10^{+19}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;x \leq 5.4 \cdot 10^{+19} \lor \neg \left(x \leq 7.8 \cdot 10^{+66}\right) \land x \leq 2.4 \cdot 10^{+131}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \end{array} \]

Alternative 8: 38.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(-x\right)\\ \mathbf{if}\;y \leq -4.1 \cdot 10^{+102}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+186}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- x))))
   (if (<= y -4.1e+102)
     (* y t)
     (if (<= y -4.8e-11)
       t_1
       (if (<= y 1.1e-44) x (if (<= y 1.2e+186) (* y t) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * -x;
	double tmp;
	if (y <= -4.1e+102) {
		tmp = y * t;
	} else if (y <= -4.8e-11) {
		tmp = t_1;
	} else if (y <= 1.1e-44) {
		tmp = x;
	} else if (y <= 1.2e+186) {
		tmp = y * t;
	} 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) :: tmp
    t_1 = y * -x
    if (y <= (-4.1d+102)) then
        tmp = y * t
    else if (y <= (-4.8d-11)) then
        tmp = t_1
    else if (y <= 1.1d-44) then
        tmp = x
    else if (y <= 1.2d+186) then
        tmp = y * t
    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 = y * -x;
	double tmp;
	if (y <= -4.1e+102) {
		tmp = y * t;
	} else if (y <= -4.8e-11) {
		tmp = t_1;
	} else if (y <= 1.1e-44) {
		tmp = x;
	} else if (y <= 1.2e+186) {
		tmp = y * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * -x
	tmp = 0
	if y <= -4.1e+102:
		tmp = y * t
	elif y <= -4.8e-11:
		tmp = t_1
	elif y <= 1.1e-44:
		tmp = x
	elif y <= 1.2e+186:
		tmp = y * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(-x))
	tmp = 0.0
	if (y <= -4.1e+102)
		tmp = Float64(y * t);
	elseif (y <= -4.8e-11)
		tmp = t_1;
	elseif (y <= 1.1e-44)
		tmp = x;
	elseif (y <= 1.2e+186)
		tmp = Float64(y * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * -x;
	tmp = 0.0;
	if (y <= -4.1e+102)
		tmp = y * t;
	elseif (y <= -4.8e-11)
		tmp = t_1;
	elseif (y <= 1.1e-44)
		tmp = x;
	elseif (y <= 1.2e+186)
		tmp = y * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * (-x)), $MachinePrecision]}, If[LessEqual[y, -4.1e+102], N[(y * t), $MachinePrecision], If[LessEqual[y, -4.8e-11], t$95$1, If[LessEqual[y, 1.1e-44], x, If[LessEqual[y, 1.2e+186], N[(y * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4.8 \cdot 10^{-11}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{-44}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+186}:\\
\;\;\;\;y \cdot t\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.1e102 or 1.10000000000000006e-44 < y < 1.19999999999999998e186

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around inf 80.8%

      \[\leadsto x + \color{blue}{y \cdot \left(t - x\right)} \]
    3. Step-by-step derivation
      1. *-commutative80.8%

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

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

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

    if -4.1e102 < y < -4.8000000000000002e-11 or 1.19999999999999998e186 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 71.9%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg71.9%

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

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

        \[\leadsto \color{blue}{\left(y - \left(1 + z\right)\right) \cdot \left(-x\right)} \]
      4. +-commutative71.9%

        \[\leadsto \left(y - \color{blue}{\left(z + 1\right)}\right) \cdot \left(-x\right) \]
    4. Simplified71.9%

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

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

    if -4.8000000000000002e-11 < y < 1.10000000000000006e-44

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 66.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    6. Taylor expanded in z around 0 39.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{+102}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+186}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]

Alternative 9: 83.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+42}:\\
\;\;\;\;y \cdot \left(t - x\right)\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{-13}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.8999999999999999e42

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 98.3%

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

        \[\leadsto \color{blue}{t \cdot \left(y - z\right) + -1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      2. mul-1-neg98.3%

        \[\leadsto t \cdot \left(y - z\right) + \color{blue}{\left(-x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      3. unsub-neg98.3%

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+98.3%

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

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

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

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

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

    if -1.8999999999999999e42 < y < 1.9e-13

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around 0 91.6%

      \[\leadsto \color{blue}{x + -1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg91.6%

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. unsub-neg91.6%

        \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    4. Simplified91.6%

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

    if 1.9e-13 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around inf 88.7%

      \[\leadsto x + \color{blue}{y \cdot \left(t - x\right)} \]
    3. Step-by-step derivation
      1. *-commutative88.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+42}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-13}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \end{array} \]

Alternative 10: 36.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+90}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq -1.15 \cdot 10^{-121}:\\
\;\;\;\;z \cdot x\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{-44}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.1999999999999999e90 or 1.10000000000000006e-44 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around inf 85.6%

      \[\leadsto x + \color{blue}{y \cdot \left(t - x\right)} \]
    3. Step-by-step derivation
      1. *-commutative85.6%

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

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

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

    if -2.1999999999999999e90 < y < -1.15000000000000006e-121

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around inf 68.9%

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \left(y - z\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg68.9%

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      3. distribute-lft-out--68.9%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      4. *-rgt-identity68.9%

        \[\leadsto \color{blue}{x} - x \cdot \left(y - z\right) \]
    4. Simplified68.9%

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

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

    if -1.15000000000000006e-121 < y < 1.10000000000000006e-44

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 66.8%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg66.8%

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

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

        \[\leadsto \color{blue}{\left(y - \left(1 + z\right)\right) \cdot \left(-x\right)} \]
      4. +-commutative66.8%

        \[\leadsto \left(y - \color{blue}{\left(z + 1\right)}\right) \cdot \left(-x\right) \]
    4. Simplified66.8%

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    6. Taylor expanded in z around 0 42.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+90}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1.15 \cdot 10^{-121}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-44}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 11: 62.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.82 \cdot 10^{+19} \lor \neg \left(x \leq 1.6 \cdot 10^{+132}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.82e19 or 1.5999999999999999e132 < x

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 86.9%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg86.9%

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

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

        \[\leadsto \color{blue}{\left(y - \left(1 + z\right)\right) \cdot \left(-x\right)} \]
      4. +-commutative86.9%

        \[\leadsto \left(y - \color{blue}{\left(z + 1\right)}\right) \cdot \left(-x\right) \]
    4. Simplified86.9%

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

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

    if -1.82e19 < x < 1.5999999999999999e132

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 98.0%

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

        \[\leadsto \color{blue}{t \cdot \left(y - z\right) + -1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      2. mul-1-neg98.0%

        \[\leadsto t \cdot \left(y - z\right) + \color{blue}{\left(-x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      3. unsub-neg98.0%

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+98.0%

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \color{blue}{\left(-1 + \left(\left(-z\right) + y\right)\right)} \]
      9. +-commutative98.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.82 \cdot 10^{+19} \lor \neg \left(x \leq 1.6 \cdot 10^{+132}\right):\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \]

Alternative 12: 68.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+42} \lor \neg \left(y \leq 5.3 \cdot 10^{-11}\right):\\
\;\;\;\;y \cdot \left(t - x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.8e42 or 5.2999999999999998e-11 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 93.9%

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

        \[\leadsto \color{blue}{t \cdot \left(y - z\right) + -1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
      2. mul-1-neg93.9%

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

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

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

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

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

        \[\leadsto t \cdot \left(y - z\right) - x \cdot \left(\left(\color{blue}{-1} + \left(-z\right)\right) + y\right) \]
      8. associate-+l+93.9%

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

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

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

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

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

    if -1.8e42 < y < 5.2999999999999998e-11

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 64.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification75.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+42} \lor \neg \left(y \leq 5.3 \cdot 10^{-11}\right):\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]

Alternative 13: 100.0% accurate, 1.0× speedup?

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

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

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Final simplification100.0%

    \[\leadsto x + \left(y - z\right) \cdot \left(t - x\right) \]

Alternative 14: 38.5% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{-18}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq 9.8 \cdot 10^{-49}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y \cdot t\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.8e-18 or 9.8000000000000005e-49 < y

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in y around inf 83.1%

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

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

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

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

    if -5.8e-18 < y < 9.8000000000000005e-49

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Taylor expanded in x around -inf 66.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
    6. Taylor expanded in z around 0 39.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{-18}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{-49}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]

Alternative 15: 18.4% 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 100.0%

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Taylor expanded in x around -inf 58.6%

    \[\leadsto \color{blue}{-1 \cdot \left(x \cdot \left(y - \left(1 + z\right)\right)\right)} \]
  3. Step-by-step derivation
    1. mul-1-neg58.6%

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

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

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

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

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

    \[\leadsto \color{blue}{x \cdot \left(1 + z\right)} \]
  6. Taylor expanded in z around 0 19.2%

    \[\leadsto \color{blue}{x} \]
  7. Final simplification19.2%

    \[\leadsto x \]

Developer target: 96.5% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2023293 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

  :herbie-target
  (+ x (+ (* t (- y z)) (* (- x) (- y z))))

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