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

Percentage Accurate: 97.8% → 98.6%
Time: 7.9s
Alternatives: 10
Speedup: 0.4×

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 10 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.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t + \frac{x}{y} \cdot \left(z - t\right) \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= (+ t (* (/ x y) (- z t))) (- INFINITY))
   (fma x (/ (- z t) y) t)
   (fma (/ x y) (- z t) t)))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t + ((x / y) * (z - t))) <= -((double) INFINITY)) {
		tmp = fma(x, ((z - t) / y), t);
	} else {
		tmp = fma((x / y), (z - t), t);
	}
	return tmp;
}
function code(x, y, z, t)
	tmp = 0.0
	if (Float64(t + Float64(Float64(x / y) * Float64(z - t))) <= Float64(-Inf))
		tmp = fma(x, Float64(Float64(z - t) / y), t);
	else
		tmp = fma(Float64(x / y), Float64(z - t), t);
	end
	return tmp
end
code[x_, y_, z_, t_] := If[LessEqual[N[(t + N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(z - t), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t + \frac{x}{y} \cdot \left(z - t\right) \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\

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


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

    1. Initial program 86.6%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z - t}{y}} + t \]
      3. fma-define100.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)} \]
    4. Add Preprocessing

    if -inf.0 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t)

    1. Initial program 99.0%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)} \]
    4. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

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

Alternative 2: 98.6% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ t (* (/ x y) (- z t)))))
   (if (<= t_1 (- INFINITY)) (fma x (/ (- z t) y) t) t_1)))
double code(double x, double y, double z, double t) {
	double t_1 = t + ((x / y) * (z - t));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = fma(x, ((z - t) / y), t);
	} else {
		tmp = t_1;
	}
	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 <= Float64(-Inf))
		tmp = fma(x, Float64(Float64(z - t) / y), t);
	else
		tmp = t_1;
	end
	return 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, (-Infinity)], N[(x * N[(N[(z - t), $MachinePrecision] / y), $MachinePrecision] + t), $MachinePrecision], t$95$1]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)\\

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


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

    1. Initial program 86.6%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{z - t}{y}} + t \]
      3. fma-define100.0%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)} \]
    4. Add Preprocessing

    if -inf.0 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t)

    1. Initial program 99.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

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

Alternative 3: 65.9% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{-40} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-18}\right):\\
\;\;\;\;\frac{x}{y} \cdot z\\

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


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

    1. Initial program 87.9%

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

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

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

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

        \[\leadsto t + \left(-\color{blue}{\frac{x}{y} \cdot t}\right) \]
      4. *-lft-identity68.8%

        \[\leadsto \color{blue}{1 \cdot t} + \left(-\frac{x}{y} \cdot t\right) \]
      5. distribute-lft-neg-in68.8%

        \[\leadsto 1 \cdot t + \color{blue}{\left(-\frac{x}{y}\right) \cdot t} \]
      6. mul-1-neg68.8%

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

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

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

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

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

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

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

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

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

    if -4.9999999999999996e227 < (/.f64 x y) < -9.9999999999999993e-41 or 5.00000000000000036e-18 < (/.f64 x y)

    1. Initial program 98.1%

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999993e-41 < (/.f64 x y) < 5.00000000000000036e-18

    1. Initial program 99.0%

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

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

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

Alternative 4: 98.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t + \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ t (* (/ x y) (- z t)))))
   (if (<= t_1 (- INFINITY)) (/ (* x (- z t)) y) t_1)))
double code(double x, double y, double z, double t) {
	double t_1 = t + ((x / y) * (z - t));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = (x * (z - t)) / y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
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 <= -Double.POSITIVE_INFINITY) {
		tmp = (x * (z - t)) / y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t + ((x / y) * (z - t))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = (x * (z - t)) / y
	else:
		tmp = t_1
	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 <= Float64(-Inf))
		tmp = Float64(Float64(x * Float64(z - t)) / y);
	else
		tmp = t_1;
	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 <= -Inf)
		tmp = (x * (z - t)) / y;
	else
		tmp = t_1;
	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, (-Infinity)], N[(N[(x * N[(z - t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]
\begin{array}{l}

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

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


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

    1. Initial program 86.6%

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

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

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

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

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

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

    if -inf.0 < (+.f64 (*.f64 (/.f64 x y) (-.f64 z t)) t)

    1. Initial program 99.0%

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

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

Alternative 5: 94.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+57} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-5}\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) -1e+57) (not (<= (/ x y) 5e-5)))
   (/ (* x (- z t)) y)
   (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -1e+57) || !((x / y) <= 5e-5)) {
		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+57)) .or. (.not. ((x / y) <= 5d-5))) 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+57) || !((x / y) <= 5e-5)) {
		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+57) or not ((x / y) <= 5e-5):
		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+57) || !(Float64(x / y) <= 5e-5))
		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) <= -1e+57) || ~(((x / y) <= 5e-5)))
		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+57], N[Not[LessEqual[N[(x / y), $MachinePrecision], 5e-5]], $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 -1 \cdot 10^{+57} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-5}\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) < -1.00000000000000005e57 or 5.00000000000000024e-5 < (/.f64 x y)

    1. Initial program 95.3%

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

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

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

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

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

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

    if -1.00000000000000005e57 < (/.f64 x y) < 5.00000000000000024e-5

    1. Initial program 99.1%

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

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

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

Alternative 6: 65.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-40} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{-18}\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) < -9.9999999999999993e-41 or 5.00000000000000036e-18 < (/.f64 x y)

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999993e-41 < (/.f64 x y) < 5.00000000000000036e-18

    1. Initial program 99.0%

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

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

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

Alternative 7: 86.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.55 \cdot 10^{-30} \lor \neg \left(t \leq 4.4 \cdot 10^{+95}\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 -2.55e-30) (not (<= t 4.4e+95)))
   (* t (- 1.0 (/ x y)))
   (+ t (* (/ x y) z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.55e-30) || !(t <= 4.4e+95)) {
		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 <= (-2.55d-30)) .or. (.not. (t <= 4.4d+95))) 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 <= -2.55e-30) || !(t <= 4.4e+95)) {
		tmp = t * (1.0 - (x / y));
	} else {
		tmp = t + ((x / y) * z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -2.55e-30) or not (t <= 4.4e+95):
		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 <= -2.55e-30) || !(t <= 4.4e+95))
		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 <= -2.55e-30) || ~((t <= 4.4e+95)))
		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, -2.55e-30], N[Not[LessEqual[t, 4.4e+95]], $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 -2.55 \cdot 10^{-30} \lor \neg \left(t \leq 4.4 \cdot 10^{+95}\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 < -2.54999999999999986e-30 or 4.3999999999999998e95 < t

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto t + \left(-\color{blue}{\frac{x}{y} \cdot t}\right) \]
      4. *-lft-identity87.9%

        \[\leadsto \color{blue}{1 \cdot t} + \left(-\frac{x}{y} \cdot t\right) \]
      5. distribute-lft-neg-in87.9%

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

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

        \[\leadsto \color{blue}{t \cdot \left(1 + -1 \cdot \frac{x}{y}\right)} \]
      8. mul-1-neg87.9%

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

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

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

    if -2.54999999999999986e-30 < t < 4.3999999999999998e95

    1. Initial program 95.0%

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

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

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

Alternative 8: 85.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -8.20000000000000028e-41 or 9.59999999999999994e-8 < t

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto t + \left(-\color{blue}{\frac{x}{y} \cdot t}\right) \]
      4. *-lft-identity87.0%

        \[\leadsto \color{blue}{1 \cdot t} + \left(-\frac{x}{y} \cdot t\right) \]
      5. distribute-lft-neg-in87.0%

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

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

        \[\leadsto \color{blue}{t \cdot \left(1 + -1 \cdot \frac{x}{y}\right)} \]
      8. mul-1-neg87.0%

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

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

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

    if -8.20000000000000028e-41 < t < 9.59999999999999994e-8

    1. Initial program 94.4%

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

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

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

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

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

Alternative 9: 74.3% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto t + \left(-\color{blue}{\frac{x}{y} \cdot t}\right) \]
      4. *-lft-identity84.5%

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

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

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

        \[\leadsto \color{blue}{t \cdot \left(1 + -1 \cdot \frac{x}{y}\right)} \]
      8. mul-1-neg84.5%

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

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

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

    if -8.50000000000000041e-45 < t < 2.65000000000000004e-141

    1. Initial program 92.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 39.2% accurate, 9.0× speedup?

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

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

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

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

Developer Target 1: 97.6% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (! :herbie-platform default (if (< z 689864138640673/250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (/ x y) (- z t)) t) (if (< z 581748612718609/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t))))

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