Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 6.8s
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, 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 2: 70.0% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -8 \cdot 10^{-83}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq -7.6 \cdot 10^{-83}:\\
\;\;\;\;t \cdot \left(-z\right)\\

\mathbf{elif}\;z \leq -1.4 \cdot 10^{-217}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq -1.6 \cdot 10^{-307}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-187}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 1.8 \cdot 10^{-64}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;z \leq 2 \cdot 10^{-24}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -7.2000000000000004e30 or 1.99999999999999985e-24 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.2000000000000004e30 < z < -8.0000000000000003e-83 or -1.4e-217 < z < -1.60000000000000005e-307 or 3.1999999999999998e-187 < z < 1.7999999999999999e-64

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - y \cdot x} \]
      4. *-commutative73.9%

        \[\leadsto x - \color{blue}{x \cdot y} \]
    7. Simplified73.9%

      \[\leadsto \color{blue}{x - x \cdot y} \]

    if -8.0000000000000003e-83 < z < -7.59999999999999953e-83

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if -7.59999999999999953e-83 < z < -1.4e-217 or -1.60000000000000005e-307 < z < 3.1999999999999998e-187 or 1.7999999999999999e-64 < z < 1.99999999999999985e-24

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{y \cdot t + x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification79.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.2 \cdot 10^{+30}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq -8 \cdot 10^{-83}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq -7.6 \cdot 10^{-83}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-217}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{-307}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-187}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-64}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;z \leq 2 \cdot 10^{-24}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 3: 36.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -1500:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.04 \cdot 10^{-253}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-292}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-261}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+47}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- y))))
   (if (<= y -1500.0)
     t_1
     (if (<= y -1.04e-253)
       x
       (if (<= y 2.6e-292)
         (* x z)
         (if (<= y 6e-261) x (if (<= y 3e+47) (* t (- z)) t_1)))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * -y;
	double tmp;
	if (y <= -1500.0) {
		tmp = t_1;
	} else if (y <= -1.04e-253) {
		tmp = x;
	} else if (y <= 2.6e-292) {
		tmp = x * z;
	} else if (y <= 6e-261) {
		tmp = x;
	} else if (y <= 3e+47) {
		tmp = t * -z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * -y
    if (y <= (-1500.0d0)) then
        tmp = t_1
    else if (y <= (-1.04d-253)) then
        tmp = x
    else if (y <= 2.6d-292) then
        tmp = x * z
    else if (y <= 6d-261) then
        tmp = x
    else if (y <= 3d+47) then
        tmp = t * -z
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * -y;
	double tmp;
	if (y <= -1500.0) {
		tmp = t_1;
	} else if (y <= -1.04e-253) {
		tmp = x;
	} else if (y <= 2.6e-292) {
		tmp = x * z;
	} else if (y <= 6e-261) {
		tmp = x;
	} else if (y <= 3e+47) {
		tmp = t * -z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * -y
	tmp = 0
	if y <= -1500.0:
		tmp = t_1
	elif y <= -1.04e-253:
		tmp = x
	elif y <= 2.6e-292:
		tmp = x * z
	elif y <= 6e-261:
		tmp = x
	elif y <= 3e+47:
		tmp = t * -z
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(-y))
	tmp = 0.0
	if (y <= -1500.0)
		tmp = t_1;
	elseif (y <= -1.04e-253)
		tmp = x;
	elseif (y <= 2.6e-292)
		tmp = Float64(x * z);
	elseif (y <= 6e-261)
		tmp = x;
	elseif (y <= 3e+47)
		tmp = Float64(t * Float64(-z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * -y;
	tmp = 0.0;
	if (y <= -1500.0)
		tmp = t_1;
	elseif (y <= -1.04e-253)
		tmp = x;
	elseif (y <= 2.6e-292)
		tmp = x * z;
	elseif (y <= 6e-261)
		tmp = x;
	elseif (y <= 3e+47)
		tmp = t * -z;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[y, -1500.0], t$95$1, If[LessEqual[y, -1.04e-253], x, If[LessEqual[y, 2.6e-292], N[(x * z), $MachinePrecision], If[LessEqual[y, 6e-261], x, If[LessEqual[y, 3e+47], N[(t * (-z)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -1500:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.04 \cdot 10^{-253}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2.6 \cdot 10^{-292}:\\
\;\;\;\;x \cdot z\\

\mathbf{elif}\;y \leq 6 \cdot 10^{-261}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1500 or 3.0000000000000001e47 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-in54.7%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified54.7%

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

    if -1500 < y < -1.04e-253 or 2.60000000000000013e-292 < y < 6.0000000000000001e-261

    1. Initial program 100.0%

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

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

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

    if -1.04e-253 < y < 2.60000000000000013e-292

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 6.0000000000000001e-261 < y < 3.0000000000000001e47

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1500:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -1.04 \cdot 10^{-253}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-292}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-261}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+47}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]

Alternative 4: 70.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq 4.05 \cdot 10^{-143}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;z \leq 4.7 \cdot 10^{-66}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;z \leq 3.15 \cdot 10^{-24}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.99999999999999973e-21 or 3.1499999999999999e-24 < z

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-lft-neg-out79.5%

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

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

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

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

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

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

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

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

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

    if -4.99999999999999973e-21 < z < 4.0499999999999999e-143 or 4.6999999999999999e-66 < z < 3.1499999999999999e-24

    1. Initial program 100.0%

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

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

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

    if 4.0499999999999999e-143 < z < 4.6999999999999999e-66

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-in58.3%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified58.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-21}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 4.05 \cdot 10^{-143}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 4.7 \cdot 10^{-66}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;z \leq 3.15 \cdot 10^{-24}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 5: 55.2% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;z \leq 4.6 \cdot 10^{-143}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 3.4 \cdot 10^{-82}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -7.59999999999999953e-83 or 3.39999999999999975e-82 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.59999999999999953e-83 < z < 4.60000000000000023e-143

    1. Initial program 100.0%

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

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

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

    if 4.60000000000000023e-143 < z < 3.39999999999999975e-82

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-\left(y - z\right) \cdot x\right)} \]
      2. distribute-rgt-neg-out73.7%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-in64.8%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified64.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -7.6 \cdot 10^{-83}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{-143}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-82}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x - t\right)\\ \end{array} \]

Alternative 6: 81.5% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -3.8e5 or 3.1e12 < t

    1. Initial program 100.0%

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

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

    if -3.8e5 < t < 3.1e12

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-\left(y - z\right) \cdot x\right)} \]
      2. distribute-rgt-neg-out82.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -380000 \lor \neg \left(t \leq 3100000000000\right):\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - \left(y - z\right)\right)\\ \end{array} \]

Alternative 7: 83.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+29} \lor \neg \left(z \leq 3.15 \cdot 10^{-24}\right):\\
\;\;\;\;z \cdot \left(x - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.1000000000000002e29 or 3.1499999999999999e-24 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1000000000000002e29 < z < 3.1499999999999999e-24

    1. Initial program 100.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+29} \lor \neg \left(z \leq 3.15 \cdot 10^{-24}\right):\\ \;\;\;\;z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \left(x - t\right)\\ \end{array} \]

Alternative 8: 64.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+70}:\\
\;\;\;\;x + y \cdot t\\

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

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


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

    1. Initial program 100.0%

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

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

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

    if -2.99999999999999976e70 < t < 1.05e118

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

    if 1.05e118 < t

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
    5. Simplified68.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3 \cdot 10^{+70}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{+118}:\\ \;\;\;\;x \cdot \left(1 - \left(y - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot t\\ \end{array} \]

Alternative 9: 84.3% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-lft-neg-out88.0%

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

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

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

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

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

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

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

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

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

    if -1.5499999999999999e29 < z < 2.99999999999999995e-24

    1. Initial program 100.0%

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

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

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

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

    if 2.99999999999999995e-24 < z

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-lft-neg-out76.3%

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

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

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

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

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

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

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

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

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

Alternative 10: 34.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -1500:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -6.6 \cdot 10^{-253}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2450000:\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (- y))))
   (if (<= y -1500.0)
     t_1
     (if (<= y -6.6e-253) x (if (<= y 2450000.0) (* x z) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x * -y;
	double tmp;
	if (y <= -1500.0) {
		tmp = t_1;
	} else if (y <= -6.6e-253) {
		tmp = x;
	} else if (y <= 2450000.0) {
		tmp = x * z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = x * -y
    if (y <= (-1500.0d0)) then
        tmp = t_1
    else if (y <= (-6.6d-253)) then
        tmp = x
    else if (y <= 2450000.0d0) then
        tmp = x * z
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x * -y;
	double tmp;
	if (y <= -1500.0) {
		tmp = t_1;
	} else if (y <= -6.6e-253) {
		tmp = x;
	} else if (y <= 2450000.0) {
		tmp = x * z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * -y
	tmp = 0
	if y <= -1500.0:
		tmp = t_1
	elif y <= -6.6e-253:
		tmp = x
	elif y <= 2450000.0:
		tmp = x * z
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(-y))
	tmp = 0.0
	if (y <= -1500.0)
		tmp = t_1;
	elseif (y <= -6.6e-253)
		tmp = x;
	elseif (y <= 2450000.0)
		tmp = Float64(x * z);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * -y;
	tmp = 0.0;
	if (y <= -1500.0)
		tmp = t_1;
	elseif (y <= -6.6e-253)
		tmp = x;
	elseif (y <= 2450000.0)
		tmp = x * z;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[y, -1500.0], t$95$1, If[LessEqual[y, -6.6e-253], x, If[LessEqual[y, 2450000.0], N[(x * z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -1500:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -6.6 \cdot 10^{-253}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 2450000:\\
\;\;\;\;x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1500 or 2.45e6 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-in50.4%

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

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

    if -1500 < y < -6.6000000000000002e-253

    1. Initial program 100.0%

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

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

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

    if -6.6000000000000002e-253 < y < 2.45e6

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1500:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -6.6 \cdot 10^{-253}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2450000:\\ \;\;\;\;x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]

Alternative 11: 37.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\

\mathbf{elif}\;z \leq 3.15 \cdot 10^{-24}:\\
\;\;\;\;x\\

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


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

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-\left(y - z\right) \cdot x\right)} \]
      2. distribute-rgt-neg-out57.7%

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

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

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

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

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

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

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

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

    if -1 < z < 3.1499999999999999e-24

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.15 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]

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. Taylor expanded in t around inf 60.2%

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification17.4%

    \[\leadsto x \]

Developer target: 96.3% 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 2023229 
(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))))