Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3

Percentage Accurate: 96.6% → 99.6%
Time: 11.7s
Alternatives: 9
Speedup: 1.3×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 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: 96.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.6% accurate, 0.3× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ \begin{array}{l} t_2 := x \cdot y_m - y_m \cdot z\\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;t_2 \leq -2 \cdot 10^{-219}:\\ \;\;\;\;t_2 \cdot t_m\\ \mathbf{elif}\;t_2 \leq 10^{-204}:\\ \;\;\;\;y_m \cdot \left(x \cdot t_m - z \cdot t_m\right)\\ \mathbf{else}:\\ \;\;\;\;t_m \cdot \left(y_m \cdot \left(x - z\right)\right)\\ \end{array}\right) \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (let* ((t_2 (- (* x y_m) (* y_m z))))
   (*
    t_s
    (*
     y_s
     (if (<= t_2 -2e-219)
       (* t_2 t_m)
       (if (<= t_2 1e-204)
         (* y_m (- (* x t_m) (* z t_m)))
         (* t_m (* y_m (- x z)))))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double t_2 = (x * y_m) - (y_m * z);
	double tmp;
	if (t_2 <= -2e-219) {
		tmp = t_2 * t_m;
	} else if (t_2 <= 1e-204) {
		tmp = y_m * ((x * t_m) - (z * t_m));
	} else {
		tmp = t_m * (y_m * (x - z));
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: t_2
    real(8) :: tmp
    t_2 = (x * y_m) - (y_m * z)
    if (t_2 <= (-2d-219)) then
        tmp = t_2 * t_m
    else if (t_2 <= 1d-204) then
        tmp = y_m * ((x * t_m) - (z * t_m))
    else
        tmp = t_m * (y_m * (x - z))
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double t_2 = (x * y_m) - (y_m * z);
	double tmp;
	if (t_2 <= -2e-219) {
		tmp = t_2 * t_m;
	} else if (t_2 <= 1e-204) {
		tmp = y_m * ((x * t_m) - (z * t_m));
	} else {
		tmp = t_m * (y_m * (x - z));
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	t_2 = (x * y_m) - (y_m * z)
	tmp = 0
	if t_2 <= -2e-219:
		tmp = t_2 * t_m
	elif t_2 <= 1e-204:
		tmp = y_m * ((x * t_m) - (z * t_m))
	else:
		tmp = t_m * (y_m * (x - z))
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	t_2 = Float64(Float64(x * y_m) - Float64(y_m * z))
	tmp = 0.0
	if (t_2 <= -2e-219)
		tmp = Float64(t_2 * t_m);
	elseif (t_2 <= 1e-204)
		tmp = Float64(y_m * Float64(Float64(x * t_m) - Float64(z * t_m)));
	else
		tmp = Float64(t_m * Float64(y_m * Float64(x - z)));
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	t_2 = (x * y_m) - (y_m * z);
	tmp = 0.0;
	if (t_2 <= -2e-219)
		tmp = t_2 * t_m;
	elseif (t_2 <= 1e-204)
		tmp = y_m * ((x * t_m) - (z * t_m));
	else
		tmp = t_m * (y_m * (x - z));
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := Block[{t$95$2 = N[(N[(x * y$95$m), $MachinePrecision] - N[(y$95$m * z), $MachinePrecision]), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[t$95$2, -2e-219], N[(t$95$2 * t$95$m), $MachinePrecision], If[LessEqual[t$95$2, 1e-204], N[(y$95$m * N[(N[(x * t$95$m), $MachinePrecision] - N[(z * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$m * N[(y$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
\begin{array}{l}
t_2 := x \cdot y_m - y_m \cdot z\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-219}:\\
\;\;\;\;t_2 \cdot t_m\\

\mathbf{elif}\;t_2 \leq 10^{-204}:\\
\;\;\;\;y_m \cdot \left(x \cdot t_m - z \cdot t_m\right)\\

\mathbf{else}:\\
\;\;\;\;t_m \cdot \left(y_m \cdot \left(x - z\right)\right)\\


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (-.f64 (*.f64 x y) (*.f64 z y)) < -2.0000000000000001e-219

    1. Initial program 89.1%

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

    if -2.0000000000000001e-219 < (-.f64 (*.f64 x y) (*.f64 z y)) < 1e-204

    1. Initial program 73.1%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--73.1%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*95.2%

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

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

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

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

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

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

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

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

    if 1e-204 < (-.f64 (*.f64 x y) (*.f64 z y))

    1. Initial program 87.1%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--92.0%

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

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

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

Alternative 2: 76.2% accurate, 0.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ \begin{array}{l} t_2 := t_m \cdot \left(x \cdot y_m\right)\\ t_3 := \left(y_m \cdot z\right) \cdot \left(-t_m\right)\\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+124}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+44}:\\ \;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq -10500000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.66 \cdot 10^{-243}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-240}:\\ \;\;\;\;y_m \cdot \left(t_m \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-26}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array}\right) \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (let* ((t_2 (* t_m (* x y_m))) (t_3 (* (* y_m z) (- t_m))))
   (*
    t_s
    (*
     y_s
     (if (<= x -1.75e+124)
       t_2
       (if (<= x -4.5e+44)
         (* (* y_m t_m) (- z))
         (if (<= x -10500000000.0)
           t_2
           (if (<= x -1.66e-243)
             t_3
             (if (<= x 4.5e-240)
               (* y_m (* t_m (- z)))
               (if (<= x 1.45e-26) t_3 t_2))))))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double t_2 = t_m * (x * y_m);
	double t_3 = (y_m * z) * -t_m;
	double tmp;
	if (x <= -1.75e+124) {
		tmp = t_2;
	} else if (x <= -4.5e+44) {
		tmp = (y_m * t_m) * -z;
	} else if (x <= -10500000000.0) {
		tmp = t_2;
	} else if (x <= -1.66e-243) {
		tmp = t_3;
	} else if (x <= 4.5e-240) {
		tmp = y_m * (t_m * -z);
	} else if (x <= 1.45e-26) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_2 = t_m * (x * y_m)
    t_3 = (y_m * z) * -t_m
    if (x <= (-1.75d+124)) then
        tmp = t_2
    else if (x <= (-4.5d+44)) then
        tmp = (y_m * t_m) * -z
    else if (x <= (-10500000000.0d0)) then
        tmp = t_2
    else if (x <= (-1.66d-243)) then
        tmp = t_3
    else if (x <= 4.5d-240) then
        tmp = y_m * (t_m * -z)
    else if (x <= 1.45d-26) then
        tmp = t_3
    else
        tmp = t_2
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double t_2 = t_m * (x * y_m);
	double t_3 = (y_m * z) * -t_m;
	double tmp;
	if (x <= -1.75e+124) {
		tmp = t_2;
	} else if (x <= -4.5e+44) {
		tmp = (y_m * t_m) * -z;
	} else if (x <= -10500000000.0) {
		tmp = t_2;
	} else if (x <= -1.66e-243) {
		tmp = t_3;
	} else if (x <= 4.5e-240) {
		tmp = y_m * (t_m * -z);
	} else if (x <= 1.45e-26) {
		tmp = t_3;
	} else {
		tmp = t_2;
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	t_2 = t_m * (x * y_m)
	t_3 = (y_m * z) * -t_m
	tmp = 0
	if x <= -1.75e+124:
		tmp = t_2
	elif x <= -4.5e+44:
		tmp = (y_m * t_m) * -z
	elif x <= -10500000000.0:
		tmp = t_2
	elif x <= -1.66e-243:
		tmp = t_3
	elif x <= 4.5e-240:
		tmp = y_m * (t_m * -z)
	elif x <= 1.45e-26:
		tmp = t_3
	else:
		tmp = t_2
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	t_2 = Float64(t_m * Float64(x * y_m))
	t_3 = Float64(Float64(y_m * z) * Float64(-t_m))
	tmp = 0.0
	if (x <= -1.75e+124)
		tmp = t_2;
	elseif (x <= -4.5e+44)
		tmp = Float64(Float64(y_m * t_m) * Float64(-z));
	elseif (x <= -10500000000.0)
		tmp = t_2;
	elseif (x <= -1.66e-243)
		tmp = t_3;
	elseif (x <= 4.5e-240)
		tmp = Float64(y_m * Float64(t_m * Float64(-z)));
	elseif (x <= 1.45e-26)
		tmp = t_3;
	else
		tmp = t_2;
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	t_2 = t_m * (x * y_m);
	t_3 = (y_m * z) * -t_m;
	tmp = 0.0;
	if (x <= -1.75e+124)
		tmp = t_2;
	elseif (x <= -4.5e+44)
		tmp = (y_m * t_m) * -z;
	elseif (x <= -10500000000.0)
		tmp = t_2;
	elseif (x <= -1.66e-243)
		tmp = t_3;
	elseif (x <= 4.5e-240)
		tmp = y_m * (t_m * -z);
	elseif (x <= 1.45e-26)
		tmp = t_3;
	else
		tmp = t_2;
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := Block[{t$95$2 = N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y$95$m * z), $MachinePrecision] * (-t$95$m)), $MachinePrecision]}, N[(t$95$s * N[(y$95$s * If[LessEqual[x, -1.75e+124], t$95$2, If[LessEqual[x, -4.5e+44], N[(N[(y$95$m * t$95$m), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[x, -10500000000.0], t$95$2, If[LessEqual[x, -1.66e-243], t$95$3, If[LessEqual[x, 4.5e-240], N[(y$95$m * N[(t$95$m * (-z)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e-26], t$95$3, t$95$2]]]]]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
\begin{array}{l}
t_2 := t_m \cdot \left(x \cdot y_m\right)\\
t_3 := \left(y_m \cdot z\right) \cdot \left(-t_m\right)\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+124}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -4.5 \cdot 10^{+44}:\\
\;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\

\mathbf{elif}\;x \leq -10500000000:\\
\;\;\;\;t_2\\

\mathbf{elif}\;x \leq -1.66 \cdot 10^{-243}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;x \leq 4.5 \cdot 10^{-240}:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(-z\right)\right)\\

\mathbf{elif}\;x \leq 1.45 \cdot 10^{-26}:\\
\;\;\;\;t_3\\

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


\end{array}\right)
\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.7500000000000001e124 or -4.5e44 < x < -1.05e10 or 1.4499999999999999e-26 < x

    1. Initial program 86.6%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.9%

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

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

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

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

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

    if -1.7500000000000001e124 < x < -4.5e44

    1. Initial program 76.1%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--84.4%

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

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

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

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(-y \cdot z\right)} \]
      3. distribute-rgt-neg-out60.3%

        \[\leadsto t \cdot \color{blue}{\left(y \cdot \left(-z\right)\right)} \]
      4. associate-*r*75.6%

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

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

    if -1.05e10 < x < -1.66000000000000005e-243 or 4.5000000000000001e-240 < x < 1.4499999999999999e-26

    1. Initial program 89.3%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--90.4%

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

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

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

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

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

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

    if -1.66000000000000005e-243 < x < 4.5000000000000001e-240

    1. Initial program 85.1%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--85.1%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*90.2%

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

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

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

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

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

        \[\leadsto y \cdot \left(-\color{blue}{z \cdot t}\right) \]
      3. distribute-rgt-neg-in78.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.75 \cdot 10^{+124}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+44}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(-z\right)\\ \mathbf{elif}\;x \leq -10500000000:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;x \leq -1.66 \cdot 10^{-243}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{-240}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \mathbf{elif}\;x \leq 1.45 \cdot 10^{-26}:\\ \;\;\;\;\left(y \cdot z\right) \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \end{array} \]

Alternative 3: 75.8% accurate, 0.3× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+124} \lor \neg \left(x \leq -5.5 \cdot 10^{+44} \lor \neg \left(x \leq -4000000000\right) \land x \leq 2.5 \cdot 10^{-26}\right):\\ \;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\ \end{array}\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (*
  t_s
  (*
   y_s
   (if (or (<= x -1.15e+124)
           (not
            (or (<= x -5.5e+44)
                (and (not (<= x -4000000000.0)) (<= x 2.5e-26)))))
     (* t_m (* x y_m))
     (* (* y_m t_m) (- z))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if ((x <= -1.15e+124) || !((x <= -5.5e+44) || (!(x <= -4000000000.0) && (x <= 2.5e-26)))) {
		tmp = t_m * (x * y_m);
	} else {
		tmp = (y_m * t_m) * -z;
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((x <= (-1.15d+124)) .or. (.not. (x <= (-5.5d+44)) .or. (.not. (x <= (-4000000000.0d0))) .and. (x <= 2.5d-26))) then
        tmp = t_m * (x * y_m)
    else
        tmp = (y_m * t_m) * -z
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if ((x <= -1.15e+124) || !((x <= -5.5e+44) || (!(x <= -4000000000.0) && (x <= 2.5e-26)))) {
		tmp = t_m * (x * y_m);
	} else {
		tmp = (y_m * t_m) * -z;
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	tmp = 0
	if (x <= -1.15e+124) or not ((x <= -5.5e+44) or (not (x <= -4000000000.0) and (x <= 2.5e-26))):
		tmp = t_m * (x * y_m)
	else:
		tmp = (y_m * t_m) * -z
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0
	if ((x <= -1.15e+124) || !((x <= -5.5e+44) || (!(x <= -4000000000.0) && (x <= 2.5e-26))))
		tmp = Float64(t_m * Float64(x * y_m));
	else
		tmp = Float64(Float64(y_m * t_m) * Float64(-z));
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0;
	if ((x <= -1.15e+124) || ~(((x <= -5.5e+44) || (~((x <= -4000000000.0)) && (x <= 2.5e-26)))))
		tmp = t_m * (x * y_m);
	else
		tmp = (y_m * t_m) * -z;
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[Or[LessEqual[x, -1.15e+124], N[Not[Or[LessEqual[x, -5.5e+44], And[N[Not[LessEqual[x, -4000000000.0]], $MachinePrecision], LessEqual[x, 2.5e-26]]]], $MachinePrecision]], N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * t$95$m), $MachinePrecision] * (-z)), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+124} \lor \neg \left(x \leq -5.5 \cdot 10^{+44} \lor \neg \left(x \leq -4000000000\right) \land x \leq 2.5 \cdot 10^{-26}\right):\\
\;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\

\mathbf{else}:\\
\;\;\;\;\left(y_m \cdot t_m\right) \cdot \left(-z\right)\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.14999999999999992e124 or -5.5000000000000001e44 < x < -4e9 or 2.5000000000000001e-26 < x

    1. Initial program 86.6%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.9%

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

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

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

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

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

    if -1.14999999999999992e124 < x < -5.5000000000000001e44 or -4e9 < x < 2.5000000000000001e-26

    1. Initial program 87.1%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--88.6%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*91.3%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot \left(y \cdot z\right)\right)} \]
    5. Step-by-step derivation
      1. mul-1-neg71.2%

        \[\leadsto \color{blue}{-t \cdot \left(y \cdot z\right)} \]
      2. distribute-rgt-neg-in71.2%

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

        \[\leadsto t \cdot \color{blue}{\left(y \cdot \left(-z\right)\right)} \]
      4. associate-*r*77.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+124} \lor \neg \left(x \leq -5.5 \cdot 10^{+44} \lor \neg \left(x \leq -4000000000\right) \land x \leq 2.5 \cdot 10^{-26}\right):\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(-z\right)\\ \end{array} \]

Alternative 4: 89.7% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{+175} \lor \neg \left(x \leq 1.35 \cdot 10^{+82}\right):\\ \;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\ \mathbf{else}:\\ \;\;\;\;y_m \cdot \left(t_m \cdot \left(x - z\right)\right)\\ \end{array}\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (*
  t_s
  (*
   y_s
   (if (or (<= x -1.95e+175) (not (<= x 1.35e+82)))
     (* t_m (* x y_m))
     (* y_m (* t_m (- x z)))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if ((x <= -1.95e+175) || !(x <= 1.35e+82)) {
		tmp = t_m * (x * y_m);
	} else {
		tmp = y_m * (t_m * (x - z));
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((x <= (-1.95d+175)) .or. (.not. (x <= 1.35d+82))) then
        tmp = t_m * (x * y_m)
    else
        tmp = y_m * (t_m * (x - z))
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if ((x <= -1.95e+175) || !(x <= 1.35e+82)) {
		tmp = t_m * (x * y_m);
	} else {
		tmp = y_m * (t_m * (x - z));
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	tmp = 0
	if (x <= -1.95e+175) or not (x <= 1.35e+82):
		tmp = t_m * (x * y_m)
	else:
		tmp = y_m * (t_m * (x - z))
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0
	if ((x <= -1.95e+175) || !(x <= 1.35e+82))
		tmp = Float64(t_m * Float64(x * y_m));
	else
		tmp = Float64(y_m * Float64(t_m * Float64(x - z)));
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0;
	if ((x <= -1.95e+175) || ~((x <= 1.35e+82)))
		tmp = t_m * (x * y_m);
	else
		tmp = y_m * (t_m * (x - z));
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[Or[LessEqual[x, -1.95e+175], N[Not[LessEqual[x, 1.35e+82]], $MachinePrecision]], N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(t$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{+175} \lor \neg \left(x \leq 1.35 \cdot 10^{+82}\right):\\
\;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\

\mathbf{else}:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(x - z\right)\right)\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.94999999999999986e175 or 1.35e82 < x

    1. Initial program 82.3%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--87.0%

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

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

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

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

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

    if -1.94999999999999986e175 < x < 1.35e82

    1. Initial program 89.2%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--90.4%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*93.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{+175} \lor \neg \left(x \leq 1.35 \cdot 10^{+82}\right):\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \end{array} \]

Alternative 5: 75.8% accurate, 0.6× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;x \leq -30000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-27}\right):\\ \;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\ \mathbf{else}:\\ \;\;\;\;y_m \cdot \left(t_m \cdot \left(-z\right)\right)\\ \end{array}\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (*
  t_s
  (*
   y_s
   (if (or (<= x -30000000000.0) (not (<= x 4.6e-27)))
     (* t_m (* x y_m))
     (* y_m (* t_m (- z)))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if ((x <= -30000000000.0) || !(x <= 4.6e-27)) {
		tmp = t_m * (x * y_m);
	} else {
		tmp = y_m * (t_m * -z);
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((x <= (-30000000000.0d0)) .or. (.not. (x <= 4.6d-27))) then
        tmp = t_m * (x * y_m)
    else
        tmp = y_m * (t_m * -z)
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if ((x <= -30000000000.0) || !(x <= 4.6e-27)) {
		tmp = t_m * (x * y_m);
	} else {
		tmp = y_m * (t_m * -z);
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	tmp = 0
	if (x <= -30000000000.0) or not (x <= 4.6e-27):
		tmp = t_m * (x * y_m)
	else:
		tmp = y_m * (t_m * -z)
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0
	if ((x <= -30000000000.0) || !(x <= 4.6e-27))
		tmp = Float64(t_m * Float64(x * y_m));
	else
		tmp = Float64(y_m * Float64(t_m * Float64(-z)));
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0;
	if ((x <= -30000000000.0) || ~((x <= 4.6e-27)))
		tmp = t_m * (x * y_m);
	else
		tmp = y_m * (t_m * -z);
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[Or[LessEqual[x, -30000000000.0], N[Not[LessEqual[x, 4.6e-27]], $MachinePrecision]], N[(t$95$m * N[(x * y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(t$95$m * (-z)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq -30000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-27}\right):\\
\;\;\;\;t_m \cdot \left(x \cdot y_m\right)\\

\mathbf{else}:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(-z\right)\right)\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3e10 or 4.5999999999999999e-27 < x

    1. Initial program 85.7%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.4%

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

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

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

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

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

    if -3e10 < x < 4.5999999999999999e-27

    1. Initial program 88.2%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--89.0%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*92.9%

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\left(-t \cdot z\right)} \]
      2. *-commutative75.6%

        \[\leadsto y \cdot \left(-\color{blue}{z \cdot t}\right) \]
      3. distribute-rgt-neg-in75.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -30000000000 \lor \neg \left(x \leq 4.6 \cdot 10^{-27}\right):\\ \;\;\;\;t \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t \cdot \left(-z\right)\right)\\ \end{array} \]

Alternative 6: 98.4% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;t_m \leq 2000000000:\\ \;\;\;\;y_m \cdot \left(t_m \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y_m \cdot t_m\right)\\ \end{array}\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (*
  t_s
  (*
   y_s
   (if (<= t_m 2000000000.0)
     (* y_m (* t_m (- x z)))
     (* (- x z) (* y_m t_m))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if (t_m <= 2000000000.0) {
		tmp = y_m * (t_m * (x - z));
	} else {
		tmp = (x - z) * (y_m * t_m);
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 2000000000.0d0) then
        tmp = y_m * (t_m * (x - z))
    else
        tmp = (x - z) * (y_m * t_m)
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if (t_m <= 2000000000.0) {
		tmp = y_m * (t_m * (x - z));
	} else {
		tmp = (x - z) * (y_m * t_m);
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	tmp = 0
	if t_m <= 2000000000.0:
		tmp = y_m * (t_m * (x - z))
	else:
		tmp = (x - z) * (y_m * t_m)
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0
	if (t_m <= 2000000000.0)
		tmp = Float64(y_m * Float64(t_m * Float64(x - z)));
	else
		tmp = Float64(Float64(x - z) * Float64(y_m * t_m));
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0;
	if (t_m <= 2000000000.0)
		tmp = y_m * (t_m * (x - z));
	else
		tmp = (x - z) * (y_m * t_m);
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[LessEqual[t$95$m, 2000000000.0], N[(y$95$m * N[(t$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 2000000000:\\
\;\;\;\;y_m \cdot \left(t_m \cdot \left(x - z\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x - z\right) \cdot \left(y_m \cdot t_m\right)\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 2e9

    1. Initial program 85.9%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--87.4%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*92.9%

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

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

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

    if 2e9 < t

    1. Initial program 89.9%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. *-commutative89.9%

        \[\leadsto \color{blue}{t \cdot \left(x \cdot y - z \cdot y\right)} \]
      2. distribute-rgt-out--94.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 2000000000:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array} \]

Alternative 7: 57.6% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \begin{array}{l} \mathbf{if}\;t_m \leq 0.01:\\ \;\;\;\;y_m \cdot \left(x \cdot t_m\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y_m \cdot t_m\right)\\ \end{array}\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (* t_s (* y_s (if (<= t_m 0.01) (* y_m (* x t_m)) (* x (* y_m t_m))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if (t_m <= 0.01) {
		tmp = y_m * (x * t_m);
	} else {
		tmp = x * (y_m * t_m);
	}
	return t_s * (y_s * tmp);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 0.01d0) then
        tmp = y_m * (x * t_m)
    else
        tmp = x * (y_m * t_m)
    end if
    code = t_s * (y_s * tmp)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	double tmp;
	if (t_m <= 0.01) {
		tmp = y_m * (x * t_m);
	} else {
		tmp = x * (y_m * t_m);
	}
	return t_s * (y_s * tmp);
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	tmp = 0
	if t_m <= 0.01:
		tmp = y_m * (x * t_m)
	else:
		tmp = x * (y_m * t_m)
	return t_s * (y_s * tmp)
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0
	if (t_m <= 0.01)
		tmp = Float64(y_m * Float64(x * t_m));
	else
		tmp = Float64(x * Float64(y_m * t_m));
	end
	return Float64(t_s * Float64(y_s * tmp))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp_2 = code(t_s, y_s, x, y_m, z, t_m)
	tmp = 0.0;
	if (t_m <= 0.01)
		tmp = y_m * (x * t_m);
	else
		tmp = x * (y_m * t_m);
	end
	tmp_2 = t_s * (y_s * tmp);
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * If[LessEqual[t$95$m, 0.01], N[(y$95$m * N[(x * t$95$m), $MachinePrecision]), $MachinePrecision], N[(x * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 0.01:\\
\;\;\;\;y_m \cdot \left(x \cdot t_m\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \left(y_m \cdot t_m\right)\\


\end{array}\right)
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 0.0100000000000000002

    1. Initial program 85.9%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--87.4%

        \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right)} \cdot t \]
      2. associate-*l*92.9%

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

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

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

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

    if 0.0100000000000000002 < t

    1. Initial program 89.9%

      \[\left(x \cdot y - z \cdot y\right) \cdot t \]
    2. Step-by-step derivation
      1. distribute-rgt-out--94.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{x + z}{x \cdot x - z \cdot z}}} \cdot t \]
      4. *-un-lft-identity67.9%

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

        \[\leadsto \frac{y}{\color{blue}{\frac{1}{\frac{x \cdot x - z \cdot z}{x + z}}}} \cdot t \]
      6. flip--94.3%

        \[\leadsto \frac{y}{\frac{1}{\color{blue}{x - z}}} \cdot t \]
    5. Applied egg-rr94.3%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 0.01:\\ \;\;\;\;y \cdot \left(x \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot t\right)\\ \end{array} \]

Alternative 8: 97.1% accurate, 1.3× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \left(t_m \cdot \left(y_m \cdot \left(x - z\right)\right)\right)\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (* t_s (* y_s (* t_m (* y_m (- x z))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	return t_s * (y_s * (t_m * (y_m * (x - z))));
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    code = t_s * (y_s * (t_m * (y_m * (x - z))))
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	return t_s * (y_s * (t_m * (y_m * (x - z))));
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	return t_s * (y_s * (t_m * (y_m * (x - z))))
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	return Float64(t_s * Float64(y_s * Float64(t_m * Float64(y_m * Float64(x - z)))))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp = code(t_s, y_s, x, y_m, z, t_m)
	tmp = t_s * (y_s * (t_m * (y_m * (x - z))));
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * N[(t$95$m * N[(y$95$m * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \left(t_m \cdot \left(y_m \cdot \left(x - z\right)\right)\right)\right)
\end{array}
Derivation
  1. Initial program 86.9%

    \[\left(x \cdot y - z \cdot y\right) \cdot t \]
  2. Step-by-step derivation
    1. distribute-rgt-out--89.2%

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

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

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

Alternative 9: 54.7% accurate, 1.8× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ [x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\ \\ t_s \cdot \left(y_s \cdot \left(x \cdot \left(y_m \cdot t_m\right)\right)\right) \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
(FPCore (t_s y_s x y_m z t_m)
 :precision binary64
 (* t_s (* y_s (* x (* y_m t_m)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
t_m = fabs(t);
t_s = copysign(1.0, t);
assert(x < y_m && y_m < z && z < t_m);
double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	return t_s * (y_s * (x * (y_m * t_m)));
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
t_m = abs(t)
t_s = copysign(1.0d0, t)
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
real(8) function code(t_s, y_s, x, y_m, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: y_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    code = t_s * (y_s * (x * (y_m * t_m)))
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
assert x < y_m && y_m < z && z < t_m;
public static double code(double t_s, double y_s, double x, double y_m, double z, double t_m) {
	return t_s * (y_s * (x * (y_m * t_m)));
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
[x, y_m, z, t_m] = sort([x, y_m, z, t_m])
def code(t_s, y_s, x, y_m, z, t_m):
	return t_s * (y_s * (x * (y_m * t_m)))
y_m = abs(y)
y_s = copysign(1.0, y)
t_m = abs(t)
t_s = copysign(1.0, t)
x, y_m, z, t_m = sort([x, y_m, z, t_m])
function code(t_s, y_s, x, y_m, z, t_m)
	return Float64(t_s * Float64(y_s * Float64(x * Float64(y_m * t_m))))
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
t_m = abs(t);
t_s = sign(t) * abs(1.0);
x, y_m, z, t_m = num2cell(sort([x, y_m, z, t_m])){:}
function tmp = code(t_s, y_s, x, y_m, z, t_m)
	tmp = t_s * (y_s * (x * (y_m * t_m)));
end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
NOTE: x, y_m, z, and t_m should be sorted in increasing order before calling this function.
code[t$95$s_, y$95$s_, x_, y$95$m_, z_, t$95$m_] := N[(t$95$s * N[(y$95$s * N[(x * N[(y$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)
\\
[x, y_m, z, t_m] = \mathsf{sort}([x, y_m, z, t_m])\\
\\
t_s \cdot \left(y_s \cdot \left(x \cdot \left(y_m \cdot t_m\right)\right)\right)
\end{array}
Derivation
  1. Initial program 86.9%

    \[\left(x \cdot y - z \cdot y\right) \cdot t \]
  2. Step-by-step derivation
    1. distribute-rgt-out--89.2%

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{x + z}{x \cdot x - z \cdot z}}} \cdot t \]
    4. *-un-lft-identity60.2%

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

      \[\leadsto \frac{y}{\color{blue}{\frac{1}{\frac{x \cdot x - z \cdot z}{x + z}}}} \cdot t \]
    6. flip--89.1%

      \[\leadsto \frac{y}{\frac{1}{\color{blue}{x - z}}} \cdot t \]
  5. Applied egg-rr89.1%

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\left(t \cdot y\right)} \]
  8. Simplified55.1%

    \[\leadsto \color{blue}{x \cdot \left(t \cdot y\right)} \]
  9. Final simplification55.1%

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

Developer target: 95.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t < -9.231879582886777 \cdot 10^{-80}:\\
\;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\

\mathbf{elif}\;t < 2.543067051564877 \cdot 10^{+83}:\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023336 
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))

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