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

Percentage Accurate: 97.9% → 94.0%
Time: 8.4s
Alternatives: 11
Speedup: 1.0×

Specification

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

\\
\frac{x}{y} \cdot \left(z - t\right) + 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 11 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 94.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{+28}\right):\\
\;\;\;\;x \cdot \frac{z - t}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5 or 3.99999999999999983e28 < (/.f64 x y)

    1. Initial program 95.2%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative95.2%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z - t}{y}} \]
      2. *-commutative98.0%

        \[\leadsto \color{blue}{\frac{z - t}{y} \cdot x} \]
    8. Applied egg-rr98.0%

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

    if -5 < (/.f64 x y) < 3.99999999999999983e28

    1. Initial program 98.4%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 91.4%

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

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

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

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

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

Alternative 2: 63.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \frac{x}{y}\\ t_2 := x \cdot \frac{t}{-y}\\ t_3 := -t \cdot \frac{x}{y}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+295}:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+66}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+22}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-82}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{+118}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+187}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+289}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (/ x y))) (t_2 (* x (/ t (- y)))) (t_3 (- (* t (/ x y)))))
   (if (<= (/ x y) -1e+295)
     t_3
     (if (<= (/ x y) -1e+66)
       t_1
       (if (<= (/ x y) -5e+22)
         t_2
         (if (<= (/ x y) -5e-82)
           t_1
           (if (<= (/ x y) 5e-124)
             t
             (if (<= (/ x y) 4e-95)
               t_1
               (if (<= (/ x y) 2e-21)
                 t
                 (if (<= (/ x y) 1e+118)
                   t_1
                   (if (<= (/ x y) 2e+187)
                     t_2
                     (if (<= (/ x y) 5e+289) (* x (/ z y)) t_3))))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x / y);
	double t_2 = x * (t / -y);
	double t_3 = -(t * (x / y));
	double tmp;
	if ((x / y) <= -1e+295) {
		tmp = t_3;
	} else if ((x / y) <= -1e+66) {
		tmp = t_1;
	} else if ((x / y) <= -5e+22) {
		tmp = t_2;
	} else if ((x / y) <= -5e-82) {
		tmp = t_1;
	} else if ((x / y) <= 5e-124) {
		tmp = t;
	} else if ((x / y) <= 4e-95) {
		tmp = t_1;
	} else if ((x / y) <= 2e-21) {
		tmp = t;
	} else if ((x / y) <= 1e+118) {
		tmp = t_1;
	} else if ((x / y) <= 2e+187) {
		tmp = t_2;
	} else if ((x / y) <= 5e+289) {
		tmp = x * (z / y);
	} else {
		tmp = t_3;
	}
	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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_1 = z * (x / y)
    t_2 = x * (t / -y)
    t_3 = -(t * (x / y))
    if ((x / y) <= (-1d+295)) then
        tmp = t_3
    else if ((x / y) <= (-1d+66)) then
        tmp = t_1
    else if ((x / y) <= (-5d+22)) then
        tmp = t_2
    else if ((x / y) <= (-5d-82)) then
        tmp = t_1
    else if ((x / y) <= 5d-124) then
        tmp = t
    else if ((x / y) <= 4d-95) then
        tmp = t_1
    else if ((x / y) <= 2d-21) then
        tmp = t
    else if ((x / y) <= 1d+118) then
        tmp = t_1
    else if ((x / y) <= 2d+187) then
        tmp = t_2
    else if ((x / y) <= 5d+289) then
        tmp = x * (z / y)
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * (x / y);
	double t_2 = x * (t / -y);
	double t_3 = -(t * (x / y));
	double tmp;
	if ((x / y) <= -1e+295) {
		tmp = t_3;
	} else if ((x / y) <= -1e+66) {
		tmp = t_1;
	} else if ((x / y) <= -5e+22) {
		tmp = t_2;
	} else if ((x / y) <= -5e-82) {
		tmp = t_1;
	} else if ((x / y) <= 5e-124) {
		tmp = t;
	} else if ((x / y) <= 4e-95) {
		tmp = t_1;
	} else if ((x / y) <= 2e-21) {
		tmp = t;
	} else if ((x / y) <= 1e+118) {
		tmp = t_1;
	} else if ((x / y) <= 2e+187) {
		tmp = t_2;
	} else if ((x / y) <= 5e+289) {
		tmp = x * (z / y);
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * (x / y)
	t_2 = x * (t / -y)
	t_3 = -(t * (x / y))
	tmp = 0
	if (x / y) <= -1e+295:
		tmp = t_3
	elif (x / y) <= -1e+66:
		tmp = t_1
	elif (x / y) <= -5e+22:
		tmp = t_2
	elif (x / y) <= -5e-82:
		tmp = t_1
	elif (x / y) <= 5e-124:
		tmp = t
	elif (x / y) <= 4e-95:
		tmp = t_1
	elif (x / y) <= 2e-21:
		tmp = t
	elif (x / y) <= 1e+118:
		tmp = t_1
	elif (x / y) <= 2e+187:
		tmp = t_2
	elif (x / y) <= 5e+289:
		tmp = x * (z / y)
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x / y))
	t_2 = Float64(x * Float64(t / Float64(-y)))
	t_3 = Float64(-Float64(t * Float64(x / y)))
	tmp = 0.0
	if (Float64(x / y) <= -1e+295)
		tmp = t_3;
	elseif (Float64(x / y) <= -1e+66)
		tmp = t_1;
	elseif (Float64(x / y) <= -5e+22)
		tmp = t_2;
	elseif (Float64(x / y) <= -5e-82)
		tmp = t_1;
	elseif (Float64(x / y) <= 5e-124)
		tmp = t;
	elseif (Float64(x / y) <= 4e-95)
		tmp = t_1;
	elseif (Float64(x / y) <= 2e-21)
		tmp = t;
	elseif (Float64(x / y) <= 1e+118)
		tmp = t_1;
	elseif (Float64(x / y) <= 2e+187)
		tmp = t_2;
	elseif (Float64(x / y) <= 5e+289)
		tmp = Float64(x * Float64(z / y));
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * (x / y);
	t_2 = x * (t / -y);
	t_3 = -(t * (x / y));
	tmp = 0.0;
	if ((x / y) <= -1e+295)
		tmp = t_3;
	elseif ((x / y) <= -1e+66)
		tmp = t_1;
	elseif ((x / y) <= -5e+22)
		tmp = t_2;
	elseif ((x / y) <= -5e-82)
		tmp = t_1;
	elseif ((x / y) <= 5e-124)
		tmp = t;
	elseif ((x / y) <= 4e-95)
		tmp = t_1;
	elseif ((x / y) <= 2e-21)
		tmp = t;
	elseif ((x / y) <= 1e+118)
		tmp = t_1;
	elseif ((x / y) <= 2e+187)
		tmp = t_2;
	elseif ((x / y) <= 5e+289)
		tmp = x * (z / y);
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(t / (-y)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = (-N[(t * N[(x / y), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[N[(x / y), $MachinePrecision], -1e+295], t$95$3, If[LessEqual[N[(x / y), $MachinePrecision], -1e+66], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -5e+22], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -5e-82], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5e-124], t, If[LessEqual[N[(x / y), $MachinePrecision], 4e-95], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2e-21], t, If[LessEqual[N[(x / y), $MachinePrecision], 1e+118], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 2e+187], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 5e+289], N[(x * N[(z / y), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := z \cdot \frac{x}{y}\\
t_2 := x \cdot \frac{t}{-y}\\
t_3 := -t \cdot \frac{x}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+295}:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+22}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 10^{+118}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+187}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+289}:\\
\;\;\;\;x \cdot \frac{z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if (/.f64 x y) < -9.9999999999999998e294 or 5.00000000000000031e289 < (/.f64 x y)

    1. Initial program 86.2%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative86.2%

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

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr87.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{y}} + t \]
    6. Step-by-step derivation
      1. mul-1-neg65.0%

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

        \[\leadsto \left(-\color{blue}{\frac{t}{y} \cdot x}\right) + t \]
      3. distribute-rgt-neg-in65.0%

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

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

        \[\leadsto \color{blue}{t + \frac{t}{y} \cdot \left(-x\right)} \]
      2. distribute-rgt-neg-out65.0%

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

        \[\leadsto \color{blue}{t - \frac{t}{y} \cdot x} \]
      4. *-commutative65.0%

        \[\leadsto t - \color{blue}{x \cdot \frac{t}{y}} \]
    9. Applied egg-rr65.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{y}} \]
    11. Step-by-step derivation
      1. mul-1-neg65.0%

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

        \[\leadsto -\color{blue}{\frac{t}{y} \cdot x} \]
      3. distribute-rgt-neg-in65.0%

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

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

        \[\leadsto \color{blue}{t \cdot \frac{-x}{y}} \]
    12. Simplified71.6%

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

    if -9.9999999999999998e294 < (/.f64 x y) < -9.99999999999999945e65 or -4.9999999999999996e22 < (/.f64 x y) < -4.9999999999999998e-82 or 5.0000000000000003e-124 < (/.f64 x y) < 3.99999999999999996e-95 or 1.99999999999999982e-21 < (/.f64 x y) < 9.99999999999999967e117

    1. Initial program 99.8%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative67.6%

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    9. Simplified67.6%

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

    if -9.99999999999999945e65 < (/.f64 x y) < -4.9999999999999996e22 or 9.99999999999999967e117 < (/.f64 x y) < 1.99999999999999981e187

    1. Initial program 99.8%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num99.8%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr99.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{y}} + t \]
    6. Step-by-step derivation
      1. mul-1-neg65.2%

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

        \[\leadsto \left(-\color{blue}{\frac{t}{y} \cdot x}\right) + t \]
      3. distribute-rgt-neg-in76.1%

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

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

        \[\leadsto \color{blue}{t + \frac{t}{y} \cdot \left(-x\right)} \]
      2. distribute-rgt-neg-out76.1%

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

        \[\leadsto \color{blue}{t - \frac{t}{y} \cdot x} \]
      4. *-commutative76.1%

        \[\leadsto t - \color{blue}{x \cdot \frac{t}{y}} \]
    9. Applied egg-rr76.1%

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

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

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

        \[\leadsto -\color{blue}{\frac{t}{y} \cdot x} \]
      3. distribute-rgt-neg-in76.1%

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

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

    if -4.9999999999999998e-82 < (/.f64 x y) < 5.0000000000000003e-124 or 3.99999999999999996e-95 < (/.f64 x y) < 1.99999999999999982e-21

    1. Initial program 98.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 82.7%

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

    if 1.99999999999999981e187 < (/.f64 x y) < 5.00000000000000031e289

    1. Initial program 100.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num99.9%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr99.8%

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{y}} \]
    9. Simplified87.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+295}:\\ \;\;\;\;-t \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+66}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+22}:\\ \;\;\;\;x \cdot \frac{t}{-y}\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-82}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{+118}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+187}:\\ \;\;\;\;x \cdot \frac{t}{-y}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+289}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;-t \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 63.8% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_1 := z \cdot \frac{x}{y}\\
t_2 := -t \cdot \frac{x}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+295}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+22}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+289}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -9.9999999999999998e294 or -9.99999999999999945e65 < (/.f64 x y) < -4.9999999999999996e22 or 5.00000000000000031e289 < (/.f64 x y)

    1. Initial program 88.7%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative88.7%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num88.7%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr89.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{y}} + t \]
    6. Step-by-step derivation
      1. mul-1-neg65.5%

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

        \[\leadsto \left(-\color{blue}{\frac{t}{y} \cdot x}\right) + t \]
      3. distribute-rgt-neg-in66.0%

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

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

        \[\leadsto \color{blue}{t + \frac{t}{y} \cdot \left(-x\right)} \]
      2. distribute-rgt-neg-out66.0%

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

        \[\leadsto \color{blue}{t - \frac{t}{y} \cdot x} \]
      4. *-commutative66.0%

        \[\leadsto t - \color{blue}{x \cdot \frac{t}{y}} \]
    9. Applied egg-rr66.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{t \cdot x}{y}} \]
    11. Step-by-step derivation
      1. mul-1-neg65.5%

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

        \[\leadsto -\color{blue}{\frac{t}{y} \cdot x} \]
      3. distribute-rgt-neg-in66.0%

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

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

        \[\leadsto \color{blue}{t \cdot \frac{-x}{y}} \]
    12. Simplified71.4%

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

    if -9.9999999999999998e294 < (/.f64 x y) < -9.99999999999999945e65 or -4.9999999999999996e22 < (/.f64 x y) < -4.9999999999999998e-82 or 5.0000000000000003e-124 < (/.f64 x y) < 3.99999999999999996e-95 or 1.99999999999999982e-21 < (/.f64 x y) < 5.00000000000000031e289

    1. Initial program 99.8%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.8%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num99.7%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr99.7%

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    9. Simplified67.8%

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

    if -4.9999999999999998e-82 < (/.f64 x y) < 5.0000000000000003e-124 or 3.99999999999999996e-95 < (/.f64 x y) < 1.99999999999999982e-21

    1. Initial program 98.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 82.7%

      \[\leadsto \color{blue}{t} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+295}:\\ \;\;\;\;-t \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+66}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+22}:\\ \;\;\;\;-t \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{-82}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+289}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;-t \cdot \frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.9% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
t_2 := x \cdot \frac{z - t}{y}\\
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-23}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\
\;\;\;\;z \cdot \frac{x}{y}\\

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -9.9999999999999996e-24 or 1.99999999999999982e-21 < (/.f64 x y)

    1. Initial program 95.8%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative95.8%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num95.7%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr96.0%

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

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

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

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

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

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

    if -9.9999999999999996e-24 < (/.f64 x y) < 5.0000000000000003e-124 or 3.99999999999999996e-95 < (/.f64 x y) < 1.99999999999999982e-21

    1. Initial program 98.2%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 73.9%

      \[\leadsto \color{blue}{t + -1 \cdot \frac{t \cdot x}{y}} \]
    4. Step-by-step derivation
      1. mul-1-neg73.9%

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

        \[\leadsto \color{blue}{t - \frac{t \cdot x}{y}} \]
      3. *-rgt-identity73.9%

        \[\leadsto \color{blue}{t \cdot 1} - \frac{t \cdot x}{y} \]
      4. associate-/l*77.3%

        \[\leadsto t \cdot 1 - \color{blue}{t \cdot \frac{x}{y}} \]
      5. distribute-lft-out--77.3%

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

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

    if 5.0000000000000003e-124 < (/.f64 x y) < 3.99999999999999996e-95

    1. Initial program 100.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative100.0%

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

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr100.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative99.1%

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    9. Simplified99.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-23}:\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-124}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-95}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-21}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 63.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-82} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-124}\right) \land \left(\frac{x}{y} \leq 4 \cdot 10^{-95} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-21}\right)\right):\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (/ x y) -5e-82)
         (and (not (<= (/ x y) 5e-124))
              (or (<= (/ x y) 4e-95) (not (<= (/ x y) 2e-21)))))
   (* z (/ x y))
   t))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -5e-82) || (!((x / y) <= 5e-124) && (((x / y) <= 4e-95) || !((x / y) <= 2e-21)))) {
		tmp = z * (x / 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 (((x / y) <= (-5d-82)) .or. (.not. ((x / y) <= 5d-124)) .and. ((x / y) <= 4d-95) .or. (.not. ((x / y) <= 2d-21))) then
        tmp = z * (x / 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 (((x / y) <= -5e-82) || (!((x / y) <= 5e-124) && (((x / y) <= 4e-95) || !((x / y) <= 2e-21)))) {
		tmp = z * (x / y);
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -5e-82) or (not ((x / y) <= 5e-124) and (((x / y) <= 4e-95) or not ((x / y) <= 2e-21))):
		tmp = z * (x / y)
	else:
		tmp = t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(x / y) <= -5e-82) || (!(Float64(x / y) <= 5e-124) && ((Float64(x / y) <= 4e-95) || !(Float64(x / y) <= 2e-21))))
		tmp = Float64(z * Float64(x / y));
	else
		tmp = t;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((x / y) <= -5e-82) || (~(((x / y) <= 5e-124)) && (((x / y) <= 4e-95) || ~(((x / y) <= 2e-21)))))
		tmp = z * (x / y);
	else
		tmp = t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e-82], And[N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-124]], $MachinePrecision], Or[LessEqual[N[(x / y), $MachinePrecision], 4e-95], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-21]], $MachinePrecision]]]], N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision], t]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-82} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-124}\right) \land \left(\frac{x}{y} \leq 4 \cdot 10^{-95} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-21}\right)\right):\\
\;\;\;\;z \cdot \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -4.9999999999999998e-82 or 5.0000000000000003e-124 < (/.f64 x y) < 3.99999999999999996e-95 or 1.99999999999999982e-21 < (/.f64 x y)

    1. Initial program 96.3%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative96.3%

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

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr96.5%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative58.6%

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    9. Simplified58.6%

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

    if -4.9999999999999998e-82 < (/.f64 x y) < 5.0000000000000003e-124 or 3.99999999999999996e-95 < (/.f64 x y) < 1.99999999999999982e-21

    1. Initial program 98.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 82.7%

      \[\leadsto \color{blue}{t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.9%

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

Alternative 6: 92.3% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5 or 1.99999999999999982e-21 < (/.f64 x y)

    1. Initial program 95.7%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative95.7%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num95.7%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
    4. Applied egg-rr96.0%

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

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

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

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

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

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

    if -5 < (/.f64 x y) < 1.99999999999999982e-21

    1. Initial program 98.3%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf 95.1%

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

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

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

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

Alternative 7: 74.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+23} \lor \neg \left(z \leq 1.3 \cdot 10^{+149}\right):\\
\;\;\;\;z \cdot \frac{x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -8.5000000000000001e23 or 1.29999999999999989e149 < z

    1. Initial program 97.9%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative97.9%

        \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
      2. clear-num97.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot z} \]
      2. *-commutative72.2%

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

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

    if -8.5000000000000001e23 < z < 1.29999999999999989e149

    1. Initial program 96.3%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 72.4%

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

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

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

        \[\leadsto \color{blue}{t \cdot 1} - \frac{t \cdot x}{y} \]
      4. associate-/l*76.7%

        \[\leadsto t \cdot 1 - \color{blue}{t \cdot \frac{x}{y}} \]
      5. distribute-lft-out--76.7%

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

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

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

Alternative 8: 52.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -430000 \lor \neg \left(x \leq 1.5 \cdot 10^{-162}\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.3e5 or 1.49999999999999999e-162 < x

    1. Initial program 96.4%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative96.4%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z}{y}} \]
    9. Simplified50.2%

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

    if -4.3e5 < x < 1.49999999999999999e-162

    1. Initial program 97.9%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 69.0%

      \[\leadsto \color{blue}{t} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.0%

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

Alternative 9: 98.0% accurate, 1.0× speedup?

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

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

    \[\frac{x}{y} \cdot \left(z - t\right) + t \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative96.9%

      \[\leadsto \color{blue}{\left(z - t\right) \cdot \frac{x}{y}} + t \]
    2. clear-num96.9%

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

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

    \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
  5. Final simplification97.1%

    \[\leadsto t + \frac{z - t}{\frac{y}{x}} \]
  6. Add Preprocessing

Alternative 10: 97.9% accurate, 1.0× speedup?

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

\\
t + \left(z - t\right) \cdot \frac{x}{y}
\end{array}
Derivation
  1. Initial program 96.9%

    \[\frac{x}{y} \cdot \left(z - t\right) + t \]
  2. Add Preprocessing
  3. Final simplification96.9%

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

Alternative 11: 39.0% 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.9%

    \[\frac{x}{y} \cdot \left(z - t\right) + t \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 35.8%

    \[\leadsto \color{blue}{t} \]
  4. Final simplification35.8%

    \[\leadsto t \]
  5. Add Preprocessing

Developer target: 97.5% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(z - t\right) + t\\
\mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \frac{z - t}{y} + t\\

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

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