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

Percentage Accurate: 96.6% → 96.6%
Time: 9.1s
Alternatives: 12
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 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 96.6% 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, 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}
Derivation
  1. Initial program 97.4%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x - y}{z - y} \cdot t} \]
    3. *-commutative97.4%

      \[\leadsto \color{blue}{t \cdot \frac{x - y}{z - y}} \]
    4. clear-num97.2%

      \[\leadsto t \cdot \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \]
    5. un-div-inv97.6%

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

    \[\leadsto \color{blue}{\frac{t}{\frac{z - y}{x - y}}} \]
  7. Add Preprocessing

Alternative 2: 89.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+246} \lor \neg \left(y \leq 6.4 \cdot 10^{+125}\right):\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.15000000000000014e246 or 6.39999999999999967e125 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

        \[\leadsto t + -1 \cdot \color{blue}{\frac{t \cdot x - t \cdot z}{y}} \]
      4. mul-1-neg84.7%

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

        \[\leadsto \color{blue}{t - \frac{t \cdot x - t \cdot z}{y}} \]
      6. div-sub84.7%

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

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

        \[\leadsto t - \left(t \cdot \frac{x}{y} - \color{blue}{t \cdot \frac{z}{y}}\right) \]
      9. distribute-lft-out--96.3%

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

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

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

      \[\leadsto t - t \cdot \color{blue}{\frac{x}{y}} \]
    9. Step-by-step derivation
      1. clear-num96.2%

        \[\leadsto t - t \cdot \color{blue}{\frac{1}{\frac{y}{x}}} \]
      2. un-div-inv96.2%

        \[\leadsto t - \color{blue}{\frac{t}{\frac{y}{x}}} \]
    10. Applied egg-rr96.2%

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

    if -2.15000000000000014e246 < y < 6.39999999999999967e125

    1. Initial program 96.6%

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

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

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

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

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

Alternative 3: 75.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -36000000 \lor \neg \left(y \leq 1.35 \cdot 10^{-21}\right):\\
\;\;\;\;t \cdot \frac{y}{y - z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.6e7 or 1.3500000000000001e-21 < y

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{0 - \left(z - y\right)}} \cdot t \]
      4. sub-neg80.1%

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

        \[\leadsto \frac{y}{0 - \color{blue}{\left(\left(-y\right) + z\right)}} \cdot t \]
      6. associate--r+80.1%

        \[\leadsto \frac{y}{\color{blue}{\left(0 - \left(-y\right)\right) - z}} \cdot t \]
      7. neg-sub080.1%

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-y\right)\right)} - z} \cdot t \]
      8. remove-double-neg80.1%

        \[\leadsto \frac{y}{\color{blue}{y} - z} \cdot t \]
    5. Simplified80.1%

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

    if -3.6e7 < y < 1.3500000000000001e-21

    1. Initial program 94.8%

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

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

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

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

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

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

Alternative 4: 75.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+17}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{-22}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.9e17

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto t + -1 \cdot \color{blue}{\frac{t \cdot x - t \cdot z}{y}} \]
      4. mul-1-neg64.9%

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

        \[\leadsto \color{blue}{t - \frac{t \cdot x - t \cdot z}{y}} \]
      6. div-sub64.9%

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

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

        \[\leadsto t - \left(t \cdot \frac{x}{y} - \color{blue}{t \cdot \frac{z}{y}}\right) \]
      9. distribute-lft-out--79.6%

        \[\leadsto t - \color{blue}{t \cdot \left(\frac{x}{y} - \frac{z}{y}\right)} \]
      10. div-sub79.6%

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

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

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

    if -1.9e17 < y < 2.2000000000000001e-22

    1. Initial program 94.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x - y}{z - y} \cdot t} \]
      3. *-commutative94.8%

        \[\leadsto \color{blue}{t \cdot \frac{x - y}{z - y}} \]
      4. clear-num94.4%

        \[\leadsto t \cdot \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \]
      5. un-div-inv95.3%

        \[\leadsto \color{blue}{\frac{t}{\frac{z - y}{x - y}}} \]
    6. Applied egg-rr95.3%

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

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

    if 2.2000000000000001e-22 < y

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{0 - \left(z - y\right)}} \cdot t \]
      4. sub-neg85.2%

        \[\leadsto \frac{y}{0 - \color{blue}{\left(z + \left(-y\right)\right)}} \cdot t \]
      5. +-commutative85.2%

        \[\leadsto \frac{y}{0 - \color{blue}{\left(\left(-y\right) + z\right)}} \cdot t \]
      6. associate--r+85.2%

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

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-y\right)\right)} - z} \cdot t \]
      8. remove-double-neg85.2%

        \[\leadsto \frac{y}{\color{blue}{y} - z} \cdot t \]
    5. Simplified85.2%

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

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

Alternative 5: 75.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.6 \cdot 10^{+15}:\\
\;\;\;\;t - t \cdot \frac{x}{y}\\

\mathbf{elif}\;y \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -8.6e15

    1. Initial program 99.8%

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

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

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

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

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

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

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

        \[\leadsto t + -1 \cdot \color{blue}{\frac{t \cdot x - t \cdot z}{y}} \]
      4. mul-1-neg64.9%

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

        \[\leadsto \color{blue}{t - \frac{t \cdot x - t \cdot z}{y}} \]
      6. div-sub64.9%

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

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

        \[\leadsto t - \left(t \cdot \frac{x}{y} - \color{blue}{t \cdot \frac{z}{y}}\right) \]
      9. distribute-lft-out--79.6%

        \[\leadsto t - \color{blue}{t \cdot \left(\frac{x}{y} - \frac{z}{y}\right)} \]
      10. div-sub79.6%

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

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

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

    if -8.6e15 < y < 1.8e-25

    1. Initial program 94.8%

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

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

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

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

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

    if 1.8e-25 < y

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{0 - \left(z - y\right)}} \cdot t \]
      4. sub-neg85.2%

        \[\leadsto \frac{y}{0 - \color{blue}{\left(z + \left(-y\right)\right)}} \cdot t \]
      5. +-commutative85.2%

        \[\leadsto \frac{y}{0 - \color{blue}{\left(\left(-y\right) + z\right)}} \cdot t \]
      6. associate--r+85.2%

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

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-y\right)\right)} - z} \cdot t \]
      8. remove-double-neg85.2%

        \[\leadsto \frac{y}{\color{blue}{y} - z} \cdot t \]
    5. Simplified85.2%

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

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

Alternative 6: 75.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+17}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\

\mathbf{elif}\;y \leq 1.52 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.75e17

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \frac{\color{blue}{0 - \left(x - y\right)}}{y} \cdot t \]
      4. sub-neg80.2%

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

        \[\leadsto \frac{0 - \color{blue}{\left(\left(-y\right) + x\right)}}{y} \cdot t \]
      6. associate--r+80.2%

        \[\leadsto \frac{\color{blue}{\left(0 - \left(-y\right)\right) - x}}{y} \cdot t \]
      7. neg-sub080.2%

        \[\leadsto \frac{\color{blue}{\left(-\left(-y\right)\right)} - x}{y} \cdot t \]
      8. remove-double-neg80.2%

        \[\leadsto \frac{\color{blue}{y} - x}{y} \cdot t \]
    5. Simplified80.2%

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

    if -1.75e17 < y < 1.52000000000000006e-25

    1. Initial program 94.8%

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

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

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

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

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

    if 1.52000000000000006e-25 < y

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \frac{y}{\color{blue}{0 - \left(z - y\right)}} \cdot t \]
      4. sub-neg85.2%

        \[\leadsto \frac{y}{0 - \color{blue}{\left(z + \left(-y\right)\right)}} \cdot t \]
      5. +-commutative85.2%

        \[\leadsto \frac{y}{0 - \color{blue}{\left(\left(-y\right) + z\right)}} \cdot t \]
      6. associate--r+85.2%

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

        \[\leadsto \frac{y}{\color{blue}{\left(-\left(-y\right)\right)} - z} \cdot t \]
      8. remove-double-neg85.2%

        \[\leadsto \frac{y}{\color{blue}{y} - z} \cdot t \]
    5. Simplified85.2%

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

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

Alternative 7: 69.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{+43}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+57}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -3.3e+43) t (if (<= y 1.45e+57) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.3e+43) {
		tmp = t;
	} else if (y <= 1.45e+57) {
		tmp = x * (t / (z - y));
	} else {
		tmp = 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 (y <= (-3.3d+43)) then
        tmp = t
    else if (y <= 1.45d+57) then
        tmp = x * (t / (z - y))
    else
        tmp = t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -3.3e+43) {
		tmp = t;
	} else if (y <= 1.45e+57) {
		tmp = x * (t / (z - y));
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -3.3e+43:
		tmp = t
	elif y <= 1.45e+57:
		tmp = x * (t / (z - y))
	else:
		tmp = t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -3.3e+43)
		tmp = t;
	elseif (y <= 1.45e+57)
		tmp = Float64(x * Float64(t / Float64(z - y)));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -3.3e+43)
		tmp = t;
	elseif (y <= 1.45e+57)
		tmp = x * (t / (z - y));
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.3e+43], t, If[LessEqual[y, 1.45e+57], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{+43}:\\
\;\;\;\;t\\

\mathbf{elif}\;y \leq 1.45 \cdot 10^{+57}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.3000000000000001e43 or 1.4500000000000001e57 < y

    1. Initial program 99.9%

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

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

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

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

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

    if -3.3000000000000001e43 < y < 1.4500000000000001e57

    1. Initial program 95.5%

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

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

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

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

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

Alternative 8: 61.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -260:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{+58}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -260.0) t (if (<= y 1.3e+58) (/ t (/ z x)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -260.0) {
		tmp = t;
	} else if (y <= 1.3e+58) {
		tmp = t / (z / x);
	} else {
		tmp = 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 (y <= (-260.0d0)) then
        tmp = t
    else if (y <= 1.3d+58) then
        tmp = t / (z / x)
    else
        tmp = t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -260.0) {
		tmp = t;
	} else if (y <= 1.3e+58) {
		tmp = t / (z / x);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -260.0:
		tmp = t
	elif y <= 1.3e+58:
		tmp = t / (z / x)
	else:
		tmp = t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -260.0)
		tmp = t;
	elseif (y <= 1.3e+58)
		tmp = Float64(t / Float64(z / x));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -260.0)
		tmp = t;
	elseif (y <= 1.3e+58)
		tmp = t / (z / x);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -260.0], t, If[LessEqual[y, 1.3e+58], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -260:\\
\;\;\;\;t\\

\mathbf{elif}\;y \leq 1.3 \cdot 10^{+58}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -260 or 1.29999999999999994e58 < y

    1. Initial program 99.9%

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

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

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

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

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

    if -260 < y < 1.29999999999999994e58

    1. Initial program 95.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x - y}{z - y} \cdot t} \]
      3. *-commutative95.1%

        \[\leadsto \color{blue}{t \cdot \frac{x - y}{z - y}} \]
      4. clear-num94.7%

        \[\leadsto t \cdot \color{blue}{\frac{1}{\frac{z - y}{x - y}}} \]
      5. un-div-inv95.5%

        \[\leadsto \color{blue}{\frac{t}{\frac{z - y}{x - y}}} \]
    6. Applied egg-rr95.5%

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

      \[\leadsto \frac{t}{\color{blue}{\frac{z}{x}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 61.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2000:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 9.8 \cdot 10^{+55}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -2000.0) t (if (<= y 9.8e+55) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2000.0) {
		tmp = t;
	} else if (y <= 9.8e+55) {
		tmp = t * (x / z);
	} else {
		tmp = 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 (y <= (-2000.0d0)) then
        tmp = t
    else if (y <= 9.8d+55) then
        tmp = t * (x / z)
    else
        tmp = t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -2000.0) {
		tmp = t;
	} else if (y <= 9.8e+55) {
		tmp = t * (x / z);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -2000.0:
		tmp = t
	elif y <= 9.8e+55:
		tmp = t * (x / z)
	else:
		tmp = t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -2000.0)
		tmp = t;
	elseif (y <= 9.8e+55)
		tmp = Float64(t * Float64(x / z));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -2000.0)
		tmp = t;
	elseif (y <= 9.8e+55)
		tmp = t * (x / z);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -2000.0], t, If[LessEqual[y, 9.8e+55], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2000:\\
\;\;\;\;t\\

\mathbf{elif}\;y \leq 9.8 \cdot 10^{+55}:\\
\;\;\;\;t \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2e3 or 9.80000000000000029e55 < y

    1. Initial program 99.9%

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

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

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

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

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

    if -2e3 < y < 9.80000000000000029e55

    1. Initial program 95.1%

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

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

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

Alternative 10: 60.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.04:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+56}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= y -0.04) t (if (<= y 1.2e+56) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -0.04) {
		tmp = t;
	} else if (y <= 1.2e+56) {
		tmp = x * (t / z);
	} else {
		tmp = 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 (y <= (-0.04d0)) then
        tmp = t
    else if (y <= 1.2d+56) then
        tmp = x * (t / z)
    else
        tmp = t
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (y <= -0.04) {
		tmp = t;
	} else if (y <= 1.2e+56) {
		tmp = x * (t / z);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if y <= -0.04:
		tmp = t
	elif y <= 1.2e+56:
		tmp = x * (t / z)
	else:
		tmp = t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (y <= -0.04)
		tmp = t;
	elseif (y <= 1.2e+56)
		tmp = Float64(x * Float64(t / z));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (y <= -0.04)
		tmp = t;
	elseif (y <= 1.2e+56)
		tmp = x * (t / z);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[y, -0.04], t, If[LessEqual[y, 1.2e+56], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.04:\\
\;\;\;\;t\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+56}:\\
\;\;\;\;x \cdot \frac{t}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.0400000000000000008 or 1.20000000000000007e56 < y

    1. Initial program 99.9%

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

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

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

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

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

    if -0.0400000000000000008 < y < 1.20000000000000007e56

    1. Initial program 95.1%

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

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

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

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

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

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

Alternative 11: 96.6% accurate, 1.0× speedup?

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

\\
t \cdot \frac{x - y}{z - y}
\end{array}
Derivation
  1. Initial program 97.4%

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

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

Alternative 12: 35.2% accurate, 9.0× speedup?

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

\\
t
\end{array}
Derivation
  1. Initial program 97.4%

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

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

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

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

    \[\leadsto \color{blue}{t} \]
  6. Add Preprocessing

Developer Target 1: 96.6% 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 2024116 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
  :precision binary64

  :alt
  (! :herbie-platform default (/ t (/ (- z y) (- x y))))

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