Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 7.2s
Alternatives: 13
Speedup: 1.0×

Specification

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

\\
x + \left(y - z\right) \cdot \left(t - x\right)
\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: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.5× speedup?

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

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

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Step-by-step derivation
    1. flip--76.5%

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

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

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

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

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

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

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

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

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

Alternative 2: 37.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;y \leq -3.4 \cdot 10^{+56}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq -20.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-87}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-192}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-194}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-76}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-21}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- z))))
   (if (<= y -3.4e+56)
     (* t y)
     (if (<= y -20.5)
       t_1
       (if (<= y -1.1e-87)
         (* t y)
         (if (<= y -1.8e-192)
           x
           (if (<= y 4e-194)
             t_1
             (if (<= y 5.5e-76) x (if (<= y 5e-21) t_1 (* x (- y)))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * -z;
	double tmp;
	if (y <= -3.4e+56) {
		tmp = t * y;
	} else if (y <= -20.5) {
		tmp = t_1;
	} else if (y <= -1.1e-87) {
		tmp = t * y;
	} else if (y <= -1.8e-192) {
		tmp = x;
	} else if (y <= 4e-194) {
		tmp = t_1;
	} else if (y <= 5.5e-76) {
		tmp = x;
	} else if (y <= 5e-21) {
		tmp = t_1;
	} else {
		tmp = x * -y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = t * -z
    if (y <= (-3.4d+56)) then
        tmp = t * y
    else if (y <= (-20.5d0)) then
        tmp = t_1
    else if (y <= (-1.1d-87)) then
        tmp = t * y
    else if (y <= (-1.8d-192)) then
        tmp = x
    else if (y <= 4d-194) then
        tmp = t_1
    else if (y <= 5.5d-76) then
        tmp = x
    else if (y <= 5d-21) then
        tmp = t_1
    else
        tmp = x * -y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = t * -z;
	double tmp;
	if (y <= -3.4e+56) {
		tmp = t * y;
	} else if (y <= -20.5) {
		tmp = t_1;
	} else if (y <= -1.1e-87) {
		tmp = t * y;
	} else if (y <= -1.8e-192) {
		tmp = x;
	} else if (y <= 4e-194) {
		tmp = t_1;
	} else if (y <= 5.5e-76) {
		tmp = x;
	} else if (y <= 5e-21) {
		tmp = t_1;
	} else {
		tmp = x * -y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * -z
	tmp = 0
	if y <= -3.4e+56:
		tmp = t * y
	elif y <= -20.5:
		tmp = t_1
	elif y <= -1.1e-87:
		tmp = t * y
	elif y <= -1.8e-192:
		tmp = x
	elif y <= 4e-194:
		tmp = t_1
	elif y <= 5.5e-76:
		tmp = x
	elif y <= 5e-21:
		tmp = t_1
	else:
		tmp = x * -y
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(-z))
	tmp = 0.0
	if (y <= -3.4e+56)
		tmp = Float64(t * y);
	elseif (y <= -20.5)
		tmp = t_1;
	elseif (y <= -1.1e-87)
		tmp = Float64(t * y);
	elseif (y <= -1.8e-192)
		tmp = x;
	elseif (y <= 4e-194)
		tmp = t_1;
	elseif (y <= 5.5e-76)
		tmp = x;
	elseif (y <= 5e-21)
		tmp = t_1;
	else
		tmp = Float64(x * Float64(-y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * -z;
	tmp = 0.0;
	if (y <= -3.4e+56)
		tmp = t * y;
	elseif (y <= -20.5)
		tmp = t_1;
	elseif (y <= -1.1e-87)
		tmp = t * y;
	elseif (y <= -1.8e-192)
		tmp = x;
	elseif (y <= 4e-194)
		tmp = t_1;
	elseif (y <= 5.5e-76)
		tmp = x;
	elseif (y <= 5e-21)
		tmp = t_1;
	else
		tmp = x * -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[y, -3.4e+56], N[(t * y), $MachinePrecision], If[LessEqual[y, -20.5], t$95$1, If[LessEqual[y, -1.1e-87], N[(t * y), $MachinePrecision], If[LessEqual[y, -1.8e-192], x, If[LessEqual[y, 4e-194], t$95$1, If[LessEqual[y, 5.5e-76], x, If[LessEqual[y, 5e-21], t$95$1, N[(x * (-y)), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;y \leq -3.4 \cdot 10^{+56}:\\
\;\;\;\;t \cdot y\\

\mathbf{elif}\;y \leq -20.5:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-87}:\\
\;\;\;\;t \cdot y\\

\mathbf{elif}\;y \leq -1.8 \cdot 10^{-192}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;y \leq 5.5 \cdot 10^{-76}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 5 \cdot 10^{-21}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -3.40000000000000001e56 or -20.5 < y < -1.09999999999999994e-87

    1. Initial program 100.0%

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

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

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

    if -3.40000000000000001e56 < y < -20.5 or -1.7999999999999999e-192 < y < 4.00000000000000007e-194 or 5.50000000000000014e-76 < y < 4.99999999999999973e-21

    1. Initial program 100.0%

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(t \cdot z\right)} \]
    4. Step-by-step derivation
      1. associate-*r*54.8%

        \[\leadsto \color{blue}{\left(-1 \cdot t\right) \cdot z} \]
      2. mul-1-neg54.8%

        \[\leadsto \color{blue}{\left(-t\right)} \cdot z \]
    5. Simplified54.8%

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

    if -1.09999999999999994e-87 < y < -1.7999999999999999e-192 or 4.00000000000000007e-194 < y < 5.50000000000000014e-76

    1. Initial program 100.0%

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

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

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

    if 4.99999999999999973e-21 < y

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in47.4%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg47.4%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg47.4%

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

      \[\leadsto \color{blue}{x - y \cdot x} \]
    8. Taylor expanded in y around inf 44.8%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg44.8%

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-out44.8%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified44.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{+56}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq -20.5:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-87}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq -1.8 \cdot 10^{-192}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-194}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-76}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-21}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]

Alternative 3: 61.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ t_2 := x + x \cdot z\\ \mathbf{if}\;t \leq -6.8 \cdot 10^{-101}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.7 \cdot 10^{-189}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -7.1 \cdot 10^{-205}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-110}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- y z))) (t_2 (+ x (* x z))))
   (if (<= t -6.8e-101)
     t_1
     (if (<= t -1.7e-189)
       t_2
       (if (<= t -7.1e-205) (* x (- y)) (if (<= t 5.1e-110) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (y - z);
	double t_2 = x + (x * z);
	double tmp;
	if (t <= -6.8e-101) {
		tmp = t_1;
	} else if (t <= -1.7e-189) {
		tmp = t_2;
	} else if (t <= -7.1e-205) {
		tmp = x * -y;
	} else if (t <= 5.1e-110) {
		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 = t * (y - z)
    t_2 = x + (x * z)
    if (t <= (-6.8d-101)) then
        tmp = t_1
    else if (t <= (-1.7d-189)) then
        tmp = t_2
    else if (t <= (-7.1d-205)) then
        tmp = x * -y
    else if (t <= 5.1d-110) 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 = t * (y - z);
	double t_2 = x + (x * z);
	double tmp;
	if (t <= -6.8e-101) {
		tmp = t_1;
	} else if (t <= -1.7e-189) {
		tmp = t_2;
	} else if (t <= -7.1e-205) {
		tmp = x * -y;
	} else if (t <= 5.1e-110) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (y - z)
	t_2 = x + (x * z)
	tmp = 0
	if t <= -6.8e-101:
		tmp = t_1
	elif t <= -1.7e-189:
		tmp = t_2
	elif t <= -7.1e-205:
		tmp = x * -y
	elif t <= 5.1e-110:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y - z))
	t_2 = Float64(x + Float64(x * z))
	tmp = 0.0
	if (t <= -6.8e-101)
		tmp = t_1;
	elseif (t <= -1.7e-189)
		tmp = t_2;
	elseif (t <= -7.1e-205)
		tmp = Float64(x * Float64(-y));
	elseif (t <= 5.1e-110)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y - z);
	t_2 = x + (x * z);
	tmp = 0.0;
	if (t <= -6.8e-101)
		tmp = t_1;
	elseif (t <= -1.7e-189)
		tmp = t_2;
	elseif (t <= -7.1e-205)
		tmp = x * -y;
	elseif (t <= 5.1e-110)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.8e-101], t$95$1, If[LessEqual[t, -1.7e-189], t$95$2, If[LessEqual[t, -7.1e-205], N[(x * (-y)), $MachinePrecision], If[LessEqual[t, 5.1e-110], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -1.7 \cdot 10^{-189}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq -7.1 \cdot 10^{-205}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;t \leq 5.1 \cdot 10^{-110}:\\
\;\;\;\;t_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -6.79999999999999978e-101 or 5.1000000000000002e-110 < t

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot z + y\right)} \]
    5. Step-by-step derivation
      1. +-commutative72.2%

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

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

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

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

    if -6.79999999999999978e-101 < t < -1.7000000000000001e-189 or -7.1000000000000003e-205 < t < 5.1000000000000002e-110

    1. Initial program 99.9%

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

      \[\leadsto x + \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg60.8%

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-lft-neg-out60.8%

        \[\leadsto x + \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
      3. *-commutative60.8%

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(-z\right)} \]
    4. Simplified60.8%

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

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

    if -1.7000000000000001e-189 < t < -7.1000000000000003e-205

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in90.6%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg90.6%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg90.6%

        \[\leadsto \color{blue}{x - y \cdot x} \]
    7. Simplified90.6%

      \[\leadsto \color{blue}{x - y \cdot x} \]
    8. Taylor expanded in y around inf 90.6%

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-out90.6%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified90.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.8 \cdot 10^{-101}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{elif}\;t \leq -1.7 \cdot 10^{-189}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;t \leq -7.1 \cdot 10^{-205}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-110}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \end{array} \]

Alternative 4: 60.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ \mathbf{if}\;t \leq -9 \cdot 10^{-99}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.4 \cdot 10^{-189}:\\ \;\;\;\;x + t \cdot y\\ \mathbf{elif}\;t \leq -3.75 \cdot 10^{-205}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 6.4 \cdot 10^{-108}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- y z))))
   (if (<= t -9e-99)
     t_1
     (if (<= t -2.4e-189)
       (+ x (* t y))
       (if (<= t -3.75e-205)
         (* x (- y))
         (if (<= t 6.4e-108) (+ x (* x z)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (y - z);
	double tmp;
	if (t <= -9e-99) {
		tmp = t_1;
	} else if (t <= -2.4e-189) {
		tmp = x + (t * y);
	} else if (t <= -3.75e-205) {
		tmp = x * -y;
	} else if (t <= 6.4e-108) {
		tmp = x + (x * z);
	} 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 * (y - z)
    if (t <= (-9d-99)) then
        tmp = t_1
    else if (t <= (-2.4d-189)) then
        tmp = x + (t * y)
    else if (t <= (-3.75d-205)) then
        tmp = x * -y
    else if (t <= 6.4d-108) then
        tmp = x + (x * z)
    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 * (y - z);
	double tmp;
	if (t <= -9e-99) {
		tmp = t_1;
	} else if (t <= -2.4e-189) {
		tmp = x + (t * y);
	} else if (t <= -3.75e-205) {
		tmp = x * -y;
	} else if (t <= 6.4e-108) {
		tmp = x + (x * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (y - z)
	tmp = 0
	if t <= -9e-99:
		tmp = t_1
	elif t <= -2.4e-189:
		tmp = x + (t * y)
	elif t <= -3.75e-205:
		tmp = x * -y
	elif t <= 6.4e-108:
		tmp = x + (x * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y - z))
	tmp = 0.0
	if (t <= -9e-99)
		tmp = t_1;
	elseif (t <= -2.4e-189)
		tmp = Float64(x + Float64(t * y));
	elseif (t <= -3.75e-205)
		tmp = Float64(x * Float64(-y));
	elseif (t <= 6.4e-108)
		tmp = Float64(x + Float64(x * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y - z);
	tmp = 0.0;
	if (t <= -9e-99)
		tmp = t_1;
	elseif (t <= -2.4e-189)
		tmp = x + (t * y);
	elseif (t <= -3.75e-205)
		tmp = x * -y;
	elseif (t <= 6.4e-108)
		tmp = x + (x * z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -9e-99], t$95$1, If[LessEqual[t, -2.4e-189], N[(x + N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.75e-205], N[(x * (-y)), $MachinePrecision], If[LessEqual[t, 6.4e-108], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t \cdot \left(y - z\right)\\
\mathbf{if}\;t \leq -9 \cdot 10^{-99}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -2.4 \cdot 10^{-189}:\\
\;\;\;\;x + t \cdot y\\

\mathbf{elif}\;t \leq -3.75 \cdot 10^{-205}:\\
\;\;\;\;x \cdot \left(-y\right)\\

\mathbf{elif}\;t \leq 6.4 \cdot 10^{-108}:\\
\;\;\;\;x + x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -9.0000000000000006e-99 or 6.3999999999999999e-108 < t

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot z + y\right)} \]
    5. Step-by-step derivation
      1. +-commutative72.2%

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

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

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

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

    if -9.0000000000000006e-99 < t < -2.3999999999999998e-189

    1. Initial program 100.0%

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

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

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

    if -2.3999999999999998e-189 < t < -3.7499999999999998e-205

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in90.6%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg90.6%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg90.6%

        \[\leadsto \color{blue}{x - y \cdot x} \]
    7. Simplified90.6%

      \[\leadsto \color{blue}{x - y \cdot x} \]
    8. Taylor expanded in y around inf 90.6%

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-out90.6%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified90.6%

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

    if -3.7499999999999998e-205 < t < 6.3999999999999999e-108

    1. Initial program 99.9%

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

      \[\leadsto x + \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg58.8%

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-lft-neg-out58.8%

        \[\leadsto x + \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
      3. *-commutative58.8%

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(-z\right)} \]
    4. Simplified58.8%

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

      \[\leadsto x + \color{blue}{z \cdot x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification68.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -9 \cdot 10^{-99}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{elif}\;t \leq -2.4 \cdot 10^{-189}:\\ \;\;\;\;x + t \cdot y\\ \mathbf{elif}\;t \leq -3.75 \cdot 10^{-205}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{elif}\;t \leq 6.4 \cdot 10^{-108}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \end{array} \]

Alternative 5: 70.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \left(y - z\right)\\ \mathbf{if}\;t \leq -1.4 \cdot 10^{-187}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.1 \cdot 10^{-233}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-108}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* t (- y z)))))
   (if (<= t -1.4e-187)
     t_1
     (if (<= t 1.1e-233)
       (- x (* x y))
       (if (<= t 5.8e-108) (+ x (* x z)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (t * (y - z));
	double tmp;
	if (t <= -1.4e-187) {
		tmp = t_1;
	} else if (t <= 1.1e-233) {
		tmp = x - (x * y);
	} else if (t <= 5.8e-108) {
		tmp = x + (x * z);
	} 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 + (t * (y - z))
    if (t <= (-1.4d-187)) then
        tmp = t_1
    else if (t <= 1.1d-233) then
        tmp = x - (x * y)
    else if (t <= 5.8d-108) then
        tmp = x + (x * z)
    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 + (t * (y - z));
	double tmp;
	if (t <= -1.4e-187) {
		tmp = t_1;
	} else if (t <= 1.1e-233) {
		tmp = x - (x * y);
	} else if (t <= 5.8e-108) {
		tmp = x + (x * z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (t * (y - z))
	tmp = 0
	if t <= -1.4e-187:
		tmp = t_1
	elif t <= 1.1e-233:
		tmp = x - (x * y)
	elif t <= 5.8e-108:
		tmp = x + (x * z)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(t * Float64(y - z)))
	tmp = 0.0
	if (t <= -1.4e-187)
		tmp = t_1;
	elseif (t <= 1.1e-233)
		tmp = Float64(x - Float64(x * y));
	elseif (t <= 5.8e-108)
		tmp = Float64(x + Float64(x * z));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (t * (y - z));
	tmp = 0.0;
	if (t <= -1.4e-187)
		tmp = t_1;
	elseif (t <= 1.1e-233)
		tmp = x - (x * y);
	elseif (t <= 5.8e-108)
		tmp = x + (x * z);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.4e-187], t$95$1, If[LessEqual[t, 1.1e-233], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.8e-108], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 1.1 \cdot 10^{-233}:\\
\;\;\;\;x - x \cdot y\\

\mathbf{elif}\;t \leq 5.8 \cdot 10^{-108}:\\
\;\;\;\;x + x \cdot z\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -1.4e-187 or 5.8000000000000002e-108 < t

    1. Initial program 100.0%

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

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

    if -1.4e-187 < t < 1.1e-233

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in69.6%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg69.6%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg69.6%

        \[\leadsto \color{blue}{x - y \cdot x} \]
    7. Simplified69.6%

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

    if 1.1e-233 < t < 5.8000000000000002e-108

    1. Initial program 99.9%

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

      \[\leadsto x + \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg69.1%

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-lft-neg-out69.1%

        \[\leadsto x + \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
      3. *-commutative69.1%

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

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

      \[\leadsto x + \color{blue}{z \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.4 \cdot 10^{-187}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;t \leq 1.1 \cdot 10^{-233}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;t \leq 5.8 \cdot 10^{-108}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \end{array} \]

Alternative 6: 71.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + t \cdot \left(y - z\right)\\ \mathbf{if}\;t \leq -2.1 \cdot 10^{-187}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-234}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-82}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* t (- y z)))))
   (if (<= t -2.1e-187)
     t_1
     (if (<= t 9.5e-234)
       (- x (* x y))
       (if (<= t 3.4e-82) (+ x (* z (- x t))) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (t * (y - z));
	double tmp;
	if (t <= -2.1e-187) {
		tmp = t_1;
	} else if (t <= 9.5e-234) {
		tmp = x - (x * y);
	} else if (t <= 3.4e-82) {
		tmp = x + (z * (x - 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 + (t * (y - z))
    if (t <= (-2.1d-187)) then
        tmp = t_1
    else if (t <= 9.5d-234) then
        tmp = x - (x * y)
    else if (t <= 3.4d-82) then
        tmp = x + (z * (x - 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 + (t * (y - z));
	double tmp;
	if (t <= -2.1e-187) {
		tmp = t_1;
	} else if (t <= 9.5e-234) {
		tmp = x - (x * y);
	} else if (t <= 3.4e-82) {
		tmp = x + (z * (x - t));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (t * (y - z))
	tmp = 0
	if t <= -2.1e-187:
		tmp = t_1
	elif t <= 9.5e-234:
		tmp = x - (x * y)
	elif t <= 3.4e-82:
		tmp = x + (z * (x - t))
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(t * Float64(y - z)))
	tmp = 0.0
	if (t <= -2.1e-187)
		tmp = t_1;
	elseif (t <= 9.5e-234)
		tmp = Float64(x - Float64(x * y));
	elseif (t <= 3.4e-82)
		tmp = Float64(x + Float64(z * Float64(x - t)));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (t * (y - z));
	tmp = 0.0;
	if (t <= -2.1e-187)
		tmp = t_1;
	elseif (t <= 9.5e-234)
		tmp = x - (x * y);
	elseif (t <= 3.4e-82)
		tmp = x + (z * (x - t));
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.1e-187], t$95$1, If[LessEqual[t, 9.5e-234], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e-82], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq 9.5 \cdot 10^{-234}:\\
\;\;\;\;x - x \cdot y\\

\mathbf{elif}\;t \leq 3.4 \cdot 10^{-82}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.09999999999999992e-187 or 3.39999999999999975e-82 < t

    1. Initial program 100.0%

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

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

    if -2.09999999999999992e-187 < t < 9.4999999999999999e-234

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in69.6%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg69.6%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg69.6%

        \[\leadsto \color{blue}{x - y \cdot x} \]
    7. Simplified69.6%

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

    if 9.4999999999999999e-234 < t < 3.39999999999999975e-82

    1. Initial program 99.9%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Step-by-step derivation
      1. flip--86.9%

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

        \[\leadsto x + \color{blue}{\frac{\left(y - z\right) \cdot \left(t \cdot t - x \cdot x\right)}{t + x}} \]
    3. Applied egg-rr83.6%

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg68.9%

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-rgt-neg-in68.9%

        \[\leadsto x + \color{blue}{z \cdot \left(-\left(t - x\right)\right)} \]
      3. sub-neg68.9%

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

        \[\leadsto x + z \cdot \left(-\color{blue}{\left(\left(-x\right) + t\right)}\right) \]
      5. distribute-neg-in68.9%

        \[\leadsto x + z \cdot \color{blue}{\left(\left(-\left(-x\right)\right) + \left(-t\right)\right)} \]
      6. remove-double-neg68.9%

        \[\leadsto x + z \cdot \left(\color{blue}{x} + \left(-t\right)\right) \]
      7. sub-neg68.9%

        \[\leadsto x + z \cdot \color{blue}{\left(x - t\right)} \]
    8. Simplified68.9%

      \[\leadsto x + \color{blue}{z \cdot \left(x - t\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{-187}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-234}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;t \leq 3.4 \cdot 10^{-82}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \end{array} \]

Alternative 7: 53.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ \mathbf{if}\;t \leq -2.3 \cdot 10^{-146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-189}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-58}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- y z))))
   (if (<= t -2.3e-146)
     t_1
     (if (<= t -6e-189) x (if (<= t 2.9e-58) (* x (- y)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (y - z);
	double tmp;
	if (t <= -2.3e-146) {
		tmp = t_1;
	} else if (t <= -6e-189) {
		tmp = x;
	} else if (t <= 2.9e-58) {
		tmp = x * -y;
	} 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 * (y - z)
    if (t <= (-2.3d-146)) then
        tmp = t_1
    else if (t <= (-6d-189)) then
        tmp = x
    else if (t <= 2.9d-58) then
        tmp = x * -y
    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 * (y - z);
	double tmp;
	if (t <= -2.3e-146) {
		tmp = t_1;
	} else if (t <= -6e-189) {
		tmp = x;
	} else if (t <= 2.9e-58) {
		tmp = x * -y;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (y - z)
	tmp = 0
	if t <= -2.3e-146:
		tmp = t_1
	elif t <= -6e-189:
		tmp = x
	elif t <= 2.9e-58:
		tmp = x * -y
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y - z))
	tmp = 0.0
	if (t <= -2.3e-146)
		tmp = t_1;
	elseif (t <= -6e-189)
		tmp = x;
	elseif (t <= 2.9e-58)
		tmp = Float64(x * Float64(-y));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y - z);
	tmp = 0.0;
	if (t <= -2.3e-146)
		tmp = t_1;
	elseif (t <= -6e-189)
		tmp = x;
	elseif (t <= 2.9e-58)
		tmp = x * -y;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.3e-146], t$95$1, If[LessEqual[t, -6e-189], x, If[LessEqual[t, 2.9e-58], N[(x * (-y)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t \cdot \left(y - z\right)\\
\mathbf{if}\;t \leq -2.3 \cdot 10^{-146}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -6 \cdot 10^{-189}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq 2.9 \cdot 10^{-58}:\\
\;\;\;\;x \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -2.3000000000000001e-146 or 2.8999999999999999e-58 < t

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot z + y\right)} \]
    5. Step-by-step derivation
      1. +-commutative72.9%

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

        \[\leadsto t \cdot \left(y + \color{blue}{\left(-z\right)}\right) \]
      3. unsub-neg72.9%

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

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

    if -2.3000000000000001e-146 < t < -6e-189

    1. Initial program 100.0%

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

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

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

    if -6e-189 < t < 2.8999999999999999e-58

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in57.6%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg57.6%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg57.6%

        \[\leadsto \color{blue}{x - y \cdot x} \]
    7. Simplified57.6%

      \[\leadsto \color{blue}{x - y \cdot x} \]
    8. Taylor expanded in y around inf 39.9%

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

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-out39.9%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified39.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.3 \cdot 10^{-146}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{elif}\;t \leq -6 \cdot 10^{-189}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-58}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \end{array} \]

Alternative 8: 84.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+60} \lor \neg \left(y \leq 1.02 \cdot 10^{-8}\right):\\
\;\;\;\;x + \left(t - x\right) \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.90000000000000005e60 or 1.02000000000000003e-8 < y

    1. Initial program 100.0%

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

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

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

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

    if -1.90000000000000005e60 < y < 1.02000000000000003e-8

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Step-by-step derivation
      1. flip--72.7%

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

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

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    7. Step-by-step derivation
      1. mul-1-neg88.7%

        \[\leadsto x + \color{blue}{\left(-z \cdot \left(t - x\right)\right)} \]
      2. distribute-rgt-neg-in88.7%

        \[\leadsto x + \color{blue}{z \cdot \left(-\left(t - x\right)\right)} \]
      3. sub-neg88.7%

        \[\leadsto x + z \cdot \left(-\color{blue}{\left(t + \left(-x\right)\right)}\right) \]
      4. +-commutative88.7%

        \[\leadsto x + z \cdot \left(-\color{blue}{\left(\left(-x\right) + t\right)}\right) \]
      5. distribute-neg-in88.7%

        \[\leadsto x + z \cdot \color{blue}{\left(\left(-\left(-x\right)\right) + \left(-t\right)\right)} \]
      6. remove-double-neg88.7%

        \[\leadsto x + z \cdot \left(\color{blue}{x} + \left(-t\right)\right) \]
      7. sub-neg88.7%

        \[\leadsto x + z \cdot \color{blue}{\left(x - t\right)} \]
    8. Simplified88.7%

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

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

Alternative 9: 62.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1:\\
\;\;\;\;x - x \cdot y\\

\mathbf{elif}\;x \leq 5.8 \cdot 10^{+108}:\\
\;\;\;\;t \cdot \left(y - z\right)\\

\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\


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

    1. Initial program 100.0%

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + -1 \cdot y\right) \cdot x} \]
    6. Step-by-step derivation
      1. +-commutative63.2%

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in63.2%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg63.2%

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

        \[\leadsto \color{blue}{x - y \cdot x} \]
    7. Simplified63.2%

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

    if -3.10000000000000009 < x < 5.80000000000000015e108

    1. Initial program 100.0%

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

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

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

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot z + y\right)} \]
    5. Step-by-step derivation
      1. +-commutative71.6%

        \[\leadsto t \cdot \color{blue}{\left(y + -1 \cdot z\right)} \]
      2. mul-1-neg71.6%

        \[\leadsto t \cdot \left(y + \color{blue}{\left(-z\right)}\right) \]
      3. unsub-neg71.6%

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

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

    if 5.80000000000000015e108 < x

    1. Initial program 100.0%

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

      \[\leadsto x + \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right)} \]
    3. Step-by-step derivation
      1. mul-1-neg70.0%

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

        \[\leadsto x + \color{blue}{\left(-z\right) \cdot \left(t - x\right)} \]
      3. *-commutative70.0%

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

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

      \[\leadsto x + \color{blue}{z \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.1:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;x \leq 5.8 \cdot 10^{+108}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot z\\ \end{array} \]

Alternative 10: 100.0% accurate, 1.0× speedup?

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

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

    \[x + \left(y - z\right) \cdot \left(t - x\right) \]
  2. Final simplification100.0%

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

Alternative 11: 37.3% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;y \leq 5 \cdot 10^{-21}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.00000000000000033e-87

    1. Initial program 100.0%

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

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

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

    if -6.00000000000000033e-87 < y < 4.99999999999999973e-21

    1. Initial program 100.0%

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

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

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

    if 4.99999999999999973e-21 < y

    1. Initial program 100.0%

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

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

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

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

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

        \[\leadsto \color{blue}{\left(-1 \cdot y + 1\right)} \cdot x \]
      2. distribute-rgt1-in47.4%

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

        \[\leadsto x + \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
      4. mul-1-neg47.4%

        \[\leadsto x + \color{blue}{\left(-y \cdot x\right)} \]
      5. unsub-neg47.4%

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

      \[\leadsto \color{blue}{x - y \cdot x} \]
    8. Taylor expanded in y around inf 44.8%

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot x\right)} \]
    9. Step-by-step derivation
      1. mul-1-neg44.8%

        \[\leadsto \color{blue}{-y \cdot x} \]
      2. distribute-rgt-neg-out44.8%

        \[\leadsto \color{blue}{y \cdot \left(-x\right)} \]
    10. Simplified44.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-87}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-21}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]

Alternative 12: 37.7% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;y \leq 3.8 \cdot 10^{-24}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.00000000000000033e-87 or 3.80000000000000026e-24 < y

    1. Initial program 100.0%

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

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

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

    if -6.00000000000000033e-87 < y < 3.80000000000000026e-24

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6 \cdot 10^{-87}:\\ \;\;\;\;t \cdot y\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t \cdot y\\ \end{array} \]

Alternative 13: 18.3% accurate, 9.0× speedup?

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

\\
x
\end{array}
Derivation
  1. Initial program 100.0%

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

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification16.2%

    \[\leadsto x \]

Developer target: 96.2% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2023253 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

  :herbie-target
  (+ x (+ (* t (- y z)) (* (- x) (- y z))))

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