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

Percentage Accurate: 97.5% → 97.5%
Time: 9.1s
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.5% 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.5% accurate, 1.0× speedup?

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

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

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

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

Alternative 2: 65.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_1 := \frac{x}{y} \cdot \left(-t\right)\\
t_2 := \frac{z}{\frac{y}{x}}\\
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+191}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;\frac{x}{y} \leq -4000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;\frac{x}{y} \leq 10^{-60}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 10^{+57} \lor \neg \left(\frac{x}{y} \leq 10^{+180}\right):\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 x y) < -2.00000000000000015e191 or 9.9999999999999997e-61 < (/.f64 x y) < 1.00000000000000005e57 or 1e180 < (/.f64 x y)

    1. Initial program 94.9%

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
    5. Step-by-step derivation
      1. *-commutative64.9%

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

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    6. Simplified71.6%

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

    if -2.00000000000000015e191 < (/.f64 x y) < -4e6 or 1.00000000000000005e57 < (/.f64 x y) < 1e180

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

    if -4e6 < (/.f64 x y) < 9.9999999999999997e-61

    1. Initial program 98.2%

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

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

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

Alternative 3: 65.4% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 10^{-60}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 10^{+57} \lor \neg \left(\frac{x}{y} \leq 10^{+180}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -2.00000000000000015e191 or 9.9999999999999997e-61 < (/.f64 x y) < 1.00000000000000005e57 or 1e180 < (/.f64 x y)

    1. Initial program 94.9%

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
    5. Step-by-step derivation
      1. *-commutative64.9%

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

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    6. Simplified71.6%

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

    if -2.00000000000000015e191 < (/.f64 x y) < -4e6

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{x}{y} \cdot t} \]
      5. cancel-sign-sub-inv66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-t}{y} \cdot x} \]
      2. div-inv51.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t}{\frac{y}{x}}} \]
      11. frac-2neg1.6%

        \[\leadsto \color{blue}{\frac{-t}{-\frac{y}{x}}} \]
      12. add-sqr-sqrt0.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}}{-\frac{y}{x}} \]
      14. sqr-neg20.3%

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

        \[\leadsto \frac{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}{-\frac{y}{x}} \]
      16. add-sqr-sqrt64.6%

        \[\leadsto \frac{\color{blue}{t}}{-\frac{y}{x}} \]
      17. distribute-neg-frac64.6%

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

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

    if -4e6 < (/.f64 x y) < 9.9999999999999997e-61

    1. Initial program 98.2%

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

      \[\leadsto \color{blue}{t} \]

    if 1.00000000000000005e57 < (/.f64 x y) < 1e180

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

Alternative 4: 65.0% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;\frac{x}{y} \leq 10^{-60}:\\
\;\;\;\;t\\

\mathbf{elif}\;\frac{x}{y} \leq 10^{+57} \lor \neg \left(\frac{x}{y} \leq 10^{+180}\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (/.f64 x y) < -2.00000000000000015e191 or 9.9999999999999997e-61 < (/.f64 x y) < 1.00000000000000005e57 or 1e180 < (/.f64 x y)

    1. Initial program 94.9%

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
    5. Step-by-step derivation
      1. *-commutative64.9%

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

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    6. Simplified71.6%

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

    if -2.00000000000000015e191 < (/.f64 x y) < -4e6

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{x}{y} \cdot t} \]
      5. cancel-sign-sub-inv66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-t}{y} \cdot x} \]
      2. div-inv51.6%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{t}{\frac{y}{x}}} \]
      11. frac-2neg1.6%

        \[\leadsto \color{blue}{\frac{-t}{-\frac{y}{x}}} \]
      12. add-sqr-sqrt0.4%

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

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-t\right) \cdot \left(-t\right)}}}{-\frac{y}{x}} \]
      14. sqr-neg20.3%

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

        \[\leadsto \frac{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}{-\frac{y}{x}} \]
      16. add-sqr-sqrt64.6%

        \[\leadsto \frac{\color{blue}{t}}{-\frac{y}{x}} \]
      17. distribute-neg-frac64.6%

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

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

    if -4e6 < (/.f64 x y) < 9.9999999999999997e-61

    1. Initial program 98.2%

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

      \[\leadsto \color{blue}{t} \]

    if 1.00000000000000005e57 < (/.f64 x y) < 1e180

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-t \cdot x}}{y} \]
      2. distribute-lft-neg-out72.3%

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

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

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

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

Alternative 5: 73.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;t \leq -3.3 \cdot 10^{-95}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;t \leq 1.05 \cdot 10^{-64} \lor \neg \left(t \leq 520000\right):\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.3e-95 or 2.8999999999999999e-139 < t < 1.05000000000000006e-64 or 5.2e5 < t

    1. Initial program 99.3%

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

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{x}{y} \cdot t} \]
      5. cancel-sign-sub-inv83.2%

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

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

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

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

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

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

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

    if -3.3e-95 < t < 2.8999999999999999e-139

    1. Initial program 92.6%

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

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

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

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

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

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

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

    if 1.05000000000000006e-64 < t < 5.2e5

    1. Initial program 99.7%

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

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

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

      \[\leadsto \color{blue}{\frac{x \cdot z}{y}} \]
    5. Step-by-step derivation
      1. *-commutative67.9%

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

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    6. Simplified76.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3.3 \cdot 10^{-95}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-139}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{-64} \lor \neg \left(t \leq 520000\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \end{array} \]

Alternative 6: 94.8% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -2e12 or 4e5 < (/.f64 x y)

    1. Initial program 96.2%

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

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

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

    if -2e12 < (/.f64 x y) < 4e5

    1. Initial program 98.4%

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

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

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

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

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

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

Alternative 7: 95.8% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -4e6 or 3.99999999999999977e-29 < (/.f64 x y)

    1. Initial program 96.5%

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

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

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

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

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

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

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

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

        \[\leadsto \left(-t\right) \cdot \frac{x}{y} + \color{blue}{z \cdot \frac{x}{y}} \]
      6. distribute-rgt-out94.6%

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

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

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

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

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

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

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

    if -4e6 < (/.f64 x y) < 3.99999999999999977e-29

    1. Initial program 98.3%

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

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

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

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

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

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

Alternative 8: 65.1% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5.00000000000000019e-26 or 9.9999999999999997e-61 < (/.f64 x y)

    1. Initial program 96.8%

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

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

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

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

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

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

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

    if -5.00000000000000019e-26 < (/.f64 x y) < 9.9999999999999997e-61

    1. Initial program 98.0%

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

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

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

Alternative 9: 65.1% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 x y) < -5.00000000000000019e-26 or 9.9999999999999997e-61 < (/.f64 x y)

    1. Initial program 96.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{z}{\frac{y}{x}}} \]
    6. Simplified58.7%

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

    if -5.00000000000000019e-26 < (/.f64 x y) < 9.9999999999999997e-61

    1. Initial program 98.0%

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

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

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

Alternative 10: 84.8% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.18e11 or 2.09999999999999989e159 < t

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto t - \color{blue}{\frac{x}{y} \cdot t} \]
      5. cancel-sign-sub-inv93.2%

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

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

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

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

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

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

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

    if -1.18e11 < t < 2.09999999999999989e159

    1. Initial program 95.5%

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

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

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

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

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

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

Alternative 11: 55.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0041 \lor \neg \left(x \leq 126\right):\\
\;\;\;\;x \cdot \frac{z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.00410000000000000035 or 126 < x

    1. Initial program 96.4%

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

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

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

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

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

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

    if -0.00410000000000000035 < x < 126

    1. Initial program 98.3%

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

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

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

Alternative 12: 39.1% accurate, 9.0× speedup?

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

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

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

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

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