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

Percentage Accurate: 97.9% → 98.0%
Time: 8.5s
Alternatives: 8
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 8 alternatives:

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

Initial Program: 97.9% accurate, 1.0× speedup?

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

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

Alternative 1: 98.0% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
  5. Simplified98.6%

    \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
  6. Final simplification98.6%

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

Alternative 2: 86.3% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.55000000000000001e50 or 9.9999999999999999e52 < 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.7%

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

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

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

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

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

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

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

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

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

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

    if -1.55000000000000001e50 < t < 9.9999999999999999e52

    1. Initial program 97.0%

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

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

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

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

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

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

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

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

Alternative 3: 85.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+44} \lor \neg \left(t \leq 2.6 \cdot 10^{-35}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.1999999999999998e44 or 2.60000000000000005e-35 < 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. *-rgt-identity81.6%

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

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

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

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

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

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

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

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

    if -5.1999999999999998e44 < t < 2.60000000000000005e-35

    1. Initial program 96.6%

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

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

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

Alternative 4: 84.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq -2.2 \cdot 10^{+37} \lor \neg \left(t \leq 1.45 \cdot 10^{+54}\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 -2.2e+37) (not (<= t 1.45e+54)))
   (* t (- 1.0 (/ x y)))
   (+ t (* x (/ z y)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((t <= -2.2e+37) || !(t <= 1.45e+54)) {
		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 <= (-2.2d+37)) .or. (.not. (t <= 1.45d+54))) 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 <= -2.2e+37) || !(t <= 1.45e+54)) {
		tmp = t * (1.0 - (x / y));
	} else {
		tmp = t + (x * (z / y));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (t <= -2.2e+37) or not (t <= 1.45e+54):
		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 <= -2.2e+37) || !(t <= 1.45e+54))
		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 <= -2.2e+37) || ~((t <= 1.45e+54)))
		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, -2.2e+37], N[Not[LessEqual[t, 1.45e+54]], $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 -2.2 \cdot 10^{+37} \lor \neg \left(t \leq 1.45 \cdot 10^{+54}\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 < -2.2000000000000001e37 or 1.4499999999999999e54 < 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.7%

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

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

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

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

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

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

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

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

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

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

    if -2.2000000000000001e37 < t < 1.4499999999999999e54

    1. Initial program 97.0%

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

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

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

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

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

Alternative 5: 51.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+34} \lor \neg \left(x \leq 6.5 \cdot 10^{-24}\right):\\
\;\;\;\;x \cdot \frac{t}{-y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.54999999999999989e34 or 6.5e-24 < x

    1. Initial program 97.6%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto t - \color{blue}{\frac{t \cdot x}{y}} \]
    10. Step-by-step derivation
      1. *-commutative51.5%

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

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

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

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

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

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

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

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

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

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

    if -1.54999999999999989e34 < x < 6.5e-24

    1. Initial program 99.2%

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

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

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

Alternative 6: 97.9% accurate, 1.0× speedup?

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

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

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

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

Alternative 7: 66.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ t \cdot \left(1 - \frac{x}{y}\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* t (- 1.0 (/ x y))))
double code(double x, double y, double z, double t) {
	return t * (1.0 - (x / y));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = t * (1.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
	return t * (1.0 - (x / y));
}
def code(x, y, z, t):
	return t * (1.0 - (x / y))
function code(x, y, z, t)
	return Float64(t * Float64(1.0 - Float64(x / y)))
end
function tmp = code(x, y, z, t)
	tmp = t * (1.0 - (x / y));
end
code[x_, y_, z_, t_] := N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 38.9% 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 98.4%

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

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