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

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

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

Initial Program: 97.4% 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: 97.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{x}{y}, z - t, t\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma (/ x y) (- z t) t))
double code(double x, double y, double z, double t) {
	return fma((x / y), (z - t), t);
}
function code(x, y, z, t)
	return fma(Float64(x / y), Float64(z - t), t)
end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)
\end{array}
Derivation
  1. Initial program 97.9%

    \[\frac{x}{y} \cdot \left(z - t\right) + t \]
  2. Step-by-step derivation
    1. fma-def97.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)} \]
  3. Simplified97.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)} \]
  4. Final simplification97.9%

    \[\leadsto \mathsf{fma}\left(\frac{x}{y}, z - t, t\right) \]

Alternative 2: 94.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -500:\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\

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

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


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

    1. Initial program 94.0%

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

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

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

    if -500 < (/.f64 x y) < 4.0000000000000002e-26

    1. Initial program 99.0%

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

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

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

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

    if 4.0000000000000002e-26 < (/.f64 x y)

    1. Initial program 98.4%

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z - t}{y}} + t \]
    4. Simplified93.6%

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

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

Alternative 3: 51.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{t}{\frac{y}{-x}}\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{-44}:\\
\;\;\;\;t\\

\mathbf{elif}\;y \leq -5.4 \cdot 10^{-238}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 8.8 \cdot 10^{-277}:\\
\;\;\;\;t_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -9.49999999999999924e-44 or 2.09999999999999992e-76 < y

    1. Initial program 99.2%

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

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

    if -9.49999999999999924e-44 < y < -5.39999999999999981e-238 or 2.24999999999999994e-307 < y < 8.79999999999999983e-277

    1. Initial program 97.3%

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

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

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

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

        \[\leadsto \color{blue}{-\frac{t \cdot x}{y}} \]
      2. distribute-frac-neg71.3%

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

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

        \[\leadsto \color{blue}{\frac{t}{\frac{y}{-x}}} \]
    6. Simplified70.3%

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

    if -5.39999999999999981e-238 < y < 2.24999999999999994e-307

    1. Initial program 87.5%

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

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

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

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

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

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

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

    if 8.79999999999999983e-277 < y < 2.09999999999999992e-76

    1. Initial program 97.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-44}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -5.4 \cdot 10^{-238}:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{-307}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{elif}\;y \leq 8.8 \cdot 10^{-277}:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-76}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 4: 51.2% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;y \leq -2.25 \cdot 10^{-238}:\\
\;\;\;\;\frac{x \cdot \left(-t\right)}{y}\\

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -1.9599999999999999e-44 or 7.5999999999999998e-78 < y

    1. Initial program 99.2%

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

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

    if -1.9599999999999999e-44 < y < -2.24999999999999998e-238

    1. Initial program 96.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-t \cdot x}}{y} \]
      2. distribute-lft-neg-in70.5%

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

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

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

    if -2.24999999999999998e-238 < y < 2.2e-307

    1. Initial program 87.5%

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

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

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

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

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

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

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

    if 2.2e-307 < y < 3.39999999999999982e-277

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if 3.39999999999999982e-277 < y < 7.5999999999999998e-78

    1. Initial program 97.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.96 \cdot 10^{-44}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-238}:\\ \;\;\;\;\frac{x \cdot \left(-t\right)}{y}\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-307}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{-277}:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{-78}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 5: 73.1% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;t \leq -5 \cdot 10^{-149}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -6.5 \cdot 10^{-179}:\\
\;\;\;\;t\\

\mathbf{elif}\;t \leq 5 \cdot 10^{-148}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.74999999999999992e-116 or 4.9999999999999999e-148 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -1.74999999999999992e-116 < t < -4.99999999999999968e-149 or -6.49999999999999996e-179 < t < 4.9999999999999999e-148

    1. Initial program 92.8%

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

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

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

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

    if -4.99999999999999968e-149 < t < -6.49999999999999996e-179

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.75 \cdot 10^{-116}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;t \leq -5 \cdot 10^{-149}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;t \leq -6.5 \cdot 10^{-179}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 5 \cdot 10^{-148}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \]

Alternative 6: 93.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -500 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-26}\right):\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x}{y} \cdot z\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (/ x y) -500.0) (not (<= (/ x y) 4e-26)))
   (/ (* x (- z t)) y)
   (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -500.0) || !((x / y) <= 4e-26)) {
		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) <= (-500.0d0)) .or. (.not. ((x / y) <= 4d-26))) 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) <= -500.0) || !((x / y) <= 4e-26)) {
		tmp = (x * (z - t)) / y;
	} else {
		tmp = t + ((x / y) * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -500.0) or not ((x / y) <= 4e-26):
		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) <= -500.0) || !(Float64(x / y) <= 4e-26))
		tmp = Float64(Float64(x * 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) <= -500.0) || ~(((x / y) <= 4e-26)))
		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], -500.0], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4e-26]], $MachinePrecision]], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(t + N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -500 \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-26}\right):\\
\;\;\;\;\frac{x \cdot \left(z - t\right)}{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) < -500 or 4.0000000000000002e-26 < (/.f64 x y)

    1. Initial program 96.5%

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

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

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

    if -500 < (/.f64 x y) < 4.0000000000000002e-26

    1. Initial program 99.0%

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

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

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

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

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

Alternative 7: 51.6% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;y \leq -4.1 \cdot 10^{-227}:\\
\;\;\;\;\left(-x\right) \cdot \frac{t}{y}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.9500000000000001e-42 or 1.85000000000000006e-76 < y

    1. Initial program 99.2%

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

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

    if -1.9500000000000001e-42 < y < -4.10000000000000009e-227

    1. Initial program 96.0%

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

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{t}{\frac{y}{x}}} \]
      2. neg-mul-171.1%

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

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

        \[\leadsto \color{blue}{\frac{-t}{y} \cdot x} \]
      5. *-commutative70.3%

        \[\leadsto \color{blue}{x \cdot \frac{-t}{y}} \]
      6. distribute-frac-neg70.3%

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

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

    if -4.10000000000000009e-227 < y < 1.85000000000000006e-76

    1. Initial program 95.4%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{-42}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{-227}:\\ \;\;\;\;\left(-x\right) \cdot \frac{t}{y}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-76}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 8: 84.1% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.5000000000000003e-45 or 2.4499999999999999e-45 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if -5.5000000000000003e-45 < t < 2.4499999999999999e-45

    1. Initial program 95.4%

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

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

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

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

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

Alternative 9: 51.3% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.4999999999999996e-20 or 5.60000000000000047e-78 < y

    1. Initial program 99.1%

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

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

    if -5.4999999999999996e-20 < y < 5.60000000000000047e-78

    1. Initial program 95.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{-20}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-78}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 10: 53.3% accurate, 1.0× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.5999999999999999e-25 or 6.39999999999999999e-77 < y

    1. Initial program 99.1%

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

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

    if -3.5999999999999999e-25 < y < 6.39999999999999999e-77

    1. Initial program 95.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{-25}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 6.4 \cdot 10^{-77}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 11: 97.4% accurate, 1.0× speedup?

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

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

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

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

Alternative 12: 38.3% accurate, 9.0× speedup?

\[\begin{array}{l} \\ t \end{array} \]
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
	return t;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = t
end function
public static double code(double x, double y, double z, double t) {
	return t;
}
def code(x, y, z, t):
	return t
function code(x, y, z, t)
	return t
end
function tmp = code(x, y, z, t)
	tmp = t;
end
code[x_, y_, z_, t_] := t
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{t} \]
  3. Final simplification44.4%

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