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

Percentage Accurate: 96.8% → 96.8%
Time: 8.8s
Alternatives: 13
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x - y}{z - y} \cdot t \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * 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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
function code(x, y, z, t)
	return Float64(Float64(Float64(x - y) / Float64(z - y)) * t)
end
function tmp = code(x, y, z, t)
	tmp = ((x - y) / (z - y)) * t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{z - y} \cdot 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 13 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: 96.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{z - y} \cdot t \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * 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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
function code(x, y, z, t)
	return Float64(Float64(Float64(x - y) / Float64(z - y)) * t)
end
function tmp = code(x, y, z, t)
	tmp = ((x - y) / (z - y)) * t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}

\\
\frac{x - y}{z - y} \cdot t
\end{array}

Alternative 1: 96.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x - y}{z - y} \cdot t \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * 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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
	return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
function code(x, y, z, t)
	return Float64(Float64(Float64(x - y) / Float64(z - y)) * t)
end
function tmp = code(x, y, z, t)
	tmp = ((x - y) / (z - y)) * t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{x - y}{z - y} \cdot t \]
  2. Final simplification96.4%

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

Alternative 2: 74.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \frac{x - y}{z}\\ t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+29}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-63}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-67}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-166}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-60}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3200000000000:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (/ (- x y) z))) (t_2 (* t (- 1.0 (/ x y)))))
   (if (<= y -8.2e+29)
     t_2
     (if (<= y -4e-63)
       t_1
       (if (<= y -1.8e-67)
         t
         (if (<= y 2.6e-166)
           (* x (/ t (- z y)))
           (if (<= y 4.9e-60)
             t_1
             (if (<= y 3200000000000.0) (* t (/ x (- z y))) t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * ((x - y) / z);
	double t_2 = t * (1.0 - (x / y));
	double tmp;
	if (y <= -8.2e+29) {
		tmp = t_2;
	} else if (y <= -4e-63) {
		tmp = t_1;
	} else if (y <= -1.8e-67) {
		tmp = t;
	} else if (y <= 2.6e-166) {
		tmp = x * (t / (z - y));
	} else if (y <= 4.9e-60) {
		tmp = t_1;
	} else if (y <= 3200000000000.0) {
		tmp = t * (x / (z - y));
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = t * ((x - y) / z)
    t_2 = t * (1.0d0 - (x / y))
    if (y <= (-8.2d+29)) then
        tmp = t_2
    else if (y <= (-4d-63)) then
        tmp = t_1
    else if (y <= (-1.8d-67)) then
        tmp = t
    else if (y <= 2.6d-166) then
        tmp = x * (t / (z - y))
    else if (y <= 4.9d-60) then
        tmp = t_1
    else if (y <= 3200000000000.0d0) then
        tmp = t * (x / (z - y))
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = t * ((x - y) / z);
	double t_2 = t * (1.0 - (x / y));
	double tmp;
	if (y <= -8.2e+29) {
		tmp = t_2;
	} else if (y <= -4e-63) {
		tmp = t_1;
	} else if (y <= -1.8e-67) {
		tmp = t;
	} else if (y <= 2.6e-166) {
		tmp = x * (t / (z - y));
	} else if (y <= 4.9e-60) {
		tmp = t_1;
	} else if (y <= 3200000000000.0) {
		tmp = t * (x / (z - y));
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * ((x - y) / z)
	t_2 = t * (1.0 - (x / y))
	tmp = 0
	if y <= -8.2e+29:
		tmp = t_2
	elif y <= -4e-63:
		tmp = t_1
	elif y <= -1.8e-67:
		tmp = t
	elif y <= 2.6e-166:
		tmp = x * (t / (z - y))
	elif y <= 4.9e-60:
		tmp = t_1
	elif y <= 3200000000000.0:
		tmp = t * (x / (z - y))
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(Float64(x - y) / z))
	t_2 = Float64(t * Float64(1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -8.2e+29)
		tmp = t_2;
	elseif (y <= -4e-63)
		tmp = t_1;
	elseif (y <= -1.8e-67)
		tmp = t;
	elseif (y <= 2.6e-166)
		tmp = Float64(x * Float64(t / Float64(z - y)));
	elseif (y <= 4.9e-60)
		tmp = t_1;
	elseif (y <= 3200000000000.0)
		tmp = Float64(t * Float64(x / Float64(z - y)));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * ((x - y) / z);
	t_2 = t * (1.0 - (x / y));
	tmp = 0.0;
	if (y <= -8.2e+29)
		tmp = t_2;
	elseif (y <= -4e-63)
		tmp = t_1;
	elseif (y <= -1.8e-67)
		tmp = t;
	elseif (y <= 2.6e-166)
		tmp = x * (t / (z - y));
	elseif (y <= 4.9e-60)
		tmp = t_1;
	elseif (y <= 3200000000000.0)
		tmp = t * (x / (z - y));
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.2e+29], t$95$2, If[LessEqual[y, -4e-63], t$95$1, If[LessEqual[y, -1.8e-67], t, If[LessEqual[y, 2.6e-166], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.9e-60], t$95$1, If[LessEqual[y, 3200000000000.0], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -4 \cdot 10^{-63}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.8 \cdot 10^{-67}:\\
\;\;\;\;t\\

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

\mathbf{elif}\;y \leq 4.9 \cdot 10^{-60}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3200000000000:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -8.2000000000000007e29 or 3.2e12 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around 0 80.4%

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

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

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

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

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

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

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

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

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

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

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

    if -8.2000000000000007e29 < y < -4.00000000000000027e-63 or 2.59999999999999989e-166 < y < 4.89999999999999988e-60

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around inf 76.1%

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

    if -4.00000000000000027e-63 < y < -1.8e-67

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/100.0%

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

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

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

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

    if -1.8e-67 < y < 2.59999999999999989e-166

    1. Initial program 87.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/95.2%

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

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

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

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

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

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

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

    if 4.89999999999999988e-60 < y < 3.2e12

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in x around inf 68.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{+29}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-63}:\\ \;\;\;\;t \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-67}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-166}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-60}:\\ \;\;\;\;t \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 3200000000000:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \]

Alternative 3: 73.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \frac{x - y}{z}\\ t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -3.8 \cdot 10^{+33}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-147}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-166}:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{elif}\;y \leq 0.0046:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+17}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (/ (- x y) z))) (t_2 (* t (- 1.0 (/ x y)))))
   (if (<= y -3.8e+33)
     t_2
     (if (<= y -2.1e-147)
       t_1
       (if (<= y 1.25e-166)
         (/ (* x t) (- z y))
         (if (<= y 0.0046)
           t_1
           (if (<= y 9.5e+17) (* t (/ x (- z y))) t_2)))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * ((x - y) / z);
	double t_2 = t * (1.0 - (x / y));
	double tmp;
	if (y <= -3.8e+33) {
		tmp = t_2;
	} else if (y <= -2.1e-147) {
		tmp = t_1;
	} else if (y <= 1.25e-166) {
		tmp = (x * t) / (z - y);
	} else if (y <= 0.0046) {
		tmp = t_1;
	} else if (y <= 9.5e+17) {
		tmp = t * (x / (z - y));
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = t * ((x - y) / z)
    t_2 = t * (1.0d0 - (x / y))
    if (y <= (-3.8d+33)) then
        tmp = t_2
    else if (y <= (-2.1d-147)) then
        tmp = t_1
    else if (y <= 1.25d-166) then
        tmp = (x * t) / (z - y)
    else if (y <= 0.0046d0) then
        tmp = t_1
    else if (y <= 9.5d+17) then
        tmp = t * (x / (z - y))
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = t * ((x - y) / z);
	double t_2 = t * (1.0 - (x / y));
	double tmp;
	if (y <= -3.8e+33) {
		tmp = t_2;
	} else if (y <= -2.1e-147) {
		tmp = t_1;
	} else if (y <= 1.25e-166) {
		tmp = (x * t) / (z - y);
	} else if (y <= 0.0046) {
		tmp = t_1;
	} else if (y <= 9.5e+17) {
		tmp = t * (x / (z - y));
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * ((x - y) / z)
	t_2 = t * (1.0 - (x / y))
	tmp = 0
	if y <= -3.8e+33:
		tmp = t_2
	elif y <= -2.1e-147:
		tmp = t_1
	elif y <= 1.25e-166:
		tmp = (x * t) / (z - y)
	elif y <= 0.0046:
		tmp = t_1
	elif y <= 9.5e+17:
		tmp = t * (x / (z - y))
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(Float64(x - y) / z))
	t_2 = Float64(t * Float64(1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -3.8e+33)
		tmp = t_2;
	elseif (y <= -2.1e-147)
		tmp = t_1;
	elseif (y <= 1.25e-166)
		tmp = Float64(Float64(x * t) / Float64(z - y));
	elseif (y <= 0.0046)
		tmp = t_1;
	elseif (y <= 9.5e+17)
		tmp = Float64(t * Float64(x / Float64(z - y)));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * ((x - y) / z);
	t_2 = t * (1.0 - (x / y));
	tmp = 0.0;
	if (y <= -3.8e+33)
		tmp = t_2;
	elseif (y <= -2.1e-147)
		tmp = t_1;
	elseif (y <= 1.25e-166)
		tmp = (x * t) / (z - y);
	elseif (y <= 0.0046)
		tmp = t_1;
	elseif (y <= 9.5e+17)
		tmp = t * (x / (z - y));
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.8e+33], t$95$2, If[LessEqual[y, -2.1e-147], t$95$1, If[LessEqual[y, 1.25e-166], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.0046], t$95$1, If[LessEqual[y, 9.5e+17], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.1 \cdot 10^{-147}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 0.0046:\\
\;\;\;\;t_1\\

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

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.80000000000000002e33 or 9.5e17 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around 0 80.4%

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

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

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

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

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

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

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

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

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

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

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

    if -3.80000000000000002e33 < y < -2.1e-147 or 1.25e-166 < y < 0.0045999999999999999

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around inf 72.0%

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

    if -2.1e-147 < y < 1.25e-166

    1. Initial program 85.1%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/97.3%

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

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

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

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

    if 0.0045999999999999999 < y < 9.5e17

    1. Initial program 100.0%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in x around inf 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+33}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-147}:\\ \;\;\;\;t \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-166}:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{elif}\;y \leq 0.0046:\\ \;\;\;\;t \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 9.5 \cdot 10^{+17}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \]

Alternative 4: 73.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -9.5 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-147}:\\ \;\;\;\;t \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-37}:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+61}:\\ \;\;\;\;\frac{-y}{\frac{z - y}{t}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- 1.0 (/ x y)))))
   (if (<= y -9.5e+30)
     t_1
     (if (<= y -2.1e-147)
       (* t (/ (- x y) z))
       (if (<= y 2.9e-37)
         (/ (* x t) (- z y))
         (if (<= y 1.2e+61) (/ (- y) (/ (- z y) t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (1.0 - (x / y));
	double tmp;
	if (y <= -9.5e+30) {
		tmp = t_1;
	} else if (y <= -2.1e-147) {
		tmp = t * ((x - y) / z);
	} else if (y <= 2.9e-37) {
		tmp = (x * t) / (z - y);
	} else if (y <= 1.2e+61) {
		tmp = -y / ((z - 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 = t * (1.0d0 - (x / y))
    if (y <= (-9.5d+30)) then
        tmp = t_1
    else if (y <= (-2.1d-147)) then
        tmp = t * ((x - y) / z)
    else if (y <= 2.9d-37) then
        tmp = (x * t) / (z - y)
    else if (y <= 1.2d+61) then
        tmp = -y / ((z - 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 = t * (1.0 - (x / y));
	double tmp;
	if (y <= -9.5e+30) {
		tmp = t_1;
	} else if (y <= -2.1e-147) {
		tmp = t * ((x - y) / z);
	} else if (y <= 2.9e-37) {
		tmp = (x * t) / (z - y);
	} else if (y <= 1.2e+61) {
		tmp = -y / ((z - y) / t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (1.0 - (x / y))
	tmp = 0
	if y <= -9.5e+30:
		tmp = t_1
	elif y <= -2.1e-147:
		tmp = t * ((x - y) / z)
	elif y <= 2.9e-37:
		tmp = (x * t) / (z - y)
	elif y <= 1.2e+61:
		tmp = -y / ((z - y) / t)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(1.0 - Float64(x / y)))
	tmp = 0.0
	if (y <= -9.5e+30)
		tmp = t_1;
	elseif (y <= -2.1e-147)
		tmp = Float64(t * Float64(Float64(x - y) / z));
	elseif (y <= 2.9e-37)
		tmp = Float64(Float64(x * t) / Float64(z - y));
	elseif (y <= 1.2e+61)
		tmp = Float64(Float64(-y) / Float64(Float64(z - y) / t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (1.0 - (x / y));
	tmp = 0.0;
	if (y <= -9.5e+30)
		tmp = t_1;
	elseif (y <= -2.1e-147)
		tmp = t * ((x - y) / z);
	elseif (y <= 2.9e-37)
		tmp = (x * t) / (z - y);
	elseif (y <= 1.2e+61)
		tmp = -y / ((z - y) / t);
	else
		tmp = t_1;
	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[y, -9.5e+30], t$95$1, If[LessEqual[y, -2.1e-147], N[(t * N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e-37], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+61], N[((-y) / N[(N[(z - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -9.5000000000000003e30 or 1.1999999999999999e61 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around 0 83.9%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000003e30 < y < -2.1e-147

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around inf 72.7%

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

    if -2.1e-147 < y < 2.90000000000000005e-37

    1. Initial program 90.0%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/95.0%

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

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

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

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

    if 2.90000000000000005e-37 < y < 1.1999999999999999e61

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/96.2%

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot t}{z - y}} \]
    5. Step-by-step derivation
      1. mul-1-neg76.8%

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

        \[\leadsto -\color{blue}{\frac{y}{\frac{z - y}{t}}} \]
    6. Simplified73.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+30}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-147}:\\ \;\;\;\;t \cdot \frac{x - y}{z}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-37}:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+61}:\\ \;\;\;\;\frac{-y}{\frac{z - y}{t}}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \]

Alternative 5: 64.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-36}:\\
\;\;\;\;t\\

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

\mathbf{elif}\;y \leq 4.4 \cdot 10^{+56}:\\
\;\;\;\;t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -7.9999999999999995e-36 or 1.45e22 < y < 4.40000000000000032e56 or 2.29999999999999985e124 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/75.2%

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

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

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

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

    if -7.9999999999999995e-36 < y < 1.45e22

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

    if 4.40000000000000032e56 < y < 2.29999999999999985e124

    1. Initial program 99.6%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in x around 0 63.7%

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

        \[\leadsto \color{blue}{\left(-\frac{y}{z - y}\right)} \cdot t \]
      2. distribute-neg-frac63.7%

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

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

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{y}{z}\right)} \cdot t \]
    6. Step-by-step derivation
      1. neg-mul-143.7%

        \[\leadsto \color{blue}{\left(-\frac{y}{z}\right)} \cdot t \]
      2. distribute-neg-frac43.7%

        \[\leadsto \color{blue}{\frac{-y}{z}} \cdot t \]
    7. Simplified43.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{-36}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{+22}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{+56}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+124}:\\ \;\;\;\;t \cdot \frac{-y}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]

Alternative 6: 88.8% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.89999999999999999e83 or 2.29999999999999985e124 < y

    1. Initial program 99.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around 0 89.9%

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

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

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

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

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

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

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

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

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

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

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

    if -2.89999999999999999e83 < y < 2.29999999999999985e124

    1. Initial program 94.7%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/94.1%

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

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

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

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

Alternative 7: 73.5% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+68}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \frac{-y}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= x -9.5e+68)
   (* x (/ t (- z y)))
   (if (<= x 3.2e-30) (* t (/ (- y) (- z y))) (* t (/ x (- z y))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -9.5e+68) {
		tmp = x * (t / (z - y));
	} else if (x <= 3.2e-30) {
		tmp = t * (-y / (z - y));
	} else {
		tmp = t * (x / (z - y));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if (x <= (-9.5d+68)) then
        tmp = x * (t / (z - y))
    else if (x <= 3.2d-30) then
        tmp = t * (-y / (z - y))
    else
        tmp = t * (x / (z - y))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (x <= -9.5e+68) {
		tmp = x * (t / (z - y));
	} else if (x <= 3.2e-30) {
		tmp = t * (-y / (z - y));
	} else {
		tmp = t * (x / (z - y));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if x <= -9.5e+68:
		tmp = x * (t / (z - y))
	elif x <= 3.2e-30:
		tmp = t * (-y / (z - y))
	else:
		tmp = t * (x / (z - y))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (x <= -9.5e+68)
		tmp = Float64(x * Float64(t / Float64(z - y)));
	elseif (x <= 3.2e-30)
		tmp = Float64(t * Float64(Float64(-y) / Float64(z - y)));
	else
		tmp = Float64(t * Float64(x / Float64(z - y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (x <= -9.5e+68)
		tmp = x * (t / (z - y));
	elseif (x <= 3.2e-30)
		tmp = t * (-y / (z - y));
	else
		tmp = t * (x / (z - y));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e+68], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.2e-30], N[(t * N[((-y) / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -9.50000000000000069e68

    1. Initial program 91.7%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/84.1%

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

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

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

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

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

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

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

    if -9.50000000000000069e68 < x < 3.2e-30

    1. Initial program 96.4%

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

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

        \[\leadsto \color{blue}{\left(-\frac{y}{z - y}\right)} \cdot t \]
      2. distribute-neg-frac83.4%

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

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

    if 3.2e-30 < x

    1. Initial program 98.6%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in x around inf 76.4%

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

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

Alternative 8: 73.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-38} \lor \neg \left(y \leq 1.75 \cdot 10^{-37}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.89999999999999994e-38 or 1.7500000000000001e-37 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around 0 75.0%

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

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

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

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

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

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

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

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

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

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

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

    if -2.89999999999999994e-38 < y < 1.7500000000000001e-37

    1. Initial program 91.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/94.1%

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{t}{z - y}} \]
    6. Simplified79.0%

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

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

Alternative 9: 74.9% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.5000000000000003e29 or 5.4e20 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in z around 0 80.4%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000003e29 < y < 5.4e20

    1. Initial program 93.2%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in x around inf 73.3%

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

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

Alternative 10: 59.4% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{-36}:\\
\;\;\;\;t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.9999999999999995e-36 or 2.1e9 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/77.3%

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

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

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

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

    if -7.9999999999999995e-36 < y < 2.1e9

    1. Initial program 92.5%

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

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

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

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

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

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

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

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

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

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

Alternative 11: 61.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.45:\\
\;\;\;\;t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -0.450000000000000011 or 2.05e15 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/76.5%

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

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

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

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

    if -0.450000000000000011 < y < 2.05e15

    1. Initial program 92.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in y around 0 64.6%

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

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

Alternative 12: 61.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \cdot 10^{-8}:\\
\;\;\;\;t\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.39999999999999998e-8 or 3.8e14 < y

    1. Initial program 99.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/76.5%

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

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

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

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

    if -2.39999999999999998e-8 < y < 3.8e14

    1. Initial program 92.8%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Step-by-step derivation
      1. associate-*l/94.9%

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

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

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

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

        \[\leadsto \color{blue}{\frac{t}{\frac{z}{x}}} \]
    6. Simplified64.8%

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

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

Alternative 13: 34.3% 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 96.4%

    \[\frac{x - y}{z - y} \cdot t \]
  2. Step-by-step derivation
    1. associate-*l/85.4%

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

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

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

    \[\leadsto \color{blue}{t} \]
  5. Final simplification38.2%

    \[\leadsto t \]

Developer target: 96.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{t}{\frac{z - y}{x - y}} \end{array} \]
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
	return t / ((z - y) / (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 - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
	return t / ((z - y) / (x - y));
}
def code(x, y, z, t):
	return t / ((z - y) / (x - y))
function code(x, y, z, t)
	return Float64(t / Float64(Float64(z - y) / Float64(x - y)))
end
function tmp = code(x, y, z, t)
	tmp = t / ((z - y) / (x - y));
end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}

Reproduce

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

  :herbie-target
  (/ t (/ (- z y) (- x y)))

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