Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3

Percentage Accurate: 93.4% → 97.7%
Time: 8.9s
Alternatives: 8
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 8 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: 93.4% 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: 97.7% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\ \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;t \leq 1.5 \cdot 10^{+30}:\\ \;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y\_m \cdot t\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z t)
 :precision binary64
 (* y_s (if (<= t 1.5e+30) (* y_m (* (- x z) t)) (* (- x z) (* y_m t)))))
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
	double tmp;
	if (t <= 1.5e+30) {
		tmp = y_m * ((x - z) * t);
	} else {
		tmp = (x - z) * (y_m * t);
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
    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
    real(8) :: tmp
    if (t <= 1.5d+30) then
        tmp = y_m * ((x - z) * t)
    else
        tmp = (x - z) * (y_m * t)
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
	double tmp;
	if (t <= 1.5e+30) {
		tmp = y_m * ((x - z) * t);
	} else {
		tmp = (x - z) * (y_m * t);
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x, y_m, z, t] = sort([x, y_m, z, t])
def code(y_s, x, y_m, z, t):
	tmp = 0
	if t <= 1.5e+30:
		tmp = y_m * ((x - z) * t)
	else:
		tmp = (x - z) * (y_m * t)
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
x, y_m, z, t = sort([x, y_m, z, t])
function code(y_s, x, y_m, z, t)
	tmp = 0.0
	if (t <= 1.5e+30)
		tmp = Float64(y_m * Float64(Float64(x - z) * t));
	else
		tmp = Float64(Float64(x - z) * Float64(y_m * t));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
	tmp = 0.0;
	if (t <= 1.5e+30)
		tmp = y_m * ((x - z) * t);
	else
		tmp = (x - z) * (y_m * t);
	end
	tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[LessEqual[t, 1.5e+30], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(N[(x - z), $MachinePrecision] * N[(y$95$m * t), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t \leq 1.5 \cdot 10^{+30}:\\
\;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.49999999999999989e30

    1. Initial program 90.0%

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

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

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

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

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

    if 1.49999999999999989e30 < t

    1. Initial program 96.1%

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

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

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

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

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

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

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

Alternative 2: 75.1% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.90000000000000001e-48 or 0.110000000000000001 < x

    1. Initial program 88.4%

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot t \]
    7. Simplified74.2%

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

    if -1.90000000000000001e-48 < x < 0.110000000000000001

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

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

Alternative 3: 75.6% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.49999999999999984e-50 or 0.599999999999999978 < x

    1. Initial program 88.4%

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot t \]
    7. Simplified74.2%

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

    if -2.49999999999999984e-50 < x < 0.599999999999999978

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 75.8% accurate, 0.6× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.50000000000000012e-50 or 1.6000000000000001 < x

    1. Initial program 88.4%

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

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

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

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

        \[\leadsto \color{blue}{\left(y \cdot x\right)} \cdot t \]
    7. Simplified74.2%

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

    if -8.50000000000000012e-50 < x < 1.6000000000000001

    1. Initial program 94.3%

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

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

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

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

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

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

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

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

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

Alternative 5: 88.5% accurate, 0.7× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ y_s = \mathsf{copysign}\left(1, y\right) \\ [x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\ \\ y\_s \cdot \begin{array}{l} \mathbf{if}\;z \leq 3.5 \cdot 10^{+100}:\\ \;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(z \cdot \left(-y\_m\right)\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
(FPCore (y_s x y_m z t)
 :precision binary64
 (* y_s (if (<= z 3.5e+100) (* y_m (* (- x z) t)) (* t (* z (- y_m))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
assert(x < y_m && y_m < z && z < t);
double code(double y_s, double x, double y_m, double z, double t) {
	double tmp;
	if (z <= 3.5e+100) {
		tmp = y_m * ((x - z) * t);
	} else {
		tmp = t * (z * -y_m);
	}
	return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
real(8) function code(y_s, x, y_m, z, t)
    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
    real(8) :: tmp
    if (z <= 3.5d+100) then
        tmp = y_m * ((x - z) * t)
    else
        tmp = t * (z * -y_m)
    end if
    code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
assert x < y_m && y_m < z && z < t;
public static double code(double y_s, double x, double y_m, double z, double t) {
	double tmp;
	if (z <= 3.5e+100) {
		tmp = y_m * ((x - z) * t);
	} else {
		tmp = t * (z * -y_m);
	}
	return y_s * tmp;
}
y_m = math.fabs(y)
y_s = math.copysign(1.0, y)
[x, y_m, z, t] = sort([x, y_m, z, t])
def code(y_s, x, y_m, z, t):
	tmp = 0
	if z <= 3.5e+100:
		tmp = y_m * ((x - z) * t)
	else:
		tmp = t * (z * -y_m)
	return y_s * tmp
y_m = abs(y)
y_s = copysign(1.0, y)
x, y_m, z, t = sort([x, y_m, z, t])
function code(y_s, x, y_m, z, t)
	tmp = 0.0
	if (z <= 3.5e+100)
		tmp = Float64(y_m * Float64(Float64(x - z) * t));
	else
		tmp = Float64(t * Float64(z * Float64(-y_m)));
	end
	return Float64(y_s * tmp)
end
y_m = abs(y);
y_s = sign(y) * abs(1.0);
x, y_m, z, t = num2cell(sort([x, y_m, z, t])){:}
function tmp_2 = code(y_s, x, y_m, z, t)
	tmp = 0.0;
	if (z <= 3.5e+100)
		tmp = y_m * ((x - z) * t);
	else
		tmp = t * (z * -y_m);
	end
	tmp_2 = 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]
NOTE: x, y_m, z, and t should be sorted in increasing order before calling this function.
code[y$95$s_, x_, y$95$m_, z_, t_] := N[(y$95$s * If[LessEqual[z, 3.5e+100], N[(y$95$m * N[(N[(x - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(t * N[(z * (-y$95$m)), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
[x, y_m, z, t] = \mathsf{sort}([x, y_m, z, t])\\
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 3.5 \cdot 10^{+100}:\\
\;\;\;\;y\_m \cdot \left(\left(x - z\right) \cdot t\right)\\

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


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

    1. Initial program 93.0%

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

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

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

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

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

    if 3.49999999999999976e100 < z

    1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

Alternative 6: 94.5% accurate, 1.3× speedup?

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

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

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

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

    \[\leadsto \left(y \cdot \left(x - z\right)\right) \cdot t \]
  6. Add Preprocessing

Alternative 7: 52.3% accurate, 1.8× speedup?

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

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

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

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

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

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

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

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

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

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

    \[\leadsto y \cdot \left(x \cdot t\right) \]
  9. Add Preprocessing

Alternative 8: 54.9% accurate, 1.8× speedup?

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

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

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

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

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

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

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

    \[\leadsto t \cdot \left(y \cdot x\right) \]
  9. Add Preprocessing

Developer target: 96.2% 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 2024027 
(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))