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

Percentage Accurate: 97.8% → 97.8%
Time: 6.2s
Alternatives: 7
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 7 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: 97.8% 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.7%

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

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

Alternative 2: 62.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} \cdot z\\ t_2 := t \cdot \frac{x}{-y}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+237}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq -10000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-75}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+43} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+110}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+192}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (/ x y) z)) (t_2 (* t (/ x (- y)))))
   (if (<= (/ x y) -1e+237)
     t_1
     (if (<= (/ x y) -10000000.0)
       t_2
       (if (<= (/ x y) 2e-75)
         t
         (if (or (<= (/ x y) 2e+43)
                 (and (not (<= (/ x y) 2e+110)) (<= (/ x y) 5e+192)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) * z;
	double t_2 = t * (x / -y);
	double tmp;
	if ((x / y) <= -1e+237) {
		tmp = t_1;
	} else if ((x / y) <= -10000000.0) {
		tmp = t_2;
	} else if ((x / y) <= 2e-75) {
		tmp = t;
	} else if (((x / y) <= 2e+43) || (!((x / y) <= 2e+110) && ((x / y) <= 5e+192))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x / y) * z
    t_2 = t * (x / -y)
    if ((x / y) <= (-1d+237)) then
        tmp = t_1
    else if ((x / y) <= (-10000000.0d0)) then
        tmp = t_2
    else if ((x / y) <= 2d-75) then
        tmp = t
    else if (((x / y) <= 2d+43) .or. (.not. ((x / y) <= 2d+110)) .and. ((x / y) <= 5d+192)) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) * z;
	double t_2 = t * (x / -y);
	double tmp;
	if ((x / y) <= -1e+237) {
		tmp = t_1;
	} else if ((x / y) <= -10000000.0) {
		tmp = t_2;
	} else if ((x / y) <= 2e-75) {
		tmp = t;
	} else if (((x / y) <= 2e+43) || (!((x / y) <= 2e+110) && ((x / y) <= 5e+192))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) * z
	t_2 = t * (x / -y)
	tmp = 0
	if (x / y) <= -1e+237:
		tmp = t_1
	elif (x / y) <= -10000000.0:
		tmp = t_2
	elif (x / y) <= 2e-75:
		tmp = t
	elif ((x / y) <= 2e+43) or (not ((x / y) <= 2e+110) and ((x / y) <= 5e+192)):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) * z)
	t_2 = Float64(t * Float64(x / Float64(-y)))
	tmp = 0.0
	if (Float64(x / y) <= -1e+237)
		tmp = t_1;
	elseif (Float64(x / y) <= -10000000.0)
		tmp = t_2;
	elseif (Float64(x / y) <= 2e-75)
		tmp = t;
	elseif ((Float64(x / y) <= 2e+43) || (!(Float64(x / y) <= 2e+110) && (Float64(x / y) <= 5e+192)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) * z;
	t_2 = t * (x / -y);
	tmp = 0.0;
	if ((x / y) <= -1e+237)
		tmp = t_1;
	elseif ((x / y) <= -10000000.0)
		tmp = t_2;
	elseif ((x / y) <= 2e-75)
		tmp = t;
	elseif (((x / y) <= 2e+43) || (~(((x / y) <= 2e+110)) && ((x / y) <= 5e+192)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(x / (-y)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e+237], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -10000000.0], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 2e-75], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 2e+43], And[N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+110]], $MachinePrecision], LessEqual[N[(x / y), $MachinePrecision], 5e+192]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;\frac{x}{y} \leq -10000000:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+43} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+110}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -9.9999999999999994e236 or 1.9999999999999999e-75 < (/.f64 x y) < 2.00000000000000003e43 or 2e110 < (/.f64 x y) < 5.00000000000000033e192

    1. Initial program 97.0%

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

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

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

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

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

    if -9.9999999999999994e236 < (/.f64 x y) < -1e7 or 2.00000000000000003e43 < (/.f64 x y) < 2e110 or 5.00000000000000033e192 < (/.f64 x y)

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1e7 < (/.f64 x y) < 1.9999999999999999e-75

    1. Initial program 98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+237}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq -10000000:\\ \;\;\;\;t \cdot \frac{x}{-y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-75}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+43} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+110}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+192}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{-y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 62.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \frac{x}{y} \cdot z\\ t_2 := \frac{t}{\frac{y}{-x}}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+237}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\frac{x}{y} \leq -10000000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-75}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+43} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+110}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+192}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (/ x y) z)) (t_2 (/ t (/ y (- x)))))
   (if (<= (/ x y) -1e+237)
     t_1
     (if (<= (/ x y) -10000000.0)
       t_2
       (if (<= (/ x y) 2e-75)
         t
         (if (or (<= (/ x y) 2e+43)
                 (and (not (<= (/ x y) 2e+110)) (<= (/ x y) 5e+192)))
           t_1
           t_2))))))
double code(double x, double y, double z, double t) {
	double t_1 = (x / y) * z;
	double t_2 = t / (y / -x);
	double tmp;
	if ((x / y) <= -1e+237) {
		tmp = t_1;
	} else if ((x / y) <= -10000000.0) {
		tmp = t_2;
	} else if ((x / y) <= 2e-75) {
		tmp = t;
	} else if (((x / y) <= 2e+43) || (!((x / y) <= 2e+110) && ((x / y) <= 5e+192))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = (x / y) * z
    t_2 = t / (y / -x)
    if ((x / y) <= (-1d+237)) then
        tmp = t_1
    else if ((x / y) <= (-10000000.0d0)) then
        tmp = t_2
    else if ((x / y) <= 2d-75) then
        tmp = t
    else if (((x / y) <= 2d+43) .or. (.not. ((x / y) <= 2d+110)) .and. ((x / y) <= 5d+192)) then
        tmp = t_1
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = (x / y) * z;
	double t_2 = t / (y / -x);
	double tmp;
	if ((x / y) <= -1e+237) {
		tmp = t_1;
	} else if ((x / y) <= -10000000.0) {
		tmp = t_2;
	} else if ((x / y) <= 2e-75) {
		tmp = t;
	} else if (((x / y) <= 2e+43) || (!((x / y) <= 2e+110) && ((x / y) <= 5e+192))) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = (x / y) * z
	t_2 = t / (y / -x)
	tmp = 0
	if (x / y) <= -1e+237:
		tmp = t_1
	elif (x / y) <= -10000000.0:
		tmp = t_2
	elif (x / y) <= 2e-75:
		tmp = t
	elif ((x / y) <= 2e+43) or (not ((x / y) <= 2e+110) and ((x / y) <= 5e+192)):
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(Float64(x / y) * z)
	t_2 = Float64(t / Float64(y / Float64(-x)))
	tmp = 0.0
	if (Float64(x / y) <= -1e+237)
		tmp = t_1;
	elseif (Float64(x / y) <= -10000000.0)
		tmp = t_2;
	elseif (Float64(x / y) <= 2e-75)
		tmp = t;
	elseif ((Float64(x / y) <= 2e+43) || (!(Float64(x / y) <= 2e+110) && (Float64(x / y) <= 5e+192)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x / y) * z;
	t_2 = t / (y / -x);
	tmp = 0.0;
	if ((x / y) <= -1e+237)
		tmp = t_1;
	elseif ((x / y) <= -10000000.0)
		tmp = t_2;
	elseif ((x / y) <= 2e-75)
		tmp = t;
	elseif (((x / y) <= 2e+43) || (~(((x / y) <= 2e+110)) && ((x / y) <= 5e+192)))
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$2 = N[(t / N[(y / (-x)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x / y), $MachinePrecision], -1e+237], t$95$1, If[LessEqual[N[(x / y), $MachinePrecision], -10000000.0], t$95$2, If[LessEqual[N[(x / y), $MachinePrecision], 2e-75], t, If[Or[LessEqual[N[(x / y), $MachinePrecision], 2e+43], And[N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e+110]], $MachinePrecision], LessEqual[N[(x / y), $MachinePrecision], 5e+192]]], t$95$1, t$95$2]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;\frac{x}{y} \leq -10000000:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+43} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+110}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -9.9999999999999994e236 or 1.9999999999999999e-75 < (/.f64 x y) < 2.00000000000000003e43 or 2e110 < (/.f64 x y) < 5.00000000000000033e192

    1. Initial program 97.0%

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

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

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

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

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

    if -9.9999999999999994e236 < (/.f64 x y) < -1e7 or 2.00000000000000003e43 < (/.f64 x y) < 2e110 or 5.00000000000000033e192 < (/.f64 x y)

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{t \cdot \frac{-x}{-y}} \]
      4. frac-2neg78.9%

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

        \[\leadsto -t \cdot \color{blue}{\frac{1}{\frac{y}{x}}} \]
      6. div-inv77.5%

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

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

    if -1e7 < (/.f64 x y) < 1.9999999999999999e-75

    1. Initial program 98.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+237}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq -10000000:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-75}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+43} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+110}\right) \land \frac{x}{y} \leq 5 \cdot 10^{+192}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 85.1% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -9.99999999999999924e-25 or 1.9999999999999999e-75 < (/.f64 x y)

    1. Initial program 97.2%

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

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

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

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

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

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

    if -9.99999999999999924e-25 < (/.f64 x y) < 1.9999999999999999e-75

    1. Initial program 98.3%

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

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

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

Alternative 5: 93.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 0.04:\\
\;\;\;\;t + \frac{x \cdot z}{y}\\

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


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

    1. Initial program 97.1%

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

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

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

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

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

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

    if -1e7 < (/.f64 x y) < 0.0400000000000000008

    1. Initial program 98.5%

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

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

    if 0.0400000000000000008 < (/.f64 x y)

    1. Initial program 96.7%

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

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

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

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

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

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

Alternative 6: 65.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-24} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-75}\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-24) (not (<= (/ x y) 2e-75))) (* (/ x y) z) t))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((x / y) <= -1e-24) || !((x / y) <= 2e-75)) {
		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-24)) .or. (.not. ((x / y) <= 2d-75))) 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-24) || !((x / y) <= 2e-75)) {
		tmp = (x / y) * z;
	} else {
		tmp = t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((x / y) <= -1e-24) or not ((x / y) <= 2e-75):
		tmp = (x / y) * z
	else:
		tmp = t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(x / y) <= -1e-24) || !(Float64(x / y) <= 2e-75))
		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-24) || ~(((x / y) <= 2e-75)))
		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-24], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2e-75]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision], t]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{-24} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{-75}\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.99999999999999924e-25 or 1.9999999999999999e-75 < (/.f64 x y)

    1. Initial program 97.2%

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

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

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

        \[\leadsto \color{blue}{z \cdot \frac{x}{y}} \]
    5. Applied egg-rr55.3%

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

    if -9.99999999999999924e-25 < (/.f64 x y) < 1.9999999999999999e-75

    1. Initial program 98.3%

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

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

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

Alternative 7: 37.7% accurate, 9.0× speedup?

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

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

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

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

Developer target: 97.5% accurate, 0.5× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

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

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