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

Percentage Accurate: 97.9% → 97.9%
Time: 6.8s
Alternatives: 11
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 11 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: 97.9% 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 98.0%

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

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

Alternative 2: 77.1% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+18} \lor \neg \left(\frac{x}{y} \leq 2 \cdot 10^{+189}\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\

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


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

    1. Initial program 90.1%

      \[\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*99.9%

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

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{z - t}}} + t \]
    4. Taylor expanded in z around inf 76.0%

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

    if -1.9999999999999999e253 < (/.f64 x y) < -5e18 or 2e189 < (/.f64 x y)

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e18 < (/.f64 x y) < 2e189

    1. Initial program 98.7%

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

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

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

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

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

Alternative 3: 77.3% accurate, 0.5× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\


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

    1. Initial program 97.5%

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

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

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

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

    if -1.9999999999999999e253 < (/.f64 x y) < -5e18 or 2e189 < (/.f64 x y)

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(-t\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.4%

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

Alternative 4: 77.3% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e18 < (/.f64 x y) < 2e189

    1. Initial program 98.7%

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

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

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

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

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

Alternative 5: 62.8% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -9.9999999999999992e22 or 0.0040000000000000001 < (/.f64 x y)

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{-t}{y}} \]
    7. Simplified52.0%

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

    if -9.9999999999999992e22 < (/.f64 x y) < 0.0040000000000000001

    1. Initial program 98.6%

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

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

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

Alternative 6: 65.3% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -50000000 \lor \neg \left(\frac{x}{y} \leq 0.004\right):\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\

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


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

    1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e7 < (/.f64 x y) < 0.0040000000000000001

    1. Initial program 98.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -50000000 \lor \neg \left(\frac{x}{y} \leq 0.004\right):\\ \;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 7: 83.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.3999999999999999e49 or 1.55e-82 < t

    1. Initial program 99.2%

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

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

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

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

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

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

    if -1.3999999999999999e49 < t < 1.55e-82

    1. Initial program 96.6%

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

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

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

Alternative 8: 83.9% accurate, 0.8× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.7999999999999997e50

    1. Initial program 99.9%

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

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

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

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

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

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

    if -6.7999999999999997e50 < t < 4.39999999999999971e-82

    1. Initial program 96.6%

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

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

    if 4.39999999999999971e-82 < t

    1. Initial program 98.8%

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

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

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

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

      \[\leadsto \color{blue}{\left(-\frac{t}{\frac{y}{x}}\right)} + t \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.8 \cdot 10^{+50}:\\ \;\;\;\;t - \frac{x}{y} \cdot t\\ \mathbf{elif}\;t \leq 4.4 \cdot 10^{-82}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \end{array} \]

Alternative 9: 40.1% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \log \left(e^{\color{blue}{\frac{x}{y} \cdot \left(-t\right)}}\right) \]
      4. *-un-lft-identity56.0%

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

        \[\leadsto \color{blue}{\log 1 + \log \left(e^{\frac{x}{y} \cdot \left(-t\right)}\right)} \]
      6. metadata-eval56.0%

        \[\leadsto \color{blue}{0} + \log \left(e^{\frac{x}{y} \cdot \left(-t\right)}\right) \]
      7. add-log-exp60.9%

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

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

        \[\leadsto 0 + \color{blue}{\frac{x}{\frac{y}{-t}}} \]
      10. add-sqr-sqrt17.7%

        \[\leadsto 0 + \frac{x}{\frac{y}{\color{blue}{\sqrt{-t} \cdot \sqrt{-t}}}} \]
      11. sqrt-unprod20.8%

        \[\leadsto 0 + \frac{x}{\frac{y}{\color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}}} \]
      12. sqr-neg20.8%

        \[\leadsto 0 + \frac{x}{\frac{y}{\sqrt{\color{blue}{t \cdot t}}}} \]
      13. sqrt-unprod3.2%

        \[\leadsto 0 + \frac{x}{\frac{y}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}} \]
      14. add-sqr-sqrt10.9%

        \[\leadsto 0 + \frac{x}{\frac{y}{\color{blue}{t}}} \]
    9. Applied egg-rr10.9%

      \[\leadsto \color{blue}{0 + \frac{x}{\frac{y}{t}}} \]
    10. Step-by-step derivation
      1. +-lft-identity10.9%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot t} \]
    11. Simplified13.2%

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

    if -9.50000000000000041e117 < (/.f64 x y)

    1. Initial program 99.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -9.5 \cdot 10^{+117}:\\ \;\;\;\;\frac{x}{y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 10: 40.0% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-t}{\frac{y}{x}}} \]
      6. add-sqr-sqrt22.2%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}}{\frac{y}{x}} \]
      8. sqr-neg22.9%

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

        \[\leadsto \frac{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}{\frac{y}{x}} \]
      10. add-sqr-sqrt13.3%

        \[\leadsto \frac{\color{blue}{t}}{\frac{y}{x}} \]
    9. Applied egg-rr13.3%

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

    if -5.00000000000000007e121 < (/.f64 x y)

    1. Initial program 99.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+121}:\\ \;\;\;\;\frac{t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 11: 38.8% 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.0%

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

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

    \[\leadsto t \]

Developer target: 97.7% accurate, 0.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}

Reproduce

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

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

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