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

Percentage Accurate: 97.8% → 98.3%
Time: 5.6s
Alternatives: 8
Speedup: 0.5×

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 8 alternatives:

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

Initial Program: 97.8% 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: 98.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 5.0000000000000003e299

    1. Initial program 98.4%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]

    if 5.0000000000000003e299 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t)

    1. Initial program 85.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Step-by-step derivation
      1. associate-*l/97.3%

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

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

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

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

Alternative 2: 62.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} \cdot z\\ t_2 := \frac{-t}{\frac{y}{x}}\\ \mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+151}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+124}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+26}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\frac{x}{y} \leq -20000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-84}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+64} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+191}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (/ x y) z)) (t_2 (/ (- t) (/ y x))))
   (if (<= (/ x y) -2e+151)
     t_1
     (if (<= (/ x y) -2e+124)
       t_2
       (if (<= (/ x y) -1e+51)
         t_1
         (if (<= (/ x y) -1e+26)
           t_2
           (if (<= (/ x y) -20000.0)
             t_1
             (if (<= (/ x y) -1e-93)
               t
               (if (<= (/ x y) -3e-177)
                 t_1
                 (if (<= (/ x y) 5e-84)
                   t
                   (if (or (<= (/ x y) 5e+64) (not (<= (/ x y) 2e+191)))
                     t_1
                     t_2)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) * z;
	double t_2 = -t / (y / x);
	double tmp;
	if ((x / y) <= -2e+151) {
		tmp = t_1;
	} else if ((x / y) <= -2e+124) {
		tmp = t_2;
	} else if ((x / y) <= -1e+51) {
		tmp = t_1;
	} else if ((x / y) <= -1e+26) {
		tmp = t_2;
	} else if ((x / y) <= -20000.0) {
		tmp = t_1;
	} else if ((x / y) <= -1e-93) {
		tmp = t;
	} else if ((x / y) <= -3e-177) {
		tmp = t_1;
	} else if ((x / y) <= 5e-84) {
		tmp = t;
	} else if (((x / y) <= 5e+64) || !((x / y) <= 2e+191)) {
		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 = (x / y) * z
    t_2 = -t / (y / x)
    if ((x / y) <= (-2d+151)) then
        tmp = t_1
    else if ((x / y) <= (-2d+124)) then
        tmp = t_2
    else if ((x / y) <= (-1d+51)) then
        tmp = t_1
    else if ((x / y) <= (-1d+26)) then
        tmp = t_2
    else if ((x / y) <= (-20000.0d0)) then
        tmp = t_1
    else if ((x / y) <= (-1d-93)) then
        tmp = t
    else if ((x / y) <= (-3d-177)) then
        tmp = t_1
    else if ((x / y) <= 5d-84) then
        tmp = t
    else if (((x / y) <= 5d+64) .or. (.not. ((x / y) <= 2d+191))) 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 = (x / y) * z;
	double t_2 = -t / (y / x);
	double tmp;
	if ((x / y) <= -2e+151) {
		tmp = t_1;
	} else if ((x / y) <= -2e+124) {
		tmp = t_2;
	} else if ((x / y) <= -1e+51) {
		tmp = t_1;
	} else if ((x / y) <= -1e+26) {
		tmp = t_2;
	} else if ((x / y) <= -20000.0) {
		tmp = t_1;
	} else if ((x / y) <= -1e-93) {
		tmp = t;
	} else if ((x / y) <= -3e-177) {
		tmp = t_1;
	} else if ((x / y) <= 5e-84) {
		tmp = t;
	} else if (((x / y) <= 5e+64) || !((x / y) <= 2e+191)) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) * z
	t_2 = -t / (y / x)
	tmp = 0
	if (x / y) <= -2e+151:
		tmp = t_1
	elif (x / y) <= -2e+124:
		tmp = t_2
	elif (x / y) <= -1e+51:
		tmp = t_1
	elif (x / y) <= -1e+26:
		tmp = t_2
	elif (x / y) <= -20000.0:
		tmp = t_1
	elif (x / y) <= -1e-93:
		tmp = t
	elif (x / y) <= -3e-177:
		tmp = t_1
	elif (x / y) <= 5e-84:
		tmp = t
	elif ((x / y) <= 5e+64) or not ((x / y) <= 2e+191):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) * z)
	t_2 = Float64(Float64(-t) / Float64(y / x))
	tmp = 0.0
	if (Float64(x / y) <= -2e+151)
		tmp = t_1;
	elseif (Float64(x / y) <= -2e+124)
		tmp = t_2;
	elseif (Float64(x / y) <= -1e+51)
		tmp = t_1;
	elseif (Float64(x / y) <= -1e+26)
		tmp = t_2;
	elseif (Float64(x / y) <= -20000.0)
		tmp = t_1;
	elseif (Float64(x / y) <= -1e-93)
		tmp = t;
	elseif (Float64(x / y) <= -3e-177)
		tmp = t_1;
	elseif (Float64(x / y) <= 5e-84)
		tmp = t;
	elseif ((Float64(x / y) <= 5e+64) || !(Float64(x / y) <= 2e+191))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) * z;
	t_2 = -t / (y / x);
	tmp = 0.0;
	if ((x / y) <= -2e+151)
		tmp = t_1;
	elseif ((x / y) <= -2e+124)
		tmp = t_2;
	elseif ((x / y) <= -1e+51)
		tmp = t_1;
	elseif ((x / y) <= -1e+26)
		tmp = t_2;
	elseif ((x / y) <= -20000.0)
		tmp = t_1;
	elseif ((x / y) <= -1e-93)
		tmp = t;
	elseif ((x / y) <= -3e-177)
		tmp = t_1;
	elseif ((x / y) <= 5e-84)
		tmp = t;
	elseif (((x / y) <= 5e+64) || ~(((x / y) <= 2e+191)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[((-t) / N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -2e+151], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -2e+124], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -1e+51], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -1e+26], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], -20000.0], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -1e-93], t, If[LessEqual[N[(x / y), $MachinePrecision], -3e-177], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 5e-84], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 5e+64], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+191]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+124}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+51}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+26}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;\frac{x}{y} \leq -20000:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+64} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+191}\right):\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -2.00000000000000003e151 or -1.9999999999999999e124 < (/.f64 x y) < -1e51 or -1.00000000000000005e26 < (/.f64 x y) < -2e4 or -9.999999999999999e-94 < (/.f64 x y) < -3.00000000000000008e-177 or 5.0000000000000002e-84 < (/.f64 x y) < 5e64 or 2.00000000000000015e191 < (/.f64 x y)

    1. Initial program 94.7%

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

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

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

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

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

    if -2.00000000000000003e151 < (/.f64 x y) < -1.9999999999999999e124 or -1e51 < (/.f64 x y) < -1.00000000000000005e26 or 5e64 < (/.f64 x y) < 2.00000000000000015e191

    1. Initial program 99.7%

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

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

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

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

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

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

    if -2e4 < (/.f64 x y) < -9.999999999999999e-94 or -3.00000000000000008e-177 < (/.f64 x y) < 5.0000000000000002e-84

    1. Initial program 98.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+151}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+124}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+51}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+26}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq -20000:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-84}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+64} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+191}\right):\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \end{array} \]

Alternative 3: 81.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\ t_2 := \frac{x}{y} \cdot z\\ t_3 := x \cdot \frac{z - t}{y}\\ \mathbf{if}\;\frac{x}{y} \leq -20000:\\ \;\;\;\;t_3\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-84}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-47}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\frac{x}{y} \leq 2000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- 1.0 (/ x y))))
        (t_2 (* (/ x y) z))
        (t_3 (* x (/ (- z t) y))))
   (if (<= (/ x y) -20000.0)
     t_3
     (if (<= (/ x y) -1e-93)
       t_1
       (if (<= (/ x y) -3e-177)
         t_2
         (if (<= (/ x y) 5e-84)
           t_1
           (if (<= (/ x y) 4e-47) t_2 (if (<= (/ x y) 2000.0) t_1 t_3))))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (1.0 - (x / y));
	double t_2 = (x / y) * z;
	double t_3 = x * ((z - t) / y);
	double tmp;
	if ((x / y) <= -20000.0) {
		tmp = t_3;
	} else if ((x / y) <= -1e-93) {
		tmp = t_1;
	} else if ((x / y) <= -3e-177) {
		tmp = t_2;
	} else if ((x / y) <= 5e-84) {
		tmp = t_1;
	} else if ((x / y) <= 4e-47) {
		tmp = t_2;
	} else if ((x / y) <= 2000.0) {
		tmp = t_1;
	} 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 = t * (1.0d0 - (x / y))
    t_2 = (x / y) * z
    t_3 = x * ((z - t) / y)
    if ((x / y) <= (-20000.0d0)) then
        tmp = t_3
    else if ((x / y) <= (-1d-93)) then
        tmp = t_1
    else if ((x / y) <= (-3d-177)) then
        tmp = t_2
    else if ((x / y) <= 5d-84) then
        tmp = t_1
    else if ((x / y) <= 4d-47) then
        tmp = t_2
    else if ((x / y) <= 2000.0d0) then
        tmp = t_1
    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 = t * (1.0 - (x / y));
	double t_2 = (x / y) * z;
	double t_3 = x * ((z - t) / y);
	double tmp;
	if ((x / y) <= -20000.0) {
		tmp = t_3;
	} else if ((x / y) <= -1e-93) {
		tmp = t_1;
	} else if ((x / y) <= -3e-177) {
		tmp = t_2;
	} else if ((x / y) <= 5e-84) {
		tmp = t_1;
	} else if ((x / y) <= 4e-47) {
		tmp = t_2;
	} else if ((x / y) <= 2000.0) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (1.0 - (x / y))
	t_2 = (x / y) * z
	t_3 = x * ((z - t) / y)
	tmp = 0
	if (x / y) <= -20000.0:
		tmp = t_3
	elif (x / y) <= -1e-93:
		tmp = t_1
	elif (x / y) <= -3e-177:
		tmp = t_2
	elif (x / y) <= 5e-84:
		tmp = t_1
	elif (x / y) <= 4e-47:
		tmp = t_2
	elif (x / y) <= 2000.0:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(1.0 - Float64(x / y)))
	t_2 = Float64(Float64(x / y) * z)
	t_3 = Float64(x * Float64(Float64(z - t) / y))
	tmp = 0.0
	if (Float64(x / y) <= -20000.0)
		tmp = t_3;
	elseif (Float64(x / y) <= -1e-93)
		tmp = t_1;
	elseif (Float64(x / y) <= -3e-177)
		tmp = t_2;
	elseif (Float64(x / y) <= 5e-84)
		tmp = t_1;
	elseif (Float64(x / y) <= 4e-47)
		tmp = t_2;
	elseif (Float64(x / y) <= 2000.0)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (1.0 - (x / y));
	t_2 = (x / y) * z;
	t_3 = x * ((z - t) / y);
	tmp = 0.0;
	if ((x / y) <= -20000.0)
		tmp = t_3;
	elseif ((x / y) <= -1e-93)
		tmp = t_1;
	elseif ((x / y) <= -3e-177)
		tmp = t_2;
	elseif ((x / y) <= 5e-84)
		tmp = t_1;
	elseif ((x / y) <= 4e-47)
		tmp = t_2;
	elseif ((x / y) <= 2000.0)
		tmp = t_1;
	else
		tmp = t_3;
	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[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -20000.0], t$95$3, If[LessEqual[N[(x / y), $MachinePrecision], -1e-93], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -3e-177], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 5e-84], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], 4e-47], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 2000.0], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\
\;\;\;\;t_2\\

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

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

\mathbf{elif}\;\frac{x}{y} \leq 2000:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -2e4 or 2e3 < (/.f64 x y)

    1. Initial program 95.2%

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

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

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

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

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

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

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

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

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

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

    if -2e4 < (/.f64 x y) < -9.999999999999999e-94 or -3.00000000000000008e-177 < (/.f64 x y) < 5.0000000000000002e-84 or 3.9999999999999999e-47 < (/.f64 x y) < 2e3

    1. Initial program 98.6%

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{t}{\frac{y}{x}}} \]
      4. associate-/r/82.1%

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

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

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

    if -9.999999999999999e-94 < (/.f64 x y) < -3.00000000000000008e-177 or 5.0000000000000002e-84 < (/.f64 x y) < 3.9999999999999999e-47

    1. Initial program 99.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -20000:\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-93}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq -3 \cdot 10^{-177}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{-84}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-47}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 2000:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \end{array} \]

Alternative 4: 62.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -20000 \lor \neg \left(\frac{x}{y} \leq -1 \cdot 10^{-93} \lor \neg \left(\frac{x}{y} \leq -3 \cdot 10^{-177}\right) \land \frac{x}{y} \leq 5 \cdot 10^{-84}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -2e4 or -9.999999999999999e-94 < (/.f64 x y) < -3.00000000000000008e-177 or 5.0000000000000002e-84 < (/.f64 x y)

    1. Initial program 95.8%

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

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

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

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

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

    if -2e4 < (/.f64 x y) < -9.999999999999999e-94 or -3.00000000000000008e-177 < (/.f64 x y) < 5.0000000000000002e-84

    1. Initial program 98.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -20000 \lor \neg \left(\frac{x}{y} \leq -1 \cdot 10^{-93} \lor \neg \left(\frac{x}{y} \leq -3 \cdot 10^{-177}\right) \land \frac{x}{y} \leq 5 \cdot 10^{-84}\right):\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 5: 98.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t) < 5.0000000000000003e299

    1. Initial program 98.4%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]

    if 5.0000000000000003e299 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t)

    1. Initial program 85.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z}{y} + \frac{-t}{y}\right)} \cdot x \]
      4. distribute-frac-neg99.9%

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

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

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

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

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

Alternative 6: 72.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;t \leq -3.2 \cdot 10^{+26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.05 \cdot 10^{-50}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;t \leq -3 \cdot 10^{-82} \lor \neg \left(t \leq 1.18 \cdot 10^{-150}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{z}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- 1.0 (/ x y)))))
   (if (<= t -3.2e+26)
     t_1
     (if (<= t -2.05e-50)
       (* (/ x y) z)
       (if (or (<= t -3e-82) (not (<= t 1.18e-150))) t_1 (/ x (/ y z)))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (1.0 - (x / y));
	double tmp;
	if (t <= -3.2e+26) {
		tmp = t_1;
	} else if (t <= -2.05e-50) {
		tmp = (x / y) * z;
	} else if ((t <= -3e-82) || !(t <= 1.18e-150)) {
		tmp = t_1;
	} else {
		tmp = x / (y / z);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = t * (1.0d0 - (x / y))
    if (t <= (-3.2d+26)) then
        tmp = t_1
    else if (t <= (-2.05d-50)) then
        tmp = (x / y) * z
    else if ((t <= (-3d-82)) .or. (.not. (t <= 1.18d-150))) then
        tmp = t_1
    else
        tmp = x / (y / z)
    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 tmp;
	if (t <= -3.2e+26) {
		tmp = t_1;
	} else if (t <= -2.05e-50) {
		tmp = (x / y) * z;
	} else if ((t <= -3e-82) || !(t <= 1.18e-150)) {
		tmp = t_1;
	} else {
		tmp = x / (y / z);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (1.0 - (x / y))
	tmp = 0
	if t <= -3.2e+26:
		tmp = t_1
	elif t <= -2.05e-50:
		tmp = (x / y) * z
	elif (t <= -3e-82) or not (t <= 1.18e-150):
		tmp = t_1
	else:
		tmp = x / (y / z)
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(1.0 - Float64(x / y)))
	tmp = 0.0
	if (t <= -3.2e+26)
		tmp = t_1;
	elseif (t <= -2.05e-50)
		tmp = Float64(Float64(x / y) * z);
	elseif ((t <= -3e-82) || !(t <= 1.18e-150))
		tmp = t_1;
	else
		tmp = Float64(x / Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (1.0 - (x / y));
	tmp = 0.0;
	if (t <= -3.2e+26)
		tmp = t_1;
	elseif (t <= -2.05e-50)
		tmp = (x / y) * z;
	elseif ((t <= -3e-82) || ~((t <= 1.18e-150)))
		tmp = t_1;
	else
		tmp = x / (y / z);
	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]}, If[LessEqual[t, -3.2e+26], t$95$1, If[LessEqual[t, -2.05e-50], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], If[Or[LessEqual[t, -3e-82], N[Not[LessEqual[t, 1.18e-150]], $MachinePrecision]], t$95$1, N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t \leq -3 \cdot 10^{-82} \lor \neg \left(t \leq 1.18 \cdot 10^{-150}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.20000000000000029e26 or -2.04999999999999993e-50 < t < -2.9999999999999999e-82 or 1.18e-150 < t

    1. Initial program 99.0%

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{t}{\frac{y}{x}}} \]
      4. associate-/r/78.5%

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

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

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

    if -3.20000000000000029e26 < t < -2.04999999999999993e-50

    1. Initial program 95.1%

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

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

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

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

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

    if -2.9999999999999999e-82 < t < 1.18e-150

    1. Initial program 93.1%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y}{z}}} \]
    5. Simplified69.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.2 \cdot 10^{+26}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;t \leq -2.05 \cdot 10^{-50}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;t \leq -3 \cdot 10^{-82} \lor \neg \left(t \leq 1.18 \cdot 10^{-150}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{z}}\\ \end{array} \]

Alternative 7: 94.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 95.1%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\frac{z}{y} + \frac{-t}{y}\right)} \cdot x \]
      4. distribute-frac-neg91.8%

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

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

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

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

    if -1.00000000000000005e26 < (/.f64 x y) < 5

    1. Initial program 98.7%

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

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

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

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

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

Alternative 8: 38.7% 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.8%

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

    \[\leadsto \color{blue}{t} \]
  3. Final simplification35.5%

    \[\leadsto t \]

Developer target: 97.2% accurate, 0.7× 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 2023238 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (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))