Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.9s
Alternatives: 12
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 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: 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-define100.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. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 46.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(1 - y\right)\\ t_2 := z \cdot \left(-t\right)\\ \mathbf{if}\;t \leq -3.2 \cdot 10^{+94}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -6.1 \cdot 10^{+26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq -1.45 \cdot 10^{+18}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-218}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-173}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq 3.65 \cdot 10^{+25}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+190}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- 1.0 y))) (t_2 (* z (- t))))
   (if (<= t -3.2e+94)
     t_2
     (if (<= t -6.1e+26)
       (* y t)
       (if (<= t -1.45e+18)
         t_2
         (if (<= t 1.55e-218)
           t_1
           (if (<= t 1.6e-173)
             (* x (+ z 1.0))
             (if (<= t 3.65e+25) t_1 (if (<= t 5.2e+190) t_2 (* y t))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = z * -t;
	double tmp;
	if (t <= -3.2e+94) {
		tmp = t_2;
	} else if (t <= -6.1e+26) {
		tmp = y * t;
	} else if (t <= -1.45e+18) {
		tmp = t_2;
	} else if (t <= 1.55e-218) {
		tmp = t_1;
	} else if (t <= 1.6e-173) {
		tmp = x * (z + 1.0);
	} else if (t <= 3.65e+25) {
		tmp = t_1;
	} else if (t <= 5.2e+190) {
		tmp = t_2;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (1.0d0 - y)
    t_2 = z * -t
    if (t <= (-3.2d+94)) then
        tmp = t_2
    else if (t <= (-6.1d+26)) then
        tmp = y * t
    else if (t <= (-1.45d+18)) then
        tmp = t_2
    else if (t <= 1.55d-218) then
        tmp = t_1
    else if (t <= 1.6d-173) then
        tmp = x * (z + 1.0d0)
    else if (t <= 3.65d+25) then
        tmp = t_1
    else if (t <= 5.2d+190) then
        tmp = t_2
    else
        tmp = y * t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * (1.0 - y);
	double t_2 = z * -t;
	double tmp;
	if (t <= -3.2e+94) {
		tmp = t_2;
	} else if (t <= -6.1e+26) {
		tmp = y * t;
	} else if (t <= -1.45e+18) {
		tmp = t_2;
	} else if (t <= 1.55e-218) {
		tmp = t_1;
	} else if (t <= 1.6e-173) {
		tmp = x * (z + 1.0);
	} else if (t <= 3.65e+25) {
		tmp = t_1;
	} else if (t <= 5.2e+190) {
		tmp = t_2;
	} else {
		tmp = y * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (1.0 - y)
	t_2 = z * -t
	tmp = 0
	if t <= -3.2e+94:
		tmp = t_2
	elif t <= -6.1e+26:
		tmp = y * t
	elif t <= -1.45e+18:
		tmp = t_2
	elif t <= 1.55e-218:
		tmp = t_1
	elif t <= 1.6e-173:
		tmp = x * (z + 1.0)
	elif t <= 3.65e+25:
		tmp = t_1
	elif t <= 5.2e+190:
		tmp = t_2
	else:
		tmp = y * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(1.0 - y))
	t_2 = Float64(z * Float64(-t))
	tmp = 0.0
	if (t <= -3.2e+94)
		tmp = t_2;
	elseif (t <= -6.1e+26)
		tmp = Float64(y * t);
	elseif (t <= -1.45e+18)
		tmp = t_2;
	elseif (t <= 1.55e-218)
		tmp = t_1;
	elseif (t <= 1.6e-173)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (t <= 3.65e+25)
		tmp = t_1;
	elseif (t <= 5.2e+190)
		tmp = t_2;
	else
		tmp = Float64(y * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (1.0 - y);
	t_2 = z * -t;
	tmp = 0.0;
	if (t <= -3.2e+94)
		tmp = t_2;
	elseif (t <= -6.1e+26)
		tmp = y * t;
	elseif (t <= -1.45e+18)
		tmp = t_2;
	elseif (t <= 1.55e-218)
		tmp = t_1;
	elseif (t <= 1.6e-173)
		tmp = x * (z + 1.0);
	elseif (t <= 3.65e+25)
		tmp = t_1;
	elseif (t <= 5.2e+190)
		tmp = t_2;
	else
		tmp = y * t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[t, -3.2e+94], t$95$2, If[LessEqual[t, -6.1e+26], N[(y * t), $MachinePrecision], If[LessEqual[t, -1.45e+18], t$95$2, If[LessEqual[t, 1.55e-218], t$95$1, If[LessEqual[t, 1.6e-173], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.65e+25], t$95$1, If[LessEqual[t, 5.2e+190], t$95$2, N[(y * t), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -6.1 \cdot 10^{+26}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;t \leq -1.45 \cdot 10^{+18}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq 1.55 \cdot 10^{-218}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.6 \cdot 10^{-173}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

\mathbf{elif}\;t \leq 3.65 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 5.2 \cdot 10^{+190}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -3.20000000000000014e94 or -6.1000000000000003e26 < t < -1.45e18 or 3.6499999999999998e25 < t < 5.20000000000000022e190

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot z} \]
      2. mul-1-neg55.6%

        \[\leadsto \color{blue}{\left(-t\right)} \cdot z \]
    9. Simplified55.6%

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

    if -3.20000000000000014e94 < t < -6.1000000000000003e26 or 5.20000000000000022e190 < t

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified66.7%

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

    if -1.45e18 < t < 1.54999999999999999e-218 or 1.6e-173 < t < 3.6499999999999998e25

    1. Initial program 99.9%

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

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

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

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

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

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

    if 1.54999999999999999e-218 < t < 1.6e-173

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified87.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.2 \cdot 10^{+94}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq -6.1 \cdot 10^{+26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq -1.45 \cdot 10^{+18}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-218}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-173}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq 3.65 \cdot 10^{+25}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{+190}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 42.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(z + 1\right)\\ t_2 := z \cdot \left(-t\right)\\ \mathbf{if}\;t \leq -2.7 \cdot 10^{+93}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -3.4 \cdot 10^{+25}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq -0.00029:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-95}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -7 \cdot 10^{-209}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+191}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ z 1.0))) (t_2 (* z (- t))))
   (if (<= t -2.7e+93)
     t_2
     (if (<= t -3.4e+25)
       (* y t)
       (if (<= t -0.00029)
         t_2
         (if (<= t -6e-95)
           t_1
           (if (<= t -7e-209)
             (* y (- x))
             (if (<= t 1.5e-34) t_1 (if (<= t 1.05e+191) t_2 (* y t))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (z + 1.0);
	double t_2 = z * -t;
	double tmp;
	if (t <= -2.7e+93) {
		tmp = t_2;
	} else if (t <= -3.4e+25) {
		tmp = y * t;
	} else if (t <= -0.00029) {
		tmp = t_2;
	} else if (t <= -6e-95) {
		tmp = t_1;
	} else if (t <= -7e-209) {
		tmp = y * -x;
	} else if (t <= 1.5e-34) {
		tmp = t_1;
	} else if (t <= 1.05e+191) {
		tmp = t_2;
	} 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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x * (z + 1.0d0)
    t_2 = z * -t
    if (t <= (-2.7d+93)) then
        tmp = t_2
    else if (t <= (-3.4d+25)) then
        tmp = y * t
    else if (t <= (-0.00029d0)) then
        tmp = t_2
    else if (t <= (-6d-95)) then
        tmp = t_1
    else if (t <= (-7d-209)) then
        tmp = y * -x
    else if (t <= 1.5d-34) then
        tmp = t_1
    else if (t <= 1.05d+191) then
        tmp = t_2
    else
        tmp = y * t
    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 = z * -t;
	double tmp;
	if (t <= -2.7e+93) {
		tmp = t_2;
	} else if (t <= -3.4e+25) {
		tmp = y * t;
	} else if (t <= -0.00029) {
		tmp = t_2;
	} else if (t <= -6e-95) {
		tmp = t_1;
	} else if (t <= -7e-209) {
		tmp = y * -x;
	} else if (t <= 1.5e-34) {
		tmp = t_1;
	} else if (t <= 1.05e+191) {
		tmp = t_2;
	} else {
		tmp = y * t;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (z + 1.0)
	t_2 = z * -t
	tmp = 0
	if t <= -2.7e+93:
		tmp = t_2
	elif t <= -3.4e+25:
		tmp = y * t
	elif t <= -0.00029:
		tmp = t_2
	elif t <= -6e-95:
		tmp = t_1
	elif t <= -7e-209:
		tmp = y * -x
	elif t <= 1.5e-34:
		tmp = t_1
	elif t <= 1.05e+191:
		tmp = t_2
	else:
		tmp = y * t
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(z + 1.0))
	t_2 = Float64(z * Float64(-t))
	tmp = 0.0
	if (t <= -2.7e+93)
		tmp = t_2;
	elseif (t <= -3.4e+25)
		tmp = Float64(y * t);
	elseif (t <= -0.00029)
		tmp = t_2;
	elseif (t <= -6e-95)
		tmp = t_1;
	elseif (t <= -7e-209)
		tmp = Float64(y * Float64(-x));
	elseif (t <= 1.5e-34)
		tmp = t_1;
	elseif (t <= 1.05e+191)
		tmp = t_2;
	else
		tmp = Float64(y * t);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (z + 1.0);
	t_2 = z * -t;
	tmp = 0.0;
	if (t <= -2.7e+93)
		tmp = t_2;
	elseif (t <= -3.4e+25)
		tmp = y * t;
	elseif (t <= -0.00029)
		tmp = t_2;
	elseif (t <= -6e-95)
		tmp = t_1;
	elseif (t <= -7e-209)
		tmp = y * -x;
	elseif (t <= 1.5e-34)
		tmp = t_1;
	elseif (t <= 1.05e+191)
		tmp = t_2;
	else
		tmp = y * t;
	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[(z * (-t)), $MachinePrecision]}, If[LessEqual[t, -2.7e+93], t$95$2, If[LessEqual[t, -3.4e+25], N[(y * t), $MachinePrecision], If[LessEqual[t, -0.00029], t$95$2, If[LessEqual[t, -6e-95], t$95$1, If[LessEqual[t, -7e-209], N[(y * (-x)), $MachinePrecision], If[LessEqual[t, 1.5e-34], t$95$1, If[LessEqual[t, 1.05e+191], t$95$2, N[(y * t), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -3.4 \cdot 10^{+25}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;t \leq -0.00029:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq -6 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq -7 \cdot 10^{-209}:\\
\;\;\;\;y \cdot \left(-x\right)\\

\mathbf{elif}\;t \leq 1.5 \cdot 10^{-34}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 1.05 \cdot 10^{+191}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -2.6999999999999999e93 or -3.39999999999999984e25 < t < -2.9e-4 or 1.5e-34 < t < 1.05e191

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot z} \]
      2. mul-1-neg51.6%

        \[\leadsto \color{blue}{\left(-t\right)} \cdot z \]
    9. Simplified51.6%

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

    if -2.6999999999999999e93 < t < -3.39999999999999984e25 or 1.05e191 < t

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified66.7%

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

    if -2.9e-4 < t < -6e-95 or -7.00000000000000004e-209 < t < 1.5e-34

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(z + 1\right)} \]
    8. Simplified52.3%

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

    if -6e-95 < t < -7.00000000000000004e-209

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right)} \cdot y \]
      3. *-commutative49.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.7 \cdot 10^{+93}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq -3.4 \cdot 10^{+25}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq -0.00029:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-95}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq -7 \cdot 10^{-209}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-34}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+191}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ t_2 := y \cdot \left(t - x\right)\\ t_3 := x \cdot \left(z + 1\right)\\ \mathbf{if}\;y \leq -5.2 \cdot 10^{-11}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-201}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-138}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-89}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;y \leq 920000000:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))) (t_2 (* y (- t x))) (t_3 (* x (+ z 1.0))))
   (if (<= y -5.2e-11)
     t_2
     (if (<= y 1.05e-201)
       t_3
       (if (<= y 4.6e-138)
         t_1
         (if (<= y 3.1e-89) t_3 (if (<= y 920000000.0) t_1 t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double t_2 = y * (t - x);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (y <= -5.2e-11) {
		tmp = t_2;
	} else if (y <= 1.05e-201) {
		tmp = t_3;
	} else if (y <= 4.6e-138) {
		tmp = t_1;
	} else if (y <= 3.1e-89) {
		tmp = t_3;
	} else if (y <= 920000000.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) :: t_3
    real(8) :: tmp
    t_1 = z * -t
    t_2 = y * (t - x)
    t_3 = x * (z + 1.0d0)
    if (y <= (-5.2d-11)) then
        tmp = t_2
    else if (y <= 1.05d-201) then
        tmp = t_3
    else if (y <= 4.6d-138) then
        tmp = t_1
    else if (y <= 3.1d-89) then
        tmp = t_3
    else if (y <= 920000000.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 = z * -t;
	double t_2 = y * (t - x);
	double t_3 = x * (z + 1.0);
	double tmp;
	if (y <= -5.2e-11) {
		tmp = t_2;
	} else if (y <= 1.05e-201) {
		tmp = t_3;
	} else if (y <= 4.6e-138) {
		tmp = t_1;
	} else if (y <= 3.1e-89) {
		tmp = t_3;
	} else if (y <= 920000000.0) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	t_2 = y * (t - x)
	t_3 = x * (z + 1.0)
	tmp = 0
	if y <= -5.2e-11:
		tmp = t_2
	elif y <= 1.05e-201:
		tmp = t_3
	elif y <= 4.6e-138:
		tmp = t_1
	elif y <= 3.1e-89:
		tmp = t_3
	elif y <= 920000000.0:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	t_2 = Float64(y * Float64(t - x))
	t_3 = Float64(x * Float64(z + 1.0))
	tmp = 0.0
	if (y <= -5.2e-11)
		tmp = t_2;
	elseif (y <= 1.05e-201)
		tmp = t_3;
	elseif (y <= 4.6e-138)
		tmp = t_1;
	elseif (y <= 3.1e-89)
		tmp = t_3;
	elseif (y <= 920000000.0)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * -t;
	t_2 = y * (t - x);
	t_3 = x * (z + 1.0);
	tmp = 0.0;
	if (y <= -5.2e-11)
		tmp = t_2;
	elseif (y <= 1.05e-201)
		tmp = t_3;
	elseif (y <= 4.6e-138)
		tmp = t_1;
	elseif (y <= 3.1e-89)
		tmp = t_3;
	elseif (y <= 920000000.0)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e-11], t$95$2, If[LessEqual[y, 1.05e-201], t$95$3, If[LessEqual[y, 4.6e-138], t$95$1, If[LessEqual[y, 3.1e-89], t$95$3, If[LessEqual[y, 920000000.0], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 1.05 \cdot 10^{-201}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq 4.6 \cdot 10^{-138}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 3.1 \cdot 10^{-89}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;y \leq 920000000:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.2000000000000001e-11 or 9.2e8 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot y + -1 \cdot \left(x \cdot y\right)} \]
      2. associate-*r*76.3%

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

        \[\leadsto t \cdot y + \color{blue}{\left(-x\right)} \cdot y \]
      4. distribute-rgt-out79.2%

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

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

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

    if -5.2000000000000001e-11 < y < 1.05000000000000006e-201 or 4.5999999999999998e-138 < y < 3.09999999999999996e-89

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if 1.05000000000000006e-201 < y < 4.5999999999999998e-138 or 3.09999999999999996e-89 < y < 9.2e8

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-t\right)} \cdot z \]
    9. Simplified57.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 1.05 \cdot 10^{-201}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-138}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-89}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 920000000:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := x - z \cdot t\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{-11}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -1.55 \cdot 10^{-196}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-252}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 900000000:\\ \;\;\;\;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 (* z t))))
   (if (<= y -2.2e-11)
     t_1
     (if (<= y -1.55e-196)
       t_2
       (if (<= y -4e-252) (* z (- x t)) (if (<= y 900000000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = x - (z * t);
	double tmp;
	if (y <= -2.2e-11) {
		tmp = t_1;
	} else if (y <= -1.55e-196) {
		tmp = t_2;
	} else if (y <= -4e-252) {
		tmp = z * (x - t);
	} else if (y <= 900000000.0) {
		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 - (z * t)
    if (y <= (-2.2d-11)) then
        tmp = t_1
    else if (y <= (-1.55d-196)) then
        tmp = t_2
    else if (y <= (-4d-252)) then
        tmp = z * (x - t)
    else if (y <= 900000000.0d0) 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 - (z * t);
	double tmp;
	if (y <= -2.2e-11) {
		tmp = t_1;
	} else if (y <= -1.55e-196) {
		tmp = t_2;
	} else if (y <= -4e-252) {
		tmp = z * (x - t);
	} else if (y <= 900000000.0) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = x - (z * t)
	tmp = 0
	if y <= -2.2e-11:
		tmp = t_1
	elif y <= -1.55e-196:
		tmp = t_2
	elif y <= -4e-252:
		tmp = z * (x - t)
	elif y <= 900000000.0:
		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(z * t))
	tmp = 0.0
	if (y <= -2.2e-11)
		tmp = t_1;
	elseif (y <= -1.55e-196)
		tmp = t_2;
	elseif (y <= -4e-252)
		tmp = Float64(z * Float64(x - t));
	elseif (y <= 900000000.0)
		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 - (z * t);
	tmp = 0.0;
	if (y <= -2.2e-11)
		tmp = t_1;
	elseif (y <= -1.55e-196)
		tmp = t_2;
	elseif (y <= -4e-252)
		tmp = z * (x - t);
	elseif (y <= 900000000.0)
		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[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e-11], t$95$1, If[LessEqual[y, -1.55e-196], t$95$2, If[LessEqual[y, -4e-252], N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 900000000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.55 \cdot 10^{-196}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;y \leq 900000000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.2000000000000002e-11 or 9e8 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot y + -1 \cdot \left(x \cdot y\right)} \]
      2. associate-*r*75.8%

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

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

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

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

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

    if -2.2000000000000002e-11 < y < -1.54999999999999996e-196 or -3.99999999999999977e-252 < y < 9e8

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
    9. Simplified70.2%

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

    if -1.54999999999999996e-196 < y < -3.99999999999999977e-252

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in z around inf 92.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -1.55 \cdot 10^{-196}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-252}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 900000000:\\ \;\;\;\;x - z \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 67.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ t_2 := z \cdot \left(x - t\right)\\ \mathbf{if}\;y \leq -7.5 \cdot 10^{-11}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{-258}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-207}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 880000000000:\\ \;\;\;\;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 (* z (- x t))))
   (if (<= y -7.5e-11)
     t_1
     (if (<= y 5.7e-258)
       t_2
       (if (<= y 2.65e-207)
         (* x (+ z 1.0))
         (if (<= y 880000000000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double t_2 = z * (x - t);
	double tmp;
	if (y <= -7.5e-11) {
		tmp = t_1;
	} else if (y <= 5.7e-258) {
		tmp = t_2;
	} else if (y <= 2.65e-207) {
		tmp = x * (z + 1.0);
	} else if (y <= 880000000000.0) {
		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 = z * (x - t)
    if (y <= (-7.5d-11)) then
        tmp = t_1
    else if (y <= 5.7d-258) then
        tmp = t_2
    else if (y <= 2.65d-207) then
        tmp = x * (z + 1.0d0)
    else if (y <= 880000000000.0d0) 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 = z * (x - t);
	double tmp;
	if (y <= -7.5e-11) {
		tmp = t_1;
	} else if (y <= 5.7e-258) {
		tmp = t_2;
	} else if (y <= 2.65e-207) {
		tmp = x * (z + 1.0);
	} else if (y <= 880000000000.0) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	t_2 = z * (x - t)
	tmp = 0
	if y <= -7.5e-11:
		tmp = t_1
	elif y <= 5.7e-258:
		tmp = t_2
	elif y <= 2.65e-207:
		tmp = x * (z + 1.0)
	elif y <= 880000000000.0:
		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(z * Float64(x - t))
	tmp = 0.0
	if (y <= -7.5e-11)
		tmp = t_1;
	elseif (y <= 5.7e-258)
		tmp = t_2;
	elseif (y <= 2.65e-207)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (y <= 880000000000.0)
		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 = z * (x - t);
	tmp = 0.0;
	if (y <= -7.5e-11)
		tmp = t_1;
	elseif (y <= 5.7e-258)
		tmp = t_2;
	elseif (y <= 2.65e-207)
		tmp = x * (z + 1.0);
	elseif (y <= 880000000000.0)
		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[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.5e-11], t$95$1, If[LessEqual[y, 5.7e-258], t$95$2, If[LessEqual[y, 2.65e-207], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 880000000000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 5.7 \cdot 10^{-258}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;y \leq 880000000000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.5e-11 or 8.8e11 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot y + -1 \cdot \left(x \cdot y\right)} \]
      2. associate-*r*76.3%

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

        \[\leadsto t \cdot y + \color{blue}{\left(-x\right)} \cdot y \]
      4. distribute-rgt-out79.2%

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

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

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

    if -7.5e-11 < y < 5.7000000000000002e-258 or 2.65e-207 < y < 8.8e11

    1. Initial program 99.9%

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

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

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

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

      \[\leadsto \color{blue}{x - z \cdot \left(t - x\right)} \]
    6. Taylor expanded in z around inf 63.2%

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

        \[\leadsto \color{blue}{\left(x - t\right) \cdot z} \]
    8. Simplified63.2%

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

    if 5.7000000000000002e-258 < y < 2.65e-207

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{-258}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 2.65 \cdot 10^{-207}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 880000000000:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 37.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -2.6 \cdot 10^{-296}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 2.4 \cdot 10^{-280}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.10000000000000001e-96 or 2.15e15 < z

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-t\right)} \cdot z \]
    9. Simplified45.0%

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

    if -2.10000000000000001e-96 < z < -2.6000000000000001e-296 or 2.3999999999999998e-280 < z < 2.15e15

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified45.1%

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

    if -2.6000000000000001e-296 < z < 2.3999999999999998e-280

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{-96}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;z \leq -2.6 \cdot 10^{-296}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-280}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{+15}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 81.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1150000000000 \lor \neg \left(t \leq 0.00255\right):\\
\;\;\;\;x + \left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.15e12 or 0.0025500000000000002 < t

    1. Initial program 100.0%

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

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

    if -1.15e12 < t < 0.0025500000000000002

    1. Initial program 100.0%

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

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

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

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

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

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

Alternative 9: 35.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+21} \lor \neg \left(t \leq 0.00125\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.2e21 or 0.00125000000000000003 < t

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified47.0%

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

    if -1.2e21 < t < 0.00125000000000000003

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-x\right)} \cdot y \]
      3. *-commutative38.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.2 \cdot 10^{+21} \lor \neg \left(t \leq 0.00125\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 35.5% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-11} \lor \neg \left(y \leq 9 \cdot 10^{-173}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.7999999999999998e-11 or 9.00000000000000037e-173 < y

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot t} \]
    9. Simplified39.0%

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

    if -3.7999999999999998e-11 < y < 9.00000000000000037e-173

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{-11} \lor \neg \left(y \leq 9 \cdot 10^{-173}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 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. Add Preprocessing
  3. Add Preprocessing

Alternative 12: 18.5% accurate, 9.0× speedup?

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

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

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

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

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

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

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

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 2024108 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

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

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