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

Percentage Accurate: 97.0% → 97.8%
Time: 11.0s
Alternatives: 12
Speedup: 0.4×

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: 97.0% 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: 97.8% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 x y) (-.f64 z y)) < -4.00000000000000006e240

    1. Initial program 60.7%

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

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

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

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

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

    if -4.00000000000000006e240 < (/.f64 (-.f64 x y) (-.f64 z y))

    1. Initial program 97.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub97.8%

        \[\leadsto \color{blue}{\left(\frac{x}{z - y} - \frac{y}{z - y}\right)} \cdot t \]
    4. Applied egg-rr97.8%

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

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

Alternative 2: 61.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -850000000:\\
\;\;\;\;\frac{x}{\frac{-y}{t}}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.5000000000000006e78 or 4.6999999999999999e38 < y

    1. Initial program 99.8%

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

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

    if -9.5000000000000006e78 < y < -8.5e8

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{y}} \]
    7. Step-by-step derivation
      1. mul-1-neg68.8%

        \[\leadsto \color{blue}{-\frac{t \cdot x}{y}} \]
      2. *-commutative68.8%

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

        \[\leadsto -\color{blue}{x \cdot \frac{t}{y}} \]
      4. distribute-rgt-neg-in68.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x \cdot t}{-y}} \]
    10. Applied egg-rr68.8%

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

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

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

    if -8.5e8 < y < 4.6999999999999999e38

    1. Initial program 93.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+78}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -850000000:\\ \;\;\;\;\frac{x}{\frac{-y}{t}}\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{+38}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+240}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 x y) (-.f64 z y)) < -4.00000000000000006e240

    1. Initial program 60.7%

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

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

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

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

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

    if -4.00000000000000006e240 < (/.f64 (-.f64 x y) (-.f64 z y))

    1. Initial program 97.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification97.9%

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

Alternative 4: 75.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+46} \lor \neg \left(y \leq 1.45 \cdot 10^{+37}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.50000000000000008e46 or 1.44999999999999989e37 < y

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto \color{blue}{\left(\frac{x}{z - y} - \frac{y}{z - y}\right)} \cdot t \]
    4. Applied egg-rr99.9%

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

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

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

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

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

    if -6.50000000000000008e46 < y < 1.44999999999999989e37

    1. Initial program 93.8%

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

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

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

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

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

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

Alternative 5: 75.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{+48} \lor \neg \left(y \leq 8.2 \cdot 10^{+37}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -8.2e+48) (not (<= y 8.2e+37)))
   (* t (- 1.0 (/ x y)))
   (* t (/ x (- z y)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -8.2e+48) || !(y <= 8.2e+37)) {
		tmp = t * (1.0 - (x / y));
	} else {
		tmp = t * (x / (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 <= (-8.2d+48)) .or. (.not. (y <= 8.2d+37))) then
        tmp = t * (1.0d0 - (x / y))
    else
        tmp = t * (x / (z - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if ((y <= -8.2e+48) || !(y <= 8.2e+37)) {
		tmp = t * (1.0 - (x / y));
	} else {
		tmp = t * (x / (z - y));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (y <= -8.2e+48) or not (y <= 8.2e+37):
		tmp = t * (1.0 - (x / y))
	else:
		tmp = t * (x / (z - y))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((y <= -8.2e+48) || !(y <= 8.2e+37))
		tmp = Float64(t * Float64(1.0 - Float64(x / y)));
	else
		tmp = Float64(t * Float64(x / Float64(z - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((y <= -8.2e+48) || ~((y <= 8.2e+37)))
		tmp = t * (1.0 - (x / y));
	else
		tmp = t * (x / (z - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.2e+48], N[Not[LessEqual[y, 8.2e+37]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+48} \lor \neg \left(y \leq 8.2 \cdot 10^{+37}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.2000000000000005e48 or 8.1999999999999996e37 < y

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto \color{blue}{\left(\frac{x}{z - y} - \frac{y}{z - y}\right)} \cdot t \]
    4. Applied egg-rr99.9%

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

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

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

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

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

    if -8.2000000000000005e48 < y < 8.1999999999999996e37

    1. Initial program 93.8%

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

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

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

Alternative 6: 68.7% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.75000000000000003e79 or 3.7000000000000001e38 < y

    1. Initial program 99.8%

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

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

    if -2.75000000000000003e79 < y < 3.7000000000000001e38

    1. Initial program 94.1%

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

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

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

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

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

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

Alternative 7: 75.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+49}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

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

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


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

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto \color{blue}{\left(\frac{x}{z - y} - \frac{y}{z - y}\right)} \cdot t \]
    4. Applied egg-rr99.9%

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

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

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

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

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

    if -2.15e49 < y < 3.19999999999999985e38

    1. Initial program 93.8%

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

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

    if 3.19999999999999985e38 < y

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z - y}} \]
    4. Step-by-step derivation
      1. mul-1-neg64.1%

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

        \[\leadsto -\color{blue}{\frac{t}{\frac{z - y}{y}}} \]
      3. distribute-neg-frac84.0%

        \[\leadsto \color{blue}{\frac{-t}{\frac{z - y}{y}}} \]
      4. div-sub84.0%

        \[\leadsto \frac{-t}{\color{blue}{\frac{z}{y} - \frac{y}{y}}} \]
      5. *-inverses84.0%

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

      \[\leadsto \color{blue}{\frac{-t}{\frac{z}{y} - 1}} \]
    6. Step-by-step derivation
      1. frac-2neg84.0%

        \[\leadsto \color{blue}{\frac{-\left(-t\right)}{-\left(\frac{z}{y} - 1\right)}} \]
      2. div-inv83.9%

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

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

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

        \[\leadsto t \cdot \frac{1}{-\left(\frac{z}{y} + \color{blue}{-1}\right)} \]
      6. distribute-neg-in83.9%

        \[\leadsto t \cdot \frac{1}{\color{blue}{\left(-\frac{z}{y}\right) + \left(--1\right)}} \]
      7. metadata-eval83.9%

        \[\leadsto t \cdot \frac{1}{\left(-\frac{z}{y}\right) + \color{blue}{1}} \]
    7. Applied egg-rr83.9%

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

        \[\leadsto \color{blue}{\frac{t \cdot 1}{\left(-\frac{z}{y}\right) + 1}} \]
      2. *-rgt-identity84.0%

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

        \[\leadsto \frac{t}{\color{blue}{1 + \left(-\frac{z}{y}\right)}} \]
      4. unsub-neg84.0%

        \[\leadsto \frac{t}{\color{blue}{1 - \frac{z}{y}}} \]
    9. Simplified84.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.15 \cdot 10^{+49}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+38}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 74.8% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+46}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

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

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


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

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto \color{blue}{\left(\frac{x}{z - y} - \frac{y}{z - y}\right)} \cdot t \]
    4. Applied egg-rr99.9%

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

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

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

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

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

    if -5.4999999999999998e46 < y < 3.90000000000000023e38

    1. Initial program 93.8%

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

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

    if 3.90000000000000023e38 < y

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z - y}} \]
    4. Step-by-step derivation
      1. mul-1-neg64.1%

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

        \[\leadsto -\color{blue}{\frac{t}{\frac{z - y}{y}}} \]
      3. distribute-neg-frac84.0%

        \[\leadsto \color{blue}{\frac{-t}{\frac{z - y}{y}}} \]
      4. div-sub84.0%

        \[\leadsto \frac{-t}{\color{blue}{\frac{z}{y} - \frac{y}{y}}} \]
      5. *-inverses84.0%

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

      \[\leadsto \color{blue}{\frac{-t}{\frac{z}{y} - 1}} \]
    6. Step-by-step derivation
      1. frac-2neg84.0%

        \[\leadsto \color{blue}{\frac{-\left(-t\right)}{-\left(\frac{z}{y} - 1\right)}} \]
      2. div-inv83.9%

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

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

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

        \[\leadsto t \cdot \frac{1}{-\left(\frac{z}{y} + \color{blue}{-1}\right)} \]
      6. distribute-neg-in83.9%

        \[\leadsto t \cdot \frac{1}{\color{blue}{\left(-\frac{z}{y}\right) + \left(--1\right)}} \]
      7. metadata-eval83.9%

        \[\leadsto t \cdot \frac{1}{\left(-\frac{z}{y}\right) + \color{blue}{1}} \]
    7. Applied egg-rr83.9%

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

        \[\leadsto \color{blue}{\frac{t \cdot 1}{\left(-\frac{z}{y}\right) + 1}} \]
      2. *-rgt-identity84.0%

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

        \[\leadsto \frac{t}{\color{blue}{1 + \left(-\frac{z}{y}\right)}} \]
      4. unsub-neg84.0%

        \[\leadsto \frac{t}{\color{blue}{1 - \frac{z}{y}}} \]
    9. Simplified84.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+46}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{+38}:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 38.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.4 \cdot 10^{-118}:\\
\;\;\;\;t\\

\mathbf{elif}\;y \leq 6.5 \cdot 10^{-142}:\\
\;\;\;\;t \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.39999999999999988e-118 or 6.50000000000000027e-142 < y

    1. Initial program 98.1%

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

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

    if -5.39999999999999988e-118 < y < 6.50000000000000027e-142

    1. Initial program 92.1%

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot y}{z}} \]
    5. Step-by-step derivation
      1. associate-*r/29.6%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(-t\right) \cdot y}{z}} \]
    7. Step-by-step derivation
      1. expm1-log1p-u27.1%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\left(-t\right) \cdot y}{z}\right)\right)} \]
      2. expm1-udef24.8%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{\left(-t\right) \cdot y}{z}\right)} - 1} \]
      3. associate-/l*24.8%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{\frac{-t}{\frac{z}{y}}}\right)} - 1 \]
      4. add-sqr-sqrt13.5%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{-t} \cdot \sqrt{-t}}}{\frac{z}{y}}\right)} - 1 \]
      5. sqrt-unprod24.7%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}}{\frac{z}{y}}\right)} - 1 \]
      6. sqr-neg24.7%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\sqrt{\color{blue}{t \cdot t}}}{\frac{z}{y}}\right)} - 1 \]
      7. sqrt-unprod11.3%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}{\frac{z}{y}}\right)} - 1 \]
      8. add-sqr-sqrt24.8%

        \[\leadsto e^{\mathsf{log1p}\left(\frac{\color{blue}{t}}{\frac{z}{y}}\right)} - 1 \]
    8. Applied egg-rr24.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\frac{t}{\frac{z}{y}}\right)} - 1} \]
    9. Step-by-step derivation
      1. expm1-def24.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{t}{\frac{z}{y}}\right)\right)} \]
      2. expm1-log1p25.0%

        \[\leadsto \color{blue}{\frac{t}{\frac{z}{y}}} \]
      3. associate-/l*25.0%

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

        \[\leadsto \color{blue}{t \cdot \frac{y}{z}} \]
    10. Simplified25.0%

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

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

Alternative 10: 60.2% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.0000000000000001e47 or 2.5500000000000001e38 < y

    1. Initial program 99.8%

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

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

    if -2.0000000000000001e47 < y < 2.5500000000000001e38

    1. Initial program 93.8%

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

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

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

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

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

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

Alternative 11: 61.5% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.3e48 or 1.95000000000000012e38 < y

    1. Initial program 99.8%

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

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

    if -2.3e48 < y < 1.95000000000000012e38

    1. Initial program 93.8%

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

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

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

Alternative 12: 35.1% 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 96.0%

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

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

    \[\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 2024021 
(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))