Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 6.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, 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}
Derivation
  1. Initial program 100.0%

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

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

Alternative 2: 74.3% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x - t \cdot \left(z - y\right)\\ t_2 := x + y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -4.4 \cdot 10^{+101}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-174}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-199}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-242}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- x (* t (- z y)))) (t_2 (+ x (* y (- t x)))))
   (if (<= y -4.4e+101)
     t_2
     (if (<= y -2.2e-174)
       t_1
       (if (<= y -1.1e-199)
         (+ x (* x z))
         (if (<= y -3.6e-242)
           t_1
           (if (<= y -1.95e-275)
             (* x (+ z 1.0))
             (if (<= y 5.3e+133) t_1 t_2))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x - (t * (z - y));
	double t_2 = x + (y * (t - x));
	double tmp;
	if (y <= -4.4e+101) {
		tmp = t_2;
	} else if (y <= -2.2e-174) {
		tmp = t_1;
	} else if (y <= -1.1e-199) {
		tmp = x + (x * z);
	} else if (y <= -3.6e-242) {
		tmp = t_1;
	} else if (y <= -1.95e-275) {
		tmp = x * (z + 1.0);
	} else if (y <= 5.3e+133) {
		tmp = t_1;
	} 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 = x - (t * (z - y))
    t_2 = x + (y * (t - x))
    if (y <= (-4.4d+101)) then
        tmp = t_2
    else if (y <= (-2.2d-174)) then
        tmp = t_1
    else if (y <= (-1.1d-199)) then
        tmp = x + (x * z)
    else if (y <= (-3.6d-242)) then
        tmp = t_1
    else if (y <= (-1.95d-275)) then
        tmp = x * (z + 1.0d0)
    else if (y <= 5.3d+133) then
        tmp = t_1
    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 = x - (t * (z - y));
	double t_2 = x + (y * (t - x));
	double tmp;
	if (y <= -4.4e+101) {
		tmp = t_2;
	} else if (y <= -2.2e-174) {
		tmp = t_1;
	} else if (y <= -1.1e-199) {
		tmp = x + (x * z);
	} else if (y <= -3.6e-242) {
		tmp = t_1;
	} else if (y <= -1.95e-275) {
		tmp = x * (z + 1.0);
	} else if (y <= 5.3e+133) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x - (t * (z - y))
	t_2 = x + (y * (t - x))
	tmp = 0
	if y <= -4.4e+101:
		tmp = t_2
	elif y <= -2.2e-174:
		tmp = t_1
	elif y <= -1.1e-199:
		tmp = x + (x * z)
	elif y <= -3.6e-242:
		tmp = t_1
	elif y <= -1.95e-275:
		tmp = x * (z + 1.0)
	elif y <= 5.3e+133:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x - Float64(t * Float64(z - y)))
	t_2 = Float64(x + Float64(y * Float64(t - x)))
	tmp = 0.0
	if (y <= -4.4e+101)
		tmp = t_2;
	elseif (y <= -2.2e-174)
		tmp = t_1;
	elseif (y <= -1.1e-199)
		tmp = Float64(x + Float64(x * z));
	elseif (y <= -3.6e-242)
		tmp = t_1;
	elseif (y <= -1.95e-275)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (y <= 5.3e+133)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x - (t * (z - y));
	t_2 = x + (y * (t - x));
	tmp = 0.0;
	if (y <= -4.4e+101)
		tmp = t_2;
	elseif (y <= -2.2e-174)
		tmp = t_1;
	elseif (y <= -1.1e-199)
		tmp = x + (x * z);
	elseif (y <= -3.6e-242)
		tmp = t_1;
	elseif (y <= -1.95e-275)
		tmp = x * (z + 1.0);
	elseif (y <= 5.3e+133)
		tmp = t_1;
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.4e+101], t$95$2, If[LessEqual[y, -2.2e-174], t$95$1, If[LessEqual[y, -1.1e-199], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.6e-242], t$95$1, If[LessEqual[y, -1.95e-275], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.3e+133], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.2 \cdot 10^{-174}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.1 \cdot 10^{-199}:\\
\;\;\;\;x + x \cdot z\\

\mathbf{elif}\;y \leq -3.6 \cdot 10^{-242}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

\mathbf{elif}\;y \leq 5.3 \cdot 10^{+133}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -4.4000000000000001e101 or 5.29999999999999997e133 < y

    1. Initial program 100.0%

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

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

    if -4.4000000000000001e101 < y < -2.20000000000000022e-174 or -1.0999999999999999e-199 < y < -3.60000000000000014e-242 or -1.94999999999999986e-275 < y < 5.29999999999999997e133

    1. Initial program 100.0%

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

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

    if -2.20000000000000022e-174 < y < -1.0999999999999999e-199

    1. Initial program 100.0%

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

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)} \]
      2. flip--100.0%

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

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

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

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

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

        \[\leadsto x + \frac{t - x}{\color{blue}{\frac{\frac{y + z}{y + z}}{y - z}}} \]
      4. *-inverses99.7%

        \[\leadsto x + \frac{t - x}{\frac{\color{blue}{1}}{y - z}} \]
    5. Simplified99.7%

      \[\leadsto x + \color{blue}{\frac{t - x}{\frac{1}{y - z}}} \]
    6. Taylor expanded in y around 0 99.7%

      \[\leadsto x + \frac{t - x}{\color{blue}{\frac{-1}{z}}} \]
    7. Taylor expanded in t around 0 100.0%

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

    if -3.60000000000000014e-242 < y < -1.94999999999999986e-275

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{+101}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-174}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{-199}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq -3.6 \cdot 10^{-242}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+133}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 3: 37.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := -x \cdot y\\ \mathbf{if}\;y \leq -0.037:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-227}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 7:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (- (* x y))))
   (if (<= y -0.037)
     t_1
     (if (<= y -1.95e-227)
       x
       (if (<= y -1.95e-275) (* x z) (if (<= y 7.0) x t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = -(x * y);
	double tmp;
	if (y <= -0.037) {
		tmp = t_1;
	} else if (y <= -1.95e-227) {
		tmp = x;
	} else if (y <= -1.95e-275) {
		tmp = x * z;
	} else if (y <= 7.0) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = -(x * y)
    if (y <= (-0.037d0)) then
        tmp = t_1
    else if (y <= (-1.95d-227)) then
        tmp = x
    else if (y <= (-1.95d-275)) then
        tmp = x * z
    else if (y <= 7.0d0) then
        tmp = x
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = -(x * y);
	double tmp;
	if (y <= -0.037) {
		tmp = t_1;
	} else if (y <= -1.95e-227) {
		tmp = x;
	} else if (y <= -1.95e-275) {
		tmp = x * z;
	} else if (y <= 7.0) {
		tmp = x;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = -(x * y)
	tmp = 0
	if y <= -0.037:
		tmp = t_1
	elif y <= -1.95e-227:
		tmp = x
	elif y <= -1.95e-275:
		tmp = x * z
	elif y <= 7.0:
		tmp = x
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(-Float64(x * y))
	tmp = 0.0
	if (y <= -0.037)
		tmp = t_1;
	elseif (y <= -1.95e-227)
		tmp = x;
	elseif (y <= -1.95e-275)
		tmp = Float64(x * z);
	elseif (y <= 7.0)
		tmp = x;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = -(x * y);
	tmp = 0.0;
	if (y <= -0.037)
		tmp = t_1;
	elseif (y <= -1.95e-227)
		tmp = x;
	elseif (y <= -1.95e-275)
		tmp = x * z;
	elseif (y <= 7.0)
		tmp = x;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = (-N[(x * y), $MachinePrecision])}, If[LessEqual[y, -0.037], t$95$1, If[LessEqual[y, -1.95e-227], x, If[LessEqual[y, -1.95e-275], N[(x * z), $MachinePrecision], If[LessEqual[y, 7.0], x, t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := -x \cdot y\\
\mathbf{if}\;y \leq -0.037:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.95 \cdot 10^{-227}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\
\;\;\;\;x \cdot z\\

\mathbf{elif}\;y \leq 7:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -0.0369999999999999982 or 7 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg46.7%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--46.7%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity46.7%

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

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

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

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

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

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

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

    if -0.0369999999999999982 < y < -1.95e-227 or -1.94999999999999986e-275 < y < 7

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -1.95e-227 < y < -1.94999999999999986e-275

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg70.1%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--70.1%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity70.1%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.037:\\ \;\;\;\;-x \cdot y\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-227}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.95 \cdot 10^{-275}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;y \leq 7:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;-x \cdot y\\ \end{array} \]

Alternative 4: 81.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.32 \cdot 10^{+54} \lor \neg \left(x \leq 4.45 \cdot 10^{+55}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3200000000000001e54 or 4.4500000000000001e55 < x

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg90.7%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--90.7%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity90.7%

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

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

    if -1.3200000000000001e54 < x < 4.4500000000000001e55

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.32 \cdot 10^{+54} \lor \neg \left(x \leq 4.45 \cdot 10^{+55}\right):\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \end{array} \]

Alternative 5: 84.5% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.2e10 or 2e18 < y

    1. Initial program 100.0%

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

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

    if -6.2e10 < y < 2e18

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

Alternative 6: 68.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+244}:\\
\;\;\;\;x - x \cdot y\\

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

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg100.0%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--100.0%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity100.0%

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

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

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

    if -1.4500000000000001e244 < x < 1.30000000000000005e56

    1. Initial program 100.0%

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

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

    if 1.30000000000000005e56 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification76.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{+244}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;x \leq 1.3 \cdot 10^{+56}:\\ \;\;\;\;x - t \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]

Alternative 7: 50.7% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -130 \lor \neg \left(y \leq 130000000\right):\\
\;\;\;\;-x \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -130 or 1.3e8 < y

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg46.3%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--46.3%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity46.3%

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

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

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

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

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

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

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

    if -130 < y < 1.3e8

    1. Initial program 100.0%

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

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

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

        \[\leadsto x + \color{blue}{\left(-\left(t - x\right) \cdot z\right)} \]
      3. unsub-neg91.5%

        \[\leadsto \color{blue}{x - \left(t - x\right) \cdot z} \]
      4. *-commutative91.5%

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

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

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.9%

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

Alternative 8: 50.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+53} \lor \neg \left(x \leq 7.1 \cdot 10^{+55}\right):\\
\;\;\;\;x \cdot \left(z + 1\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.2000000000000004e53 or 7.1e55 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -4.2000000000000004e53 < x < 7.1e55

    1. Initial program 100.0%

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

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

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

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

Alternative 9: 50.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.05 \cdot 10^{+53}:\\
\;\;\;\;x + x \cdot z\\

\mathbf{elif}\;x \leq 1.76 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot t\\

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


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

    1. Initial program 100.0%

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

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)} \]
      2. flip--91.4%

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

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

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

        \[\leadsto x + \color{blue}{\frac{t - x}{\frac{y + z}{y \cdot y - z \cdot z}}} \]
      2. difference-of-squares93.7%

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

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

        \[\leadsto x + \frac{t - x}{\frac{\color{blue}{1}}{y - z}} \]
    5. Simplified99.9%

      \[\leadsto x + \color{blue}{\frac{t - x}{\frac{1}{y - z}}} \]
    6. Taylor expanded in y around 0 72.4%

      \[\leadsto x + \frac{t - x}{\color{blue}{\frac{-1}{z}}} \]
    7. Taylor expanded in t around 0 62.4%

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

    if -3.0500000000000001e53 < x < 1.75999999999999992e55

    1. Initial program 100.0%

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

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

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

    if 1.75999999999999992e55 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.05 \cdot 10^{+53}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;x \leq 1.76 \cdot 10^{+55}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]

Alternative 10: 51.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+38}:\\
\;\;\;\;x - x \cdot y\\

\mathbf{elif}\;x \leq 6.2 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot t\\

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


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

    1. Initial program 100.0%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg85.4%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--85.4%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity85.4%

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

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

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

    if -1.1500000000000001e38 < x < 6.19999999999999987e55

    1. Initial program 100.0%

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

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

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

    if 6.19999999999999987e55 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+38}:\\ \;\;\;\;x - x \cdot y\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{+55}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \end{array} \]

Alternative 11: 54.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+21}:\\
\;\;\;\;x \cdot z\\

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

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


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

    1. Initial program 99.9%

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

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

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

        \[\leadsto x \cdot \left(1 + \color{blue}{\left(-\left(y - z\right)\right)}\right) \]
      3. unsub-neg59.7%

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--59.7%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity59.7%

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

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

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

    if -1e21 < z < 2.2999999999999999e-9

    1. Initial program 100.0%

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

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

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

    if 2.2999999999999999e-9 < z

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto x - \color{blue}{t \cdot z} \]
    6. Step-by-step derivation
      1. *-commutative59.9%

        \[\leadsto x - \color{blue}{z \cdot t} \]
    7. Simplified59.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+21}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-9}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot t\\ \end{array} \]

Alternative 12: 37.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\

\mathbf{elif}\;z \leq 2.15 \cdot 10^{-21}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 2.1499999999999999e-21 < z

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(1 - \left(y - z\right)\right)} \]
      4. distribute-lft-out--44.2%

        \[\leadsto \color{blue}{x \cdot 1 - x \cdot \left(y - z\right)} \]
      5. *-rgt-identity44.2%

        \[\leadsto \color{blue}{x} - x \cdot \left(y - z\right) \]
    4. Simplified44.2%

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

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

    if -1 < z < 2.1499999999999999e-21

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t - x\right) \cdot z} \]
      4. *-commutative47.6%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 2.15 \cdot 10^{-21}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]

Alternative 13: 18.5% 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 y around 0 60.8%

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Final simplification20.7%

    \[\leadsto x \]

Developer target: 96.1% 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 2023215 
(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))))