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

Percentage Accurate: 97.7% → 97.8%
Time: 8.4s
Alternatives: 12
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 12 alternatives:

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

Initial Program: 97.7% 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{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 97.4%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(z - t\right)} + t \]
    3. clear-num97.3%

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

      \[\leadsto \color{blue}{\frac{1 \cdot \left(z - t\right)}{\frac{y}{x}}} + t \]
    5. *-un-lft-identity97.6%

      \[\leadsto \frac{\color{blue}{z - t}}{\frac{y}{x}} + t \]
  6. Applied egg-rr97.6%

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

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

Alternative 2: 94.7% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -2.00000000000000012e-9 or 1.00000000000000007e-17 < (/.f64 x y)

    1. Initial program 97.0%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x \cdot \frac{z - t}{y} + t}}\right)}^{3} \]
      9. associate-*r/92.5%

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

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{x}{y} \cdot \left(z - t\right)} + t}\right)}^{3} \]
      11. fma-def96.4%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)}}\right)}^{3} \]
    3. Applied egg-rr96.4%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)}\right)}^{3}} \]
    4. Taylor expanded in x around -inf 91.3%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{\left(z - t\right) \cdot x}{y}}}\right)}^{3} \]
    5. Step-by-step derivation
      1. rem-cube-cbrt91.9%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} \]
    6. Applied egg-rr96.1%

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

    if -2.00000000000000012e-9 < (/.f64 x y) < 1.00000000000000007e-17

    1. Initial program 97.8%

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

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

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

Alternative 3: 74.4% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+58}:\\
\;\;\;\;t + x \cdot \frac{z}{y}\\

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


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

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000018e61 < (/.f64 x y) < 4.99999999999999986e58

    1. Initial program 98.1%

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

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{z}{y}} + t \]
    4. Applied egg-rr90.4%

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

    if 4.99999999999999986e58 < (/.f64 x y)

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t \cdot x}{-y}} \]
    9. Applied egg-rr75.7%

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

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

Alternative 4: 76.6% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+58}:\\
\;\;\;\;t + z \cdot \frac{x}{y}\\

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


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

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000018e61 < (/.f64 x y) < 4.99999999999999986e58

    1. Initial program 98.1%

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

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

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

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

    if 4.99999999999999986e58 < (/.f64 x y)

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t \cdot x}{-y}} \]
    9. Applied egg-rr75.7%

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

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

Alternative 5: 95.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2000:\\
\;\;\;\;t + x \cdot \frac{z - t}{y}\\

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

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


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

    1. Initial program 94.7%

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

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

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

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

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

    if -2e3 < (/.f64 x y) < 1.00000000000000007e-17

    1. Initial program 97.9%

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

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

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

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

    if 1.00000000000000007e-17 < (/.f64 x y)

    1. Initial program 98.5%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{z - t}{y}} + t \]
      5. fma-udef92.2%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)} \]
      6. add-cube-cbrt91.7%

        \[\leadsto \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)} \cdot \sqrt[3]{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)}} \]
      7. pow391.6%

        \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(x, \frac{z - t}{y}, t\right)}\right)}^{3}} \]
      8. fma-udef91.6%

        \[\leadsto {\left(\sqrt[3]{\color{blue}{x \cdot \frac{z - t}{y} + t}}\right)}^{3} \]
      9. associate-*r/91.7%

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

        \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{x}{y} \cdot \left(z - t\right)} + t}\right)}^{3} \]
      11. fma-def97.9%

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(\frac{x}{y}, z - t, t\right)}\right)}^{3}} \]
    4. Taylor expanded in x around -inf 91.2%

      \[\leadsto {\left(\sqrt[3]{\color{blue}{\frac{\left(z - t\right) \cdot x}{y}}}\right)}^{3} \]
    5. Step-by-step derivation
      1. rem-cube-cbrt91.7%

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

        \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} \]
    6. Applied egg-rr98.0%

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

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

Alternative 6: 63.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 97.9%

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

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

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

Alternative 7: 86.1% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.5e21 or 3.20000000000000029e107 < t

    1. Initial program 99.9%

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

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

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

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

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

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

    if -4.5e21 < t < 3.20000000000000029e107

    1. Initial program 95.7%

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

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

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

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

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

Alternative 8: 86.0% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+21} \lor \neg \left(t \leq 7.2 \cdot 10^{+108}\right):\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.2e21 or 7.2e108 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{t}{\frac{y}{x}}} \]
    6. Applied egg-rr92.1%

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

    if -4.2e21 < t < 7.2e108

    1. Initial program 95.7%

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

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

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

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

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

Alternative 9: 84.6% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;t \leq 2.4 \cdot 10^{+104}:\\
\;\;\;\;t + \frac{z}{\frac{y}{x}}\\

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{x \cdot t}{y}} \]
    6. Applied egg-rr88.3%

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

    if -1.42e22 < t < 2.4e104

    1. Initial program 95.7%

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

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

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

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

    if 2.4e104 < t

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.42 \cdot 10^{+22}:\\ \;\;\;\;t - \frac{t \cdot x}{y}\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{+104}:\\ \;\;\;\;t + \frac{z}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \end{array} \]

Alternative 10: 97.7% 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 97.4%

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

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

Alternative 11: 39.0% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.44999999999999992e185

    1. Initial program 96.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\frac{t}{\frac{y}{x}}} \]
      5. distribute-neg-frac34.9%

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

      \[\leadsto \color{blue}{\frac{-t}{\frac{y}{x}}} \]
    10. Step-by-step derivation
      1. div-inv42.0%

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \left(-t\right)} \]
      4. add-sqr-sqrt30.4%

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

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

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

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

        \[\leadsto \frac{x}{y} \cdot \color{blue}{t} \]
    11. Applied egg-rr20.2%

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

    if -2.44999999999999992e185 < x

    1. Initial program 97.5%

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

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

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

Alternative 12: 38.5% 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.4%

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

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

    \[\leadsto t \]

Developer target: 97.2% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023224 
(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))