Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1

Percentage Accurate: 97.1% → 96.6%
Time: 9.1s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x - y}{z - y} \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}

\\
\frac{x - y}{z - y} \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 10 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: 97.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{z - y} \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}

\\
\frac{x - y}{z - y} \cdot t
\end{array}

Alternative 1: 96.6% accurate, 0.6× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;t_m \leq 10^{-40}:\\ \;\;\;\;t_m \cdot \frac{x - y}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{\frac{z - y}{t_m}}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (<= t_m 1e-40) (* t_m (/ (- x y) (- z y))) (/ (- x y) (/ (- z y) t_m)))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (t_m <= 1e-40) {
		tmp = t_m * ((x - y) / (z - y));
	} else {
		tmp = (x - y) / ((z - y) / t_m);
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (t_m <= 1d-40) then
        tmp = t_m * ((x - y) / (z - y))
    else
        tmp = (x - y) / ((z - y) / t_m)
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (t_m <= 1e-40) {
		tmp = t_m * ((x - y) / (z - y));
	} else {
		tmp = (x - y) / ((z - y) / t_m);
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if t_m <= 1e-40:
		tmp = t_m * ((x - y) / (z - y))
	else:
		tmp = (x - y) / ((z - y) / t_m)
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if (t_m <= 1e-40)
		tmp = Float64(t_m * Float64(Float64(x - y) / Float64(z - y)));
	else
		tmp = Float64(Float64(x - y) / Float64(Float64(z - y) / t_m));
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if (t_m <= 1e-40)
		tmp = t_m * ((x - y) / (z - y));
	else
		tmp = (x - y) / ((z - y) / t_m);
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[t$95$m, 1e-40], N[(t$95$m * N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] / N[(N[(z - y), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;t_m \leq 10^{-40}:\\
\;\;\;\;t_m \cdot \frac{x - y}{z - y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x - y}{\frac{z - y}{t_m}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 9.9999999999999993e-41

    1. Initial program 95.4%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing

    if 9.9999999999999993e-41 < t

    1. Initial program 95.7%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-/r/96.7%

        \[\leadsto \color{blue}{\frac{x - y}{\frac{z - y}{t}}} \]
    3. Simplified96.7%

      \[\leadsto \color{blue}{\frac{x - y}{\frac{z - y}{t}}} \]
    4. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification95.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 10^{-40}:\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 67.7% accurate, 0.3× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{+119}:\\ \;\;\;\;t_m\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{+65}:\\ \;\;\;\;t_m \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -3600000000:\\ \;\;\;\;t_m\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \frac{t_m}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_m\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (<= y -1.6e+119)
    t_m
    (if (<= y -3.6e+65)
      (* t_m (/ (- y) z))
      (if (<= y -3600000000.0)
        t_m
        (if (<= y 1.2e+62) (* x (/ t_m (- z y))) t_m))))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (y <= -1.6e+119) {
		tmp = t_m;
	} else if (y <= -3.6e+65) {
		tmp = t_m * (-y / z);
	} else if (y <= -3600000000.0) {
		tmp = t_m;
	} else if (y <= 1.2e+62) {
		tmp = x * (t_m / (z - y));
	} else {
		tmp = t_m;
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (y <= (-1.6d+119)) then
        tmp = t_m
    else if (y <= (-3.6d+65)) then
        tmp = t_m * (-y / z)
    else if (y <= (-3600000000.0d0)) then
        tmp = t_m
    else if (y <= 1.2d+62) then
        tmp = x * (t_m / (z - y))
    else
        tmp = t_m
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (y <= -1.6e+119) {
		tmp = t_m;
	} else if (y <= -3.6e+65) {
		tmp = t_m * (-y / z);
	} else if (y <= -3600000000.0) {
		tmp = t_m;
	} else if (y <= 1.2e+62) {
		tmp = x * (t_m / (z - y));
	} else {
		tmp = t_m;
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if y <= -1.6e+119:
		tmp = t_m
	elif y <= -3.6e+65:
		tmp = t_m * (-y / z)
	elif y <= -3600000000.0:
		tmp = t_m
	elif y <= 1.2e+62:
		tmp = x * (t_m / (z - y))
	else:
		tmp = t_m
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if (y <= -1.6e+119)
		tmp = t_m;
	elseif (y <= -3.6e+65)
		tmp = Float64(t_m * Float64(Float64(-y) / z));
	elseif (y <= -3600000000.0)
		tmp = t_m;
	elseif (y <= 1.2e+62)
		tmp = Float64(x * Float64(t_m / Float64(z - y)));
	else
		tmp = t_m;
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if (y <= -1.6e+119)
		tmp = t_m;
	elseif (y <= -3.6e+65)
		tmp = t_m * (-y / z);
	elseif (y <= -3600000000.0)
		tmp = t_m;
	elseif (y <= 1.2e+62)
		tmp = x * (t_m / (z - y));
	else
		tmp = t_m;
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[y, -1.6e+119], t$95$m, If[LessEqual[y, -3.6e+65], N[(t$95$m * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3600000000.0], t$95$m, If[LessEqual[y, 1.2e+62], N[(x * N[(t$95$m / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$m]]]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+119}:\\
\;\;\;\;t_m\\

\mathbf{elif}\;y \leq -3.6 \cdot 10^{+65}:\\
\;\;\;\;t_m \cdot \frac{-y}{z}\\

\mathbf{elif}\;y \leq -3600000000:\\
\;\;\;\;t_m\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \frac{t_m}{z - y}\\

\mathbf{else}:\\
\;\;\;\;t_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.59999999999999995e119 or -3.59999999999999978e65 < y < -3.6e9 or 1.2e62 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 69.0%

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

    if -1.59999999999999995e119 < y < -3.59999999999999978e65

    1. Initial program 99.6%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 74.8%

      \[\leadsto \color{blue}{\frac{x - y}{z}} \cdot t \]
    4. Taylor expanded in x around 0 60.6%

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

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

        \[\leadsto \color{blue}{\frac{-y}{z}} \cdot t \]
    6. Simplified60.6%

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

    if -3.6e9 < y < 1.2e62

    1. Initial program 92.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 72.6%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z - y}} \]
    4. Step-by-step derivation
      1. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{x \cdot t}}{z - y} \]
      2. associate-*r/72.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{+119}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{+65}:\\ \;\;\;\;t \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -3600000000:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.1% accurate, 0.4× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+118}:\\ \;\;\;\;t_m\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{+66}:\\ \;\;\;\;t_m \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -370000000:\\ \;\;\;\;t_m\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \frac{t_m}{z}\\ \mathbf{else}:\\ \;\;\;\;t_m\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (<= y -7e+118)
    t_m
    (if (<= y -2.25e+66)
      (* t_m (/ (- y) z))
      (if (<= y -370000000.0) t_m (if (<= y 4e+62) (* x (/ t_m z)) t_m))))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (y <= -7e+118) {
		tmp = t_m;
	} else if (y <= -2.25e+66) {
		tmp = t_m * (-y / z);
	} else if (y <= -370000000.0) {
		tmp = t_m;
	} else if (y <= 4e+62) {
		tmp = x * (t_m / z);
	} else {
		tmp = t_m;
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (y <= (-7d+118)) then
        tmp = t_m
    else if (y <= (-2.25d+66)) then
        tmp = t_m * (-y / z)
    else if (y <= (-370000000.0d0)) then
        tmp = t_m
    else if (y <= 4d+62) then
        tmp = x * (t_m / z)
    else
        tmp = t_m
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (y <= -7e+118) {
		tmp = t_m;
	} else if (y <= -2.25e+66) {
		tmp = t_m * (-y / z);
	} else if (y <= -370000000.0) {
		tmp = t_m;
	} else if (y <= 4e+62) {
		tmp = x * (t_m / z);
	} else {
		tmp = t_m;
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if y <= -7e+118:
		tmp = t_m
	elif y <= -2.25e+66:
		tmp = t_m * (-y / z)
	elif y <= -370000000.0:
		tmp = t_m
	elif y <= 4e+62:
		tmp = x * (t_m / z)
	else:
		tmp = t_m
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if (y <= -7e+118)
		tmp = t_m;
	elseif (y <= -2.25e+66)
		tmp = Float64(t_m * Float64(Float64(-y) / z));
	elseif (y <= -370000000.0)
		tmp = t_m;
	elseif (y <= 4e+62)
		tmp = Float64(x * Float64(t_m / z));
	else
		tmp = t_m;
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if (y <= -7e+118)
		tmp = t_m;
	elseif (y <= -2.25e+66)
		tmp = t_m * (-y / z);
	elseif (y <= -370000000.0)
		tmp = t_m;
	elseif (y <= 4e+62)
		tmp = x * (t_m / z);
	else
		tmp = t_m;
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[y, -7e+118], t$95$m, If[LessEqual[y, -2.25e+66], N[(t$95$m * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -370000000.0], t$95$m, If[LessEqual[y, 4e+62], N[(x * N[(t$95$m / z), $MachinePrecision]), $MachinePrecision], t$95$m]]]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{+118}:\\
\;\;\;\;t_m\\

\mathbf{elif}\;y \leq -2.25 \cdot 10^{+66}:\\
\;\;\;\;t_m \cdot \frac{-y}{z}\\

\mathbf{elif}\;y \leq -370000000:\\
\;\;\;\;t_m\\

\mathbf{elif}\;y \leq 4 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \frac{t_m}{z}\\

\mathbf{else}:\\
\;\;\;\;t_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.00000000000000033e118 or -2.2499999999999999e66 < y < -3.7e8 or 4.00000000000000014e62 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 68.3%

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

    if -7.00000000000000033e118 < y < -2.2499999999999999e66

    1. Initial program 99.6%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 74.8%

      \[\leadsto \color{blue}{\frac{x - y}{z}} \cdot t \]
    4. Taylor expanded in x around 0 60.6%

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

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

        \[\leadsto \color{blue}{\frac{-y}{z}} \cdot t \]
    6. Simplified60.6%

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

    if -3.7e8 < y < 4.00000000000000014e62

    1. Initial program 92.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 61.4%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*59.9%

        \[\leadsto \color{blue}{\frac{t}{\frac{z}{x}}} \]
      2. associate-/r/61.8%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
    5. Simplified61.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+118}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{+66}:\\ \;\;\;\;t \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -370000000:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 74.9% accurate, 0.5× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{-47} \lor \neg \left(y \leq 6.2 \cdot 10^{+62}\right):\\ \;\;\;\;t_m \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t_m}{z - y}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (or (<= y -3.8e-47) (not (<= y 6.2e+62)))
    (* t_m (- 1.0 (/ x y)))
    (* x (/ t_m (- z y))))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((y <= -3.8e-47) || !(y <= 6.2e+62)) {
		tmp = t_m * (1.0 - (x / y));
	} else {
		tmp = x * (t_m / (z - y));
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((y <= (-3.8d-47)) .or. (.not. (y <= 6.2d+62))) then
        tmp = t_m * (1.0d0 - (x / y))
    else
        tmp = x * (t_m / (z - y))
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((y <= -3.8e-47) || !(y <= 6.2e+62)) {
		tmp = t_m * (1.0 - (x / y));
	} else {
		tmp = x * (t_m / (z - y));
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if (y <= -3.8e-47) or not (y <= 6.2e+62):
		tmp = t_m * (1.0 - (x / y))
	else:
		tmp = x * (t_m / (z - y))
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if ((y <= -3.8e-47) || !(y <= 6.2e+62))
		tmp = Float64(t_m * Float64(1.0 - Float64(x / y)));
	else
		tmp = Float64(x * Float64(t_m / Float64(z - y)));
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if ((y <= -3.8e-47) || ~((y <= 6.2e+62)))
		tmp = t_m * (1.0 - (x / y));
	else
		tmp = x * (t_m / (z - y));
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[y, -3.8e-47], N[Not[LessEqual[y, 6.2e+62]], $MachinePrecision]], N[(t$95$m * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$m / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-47} \lor \neg \left(y \leq 6.2 \cdot 10^{+62}\right):\\
\;\;\;\;t_m \cdot \left(1 - \frac{x}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t_m}{z - y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.80000000000000015e-47 or 6.20000000000000029e62 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 77.0%

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

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

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

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

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

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

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

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

    if -3.80000000000000015e-47 < y < 6.20000000000000029e62

    1. Initial program 92.2%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 73.6%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z - y}} \]
    4. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \frac{\color{blue}{x \cdot t}}{z - y} \]
      2. associate-*r/73.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{-47} \lor \neg \left(y \leq 6.2 \cdot 10^{+62}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 73.2% accurate, 0.5× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-61} \lor \neg \left(y \leq 5.7 \cdot 10^{+32}\right):\\ \;\;\;\;t_m \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t_m}{z}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (or (<= y -5.2e-61) (not (<= y 5.7e+32)))
    (* t_m (- 1.0 (/ x y)))
    (* (- x y) (/ t_m z)))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((y <= -5.2e-61) || !(y <= 5.7e+32)) {
		tmp = t_m * (1.0 - (x / y));
	} else {
		tmp = (x - y) * (t_m / z);
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((y <= (-5.2d-61)) .or. (.not. (y <= 5.7d+32))) then
        tmp = t_m * (1.0d0 - (x / y))
    else
        tmp = (x - y) * (t_m / z)
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((y <= -5.2e-61) || !(y <= 5.7e+32)) {
		tmp = t_m * (1.0 - (x / y));
	} else {
		tmp = (x - y) * (t_m / z);
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if (y <= -5.2e-61) or not (y <= 5.7e+32):
		tmp = t_m * (1.0 - (x / y))
	else:
		tmp = (x - y) * (t_m / z)
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if ((y <= -5.2e-61) || !(y <= 5.7e+32))
		tmp = Float64(t_m * Float64(1.0 - Float64(x / y)));
	else
		tmp = Float64(Float64(x - y) * Float64(t_m / z));
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if ((y <= -5.2e-61) || ~((y <= 5.7e+32)))
		tmp = t_m * (1.0 - (x / y));
	else
		tmp = (x - y) * (t_m / z);
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[y, -5.2e-61], N[Not[LessEqual[y, 5.7e+32]], $MachinePrecision]], N[(t$95$m * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t$95$m / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-61} \lor \neg \left(y \leq 5.7 \cdot 10^{+32}\right):\\
\;\;\;\;t_m \cdot \left(1 - \frac{x}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.20000000000000021e-61 or 5.7e32 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 75.8%

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

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

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

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

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

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

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

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

    if -5.20000000000000021e-61 < y < 5.7e32

    1. Initial program 91.7%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/r/95.4%

        \[\leadsto \color{blue}{\frac{x - y}{\frac{z - y}{t}}} \]
      2. div-inv95.4%

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

        \[\leadsto \color{blue}{\frac{\frac{x - y}{z - y}}{\frac{1}{t}}} \]
    4. Applied egg-rr91.6%

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

      \[\leadsto \color{blue}{\frac{t \cdot \left(x - y\right)}{z}} \]
    6. Step-by-step derivation
      1. associate-*l/81.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-61} \lor \neg \left(y \leq 5.7 \cdot 10^{+32}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 73.7% accurate, 0.5× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{-21} \lor \neg \left(z \leq 4.5 \cdot 10^{+36}\right):\\ \;\;\;\;t_m \cdot \frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;t_m \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (or (<= z -9.5e-21) (not (<= z 4.5e+36)))
    (* t_m (/ (- x y) z))
    (* t_m (- 1.0 (/ x y))))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((z <= -9.5e-21) || !(z <= 4.5e+36)) {
		tmp = t_m * ((x - y) / z);
	} else {
		tmp = t_m * (1.0 - (x / y));
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((z <= (-9.5d-21)) .or. (.not. (z <= 4.5d+36))) then
        tmp = t_m * ((x - y) / z)
    else
        tmp = t_m * (1.0d0 - (x / y))
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((z <= -9.5e-21) || !(z <= 4.5e+36)) {
		tmp = t_m * ((x - y) / z);
	} else {
		tmp = t_m * (1.0 - (x / y));
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if (z <= -9.5e-21) or not (z <= 4.5e+36):
		tmp = t_m * ((x - y) / z)
	else:
		tmp = t_m * (1.0 - (x / y))
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if ((z <= -9.5e-21) || !(z <= 4.5e+36))
		tmp = Float64(t_m * Float64(Float64(x - y) / z));
	else
		tmp = Float64(t_m * Float64(1.0 - Float64(x / y)));
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if ((z <= -9.5e-21) || ~((z <= 4.5e+36)))
		tmp = t_m * ((x - y) / z);
	else
		tmp = t_m * (1.0 - (x / y));
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[z, -9.5e-21], N[Not[LessEqual[z, 4.5e+36]], $MachinePrecision]], N[(t$95$m * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t$95$m * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-21} \lor \neg \left(z \leq 4.5 \cdot 10^{+36}\right):\\
\;\;\;\;t_m \cdot \frac{x - y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.4999999999999994e-21 or 4.49999999999999997e36 < z

    1. Initial program 94.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 81.3%

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

    if -9.4999999999999994e-21 < z < 4.49999999999999997e36

    1. Initial program 96.2%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 78.7%

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

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

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

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

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

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

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

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

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

Alternative 7: 73.7% accurate, 0.5× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{-21} \lor \neg \left(z \leq 7.5 \cdot 10^{+37}\right):\\ \;\;\;\;t_m \cdot \frac{x - y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_m}{\frac{y}{y - x}}\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (*
  t_s
  (if (or (<= z -3.2e-21) (not (<= z 7.5e+37)))
    (* t_m (/ (- x y) z))
    (/ t_m (/ y (- y x))))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((z <= -3.2e-21) || !(z <= 7.5e+37)) {
		tmp = t_m * ((x - y) / z);
	} else {
		tmp = t_m / (y / (y - x));
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if ((z <= (-3.2d-21)) .or. (.not. (z <= 7.5d+37))) then
        tmp = t_m * ((x - y) / z)
    else
        tmp = t_m / (y / (y - x))
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if ((z <= -3.2e-21) || !(z <= 7.5e+37)) {
		tmp = t_m * ((x - y) / z);
	} else {
		tmp = t_m / (y / (y - x));
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if (z <= -3.2e-21) or not (z <= 7.5e+37):
		tmp = t_m * ((x - y) / z)
	else:
		tmp = t_m / (y / (y - x))
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if ((z <= -3.2e-21) || !(z <= 7.5e+37))
		tmp = Float64(t_m * Float64(Float64(x - y) / z));
	else
		tmp = Float64(t_m / Float64(y / Float64(y - x)));
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if ((z <= -3.2e-21) || ~((z <= 7.5e+37)))
		tmp = t_m * ((x - y) / z);
	else
		tmp = t_m / (y / (y - x));
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[Or[LessEqual[z, -3.2e-21], N[Not[LessEqual[z, 7.5e+37]], $MachinePrecision]], N[(t$95$m * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(t$95$m / N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-21} \lor \neg \left(z \leq 7.5 \cdot 10^{+37}\right):\\
\;\;\;\;t_m \cdot \frac{x - y}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_m}{\frac{y}{y - x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.2000000000000002e-21 or 7.5000000000000003e37 < z

    1. Initial program 94.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 81.3%

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

    if -3.2000000000000002e-21 < z < 7.5000000000000003e37

    1. Initial program 96.2%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 78.7%

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

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

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

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

      \[\leadsto \color{blue}{\frac{t \cdot \left(y - x\right)}{y}} \]
    7. Step-by-step derivation
      1. associate-/l*78.7%

        \[\leadsto \color{blue}{\frac{t}{\frac{y}{y - x}}} \]
    8. Simplified78.7%

      \[\leadsto \color{blue}{\frac{t}{\frac{y}{y - x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.1%

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

Alternative 8: 61.1% accurate, 0.6× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -2050000000:\\ \;\;\;\;t_m\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \frac{t_m}{z}\\ \mathbf{else}:\\ \;\;\;\;t_m\\ \end{array} \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (* t_s (if (<= y -2050000000.0) t_m (if (<= y 4.8e+62) (* x (/ t_m z)) t_m))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (y <= -2050000000.0) {
		tmp = t_m;
	} else if (y <= 4.8e+62) {
		tmp = x * (t_m / z);
	} else {
		tmp = t_m;
	}
	return t_s * tmp;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    real(8) :: tmp
    if (y <= (-2050000000.0d0)) then
        tmp = t_m
    else if (y <= 4.8d+62) then
        tmp = x * (t_m / z)
    else
        tmp = t_m
    end if
    code = t_s * tmp
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	double tmp;
	if (y <= -2050000000.0) {
		tmp = t_m;
	} else if (y <= 4.8e+62) {
		tmp = x * (t_m / z);
	} else {
		tmp = t_m;
	}
	return t_s * tmp;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	tmp = 0
	if y <= -2050000000.0:
		tmp = t_m
	elif y <= 4.8e+62:
		tmp = x * (t_m / z)
	else:
		tmp = t_m
	return t_s * tmp
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	tmp = 0.0
	if (y <= -2050000000.0)
		tmp = t_m;
	elseif (y <= 4.8e+62)
		tmp = Float64(x * Float64(t_m / z));
	else
		tmp = t_m;
	end
	return Float64(t_s * tmp)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp_2 = code(t_s, x, y, z, t_m)
	tmp = 0.0;
	if (y <= -2050000000.0)
		tmp = t_m;
	elseif (y <= 4.8e+62)
		tmp = x * (t_m / z);
	else
		tmp = t_m;
	end
	tmp_2 = t_s * tmp;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * If[LessEqual[y, -2050000000.0], t$95$m, If[LessEqual[y, 4.8e+62], N[(x * N[(t$95$m / z), $MachinePrecision]), $MachinePrecision], t$95$m]]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2050000000:\\
\;\;\;\;t_m\\

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \frac{t_m}{z}\\

\mathbf{else}:\\
\;\;\;\;t_m\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.05e9 or 4.8e62 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 63.0%

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

    if -2.05e9 < y < 4.8e62

    1. Initial program 92.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0 61.4%

      \[\leadsto \color{blue}{\frac{t \cdot x}{z}} \]
    4. Step-by-step derivation
      1. associate-/l*59.9%

        \[\leadsto \color{blue}{\frac{t}{\frac{z}{x}}} \]
      2. associate-/r/61.8%

        \[\leadsto \color{blue}{\frac{t}{z} \cdot x} \]
    5. Simplified61.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2050000000:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+62}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 97.1% accurate, 1.0× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot \left(t_m \cdot \frac{x - y}{z - y}\right) \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m)
 :precision binary64
 (* t_s (* t_m (/ (- x y) (- z y)))))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	return t_s * (t_m * ((x - y) / (z - y)));
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    code = t_s * (t_m * ((x - y) / (z - y)))
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	return t_s * (t_m * ((x - y) / (z - y)));
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	return t_s * (t_m * ((x - y) / (z - y)))
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	return Float64(t_s * Float64(t_m * Float64(Float64(x - y) / Float64(z - y))))
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, x, y, z, t_m)
	tmp = t_s * (t_m * ((x - y) / (z - y)));
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * N[(t$95$m * N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot \left(t_m \cdot \frac{x - y}{z - y}\right)
\end{array}
Derivation
  1. Initial program 95.5%

    \[\frac{x - y}{z - y} \cdot t \]
  2. Add Preprocessing
  3. Final simplification95.5%

    \[\leadsto t \cdot \frac{x - y}{z - y} \]
  4. Add Preprocessing

Alternative 10: 35.7% accurate, 9.0× speedup?

\[\begin{array}{l} t_m = \left|t\right| \\ t_s = \mathsf{copysign}\left(1, t\right) \\ t_s \cdot t_m \end{array} \]
t_m = (fabs.f64 t)
t_s = (copysign.f64 1 t)
(FPCore (t_s x y z t_m) :precision binary64 (* t_s t_m))
t_m = fabs(t);
t_s = copysign(1.0, t);
double code(double t_s, double x, double y, double z, double t_m) {
	return t_s * t_m;
}
t_m = abs(t)
t_s = copysign(1.0d0, t)
real(8) function code(t_s, x, y, z, t_m)
    real(8), intent (in) :: t_s
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t_m
    code = t_s * t_m
end function
t_m = Math.abs(t);
t_s = Math.copySign(1.0, t);
public static double code(double t_s, double x, double y, double z, double t_m) {
	return t_s * t_m;
}
t_m = math.fabs(t)
t_s = math.copysign(1.0, t)
def code(t_s, x, y, z, t_m):
	return t_s * t_m
t_m = abs(t)
t_s = copysign(1.0, t)
function code(t_s, x, y, z, t_m)
	return Float64(t_s * t_m)
end
t_m = abs(t);
t_s = sign(t) * abs(1.0);
function tmp = code(t_s, x, y, z, t_m)
	tmp = t_s * t_m;
end
t_m = N[Abs[t], $MachinePrecision]
t_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[t$95$s_, x_, y_, z_, t$95$m_] := N[(t$95$s * t$95$m), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
t_s = \mathsf{copysign}\left(1, t\right)

\\
t_s \cdot t_m
\end{array}
Derivation
  1. Initial program 95.5%

    \[\frac{x - y}{z - y} \cdot t \]
  2. Add Preprocessing
  3. Taylor expanded in y around inf 31.7%

    \[\leadsto \color{blue}{t} \]
  4. Final simplification31.7%

    \[\leadsto t \]
  5. Add Preprocessing

Developer target: 97.1% accurate, 1.0× speedup?

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

\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}

Reproduce

?
herbie shell --seed 2024020 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (/ t (/ (- z y) (- x y)))

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