Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 10.8s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 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. Add Preprocessing
  3. Final simplification100.0%

    \[\leadsto x + \left(y - z\right) \cdot \left(t - x\right) \]
  4. Add Preprocessing

Alternative 2: 35.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -8.2 \cdot 10^{-12}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-250}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-134} \lor \neg \left(z \leq 5.2 \cdot 10^{-18}\right) \land z \leq 3.8 \cdot 10^{+138}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- z))))
   (if (<= z -8.2e-12)
     t_1
     (if (<= z -1.65e-250)
       x
       (if (or (<= z 1.55e-134) (and (not (<= z 5.2e-18)) (<= z 3.8e+138)))
         (* y t)
         t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = t * -z;
	double tmp;
	if (z <= -8.2e-12) {
		tmp = t_1;
	} else if (z <= -1.65e-250) {
		tmp = x;
	} else if ((z <= 1.55e-134) || (!(z <= 5.2e-18) && (z <= 3.8e+138))) {
		tmp = y * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = t * -z
    if (z <= (-8.2d-12)) then
        tmp = t_1
    else if (z <= (-1.65d-250)) then
        tmp = x
    else if ((z <= 1.55d-134) .or. (.not. (z <= 5.2d-18)) .and. (z <= 3.8d+138)) then
        tmp = y * t
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = t * -z;
	double tmp;
	if (z <= -8.2e-12) {
		tmp = t_1;
	} else if (z <= -1.65e-250) {
		tmp = x;
	} else if ((z <= 1.55e-134) || (!(z <= 5.2e-18) && (z <= 3.8e+138))) {
		tmp = y * t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * -z
	tmp = 0
	if z <= -8.2e-12:
		tmp = t_1
	elif z <= -1.65e-250:
		tmp = x
	elif (z <= 1.55e-134) or (not (z <= 5.2e-18) and (z <= 3.8e+138)):
		tmp = y * t
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(-z))
	tmp = 0.0
	if (z <= -8.2e-12)
		tmp = t_1;
	elseif (z <= -1.65e-250)
		tmp = x;
	elseif ((z <= 1.55e-134) || (!(z <= 5.2e-18) && (z <= 3.8e+138)))
		tmp = Float64(y * t);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * -z;
	tmp = 0.0;
	if (z <= -8.2e-12)
		tmp = t_1;
	elseif (z <= -1.65e-250)
		tmp = x;
	elseif ((z <= 1.55e-134) || (~((z <= 5.2e-18)) && (z <= 3.8e+138)))
		tmp = y * t;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * (-z)), $MachinePrecision]}, If[LessEqual[z, -8.2e-12], t$95$1, If[LessEqual[z, -1.65e-250], x, If[Or[LessEqual[z, 1.55e-134], And[N[Not[LessEqual[z, 5.2e-18]], $MachinePrecision], LessEqual[z, 3.8e+138]]], N[(y * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -1.65 \cdot 10^{-250}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-134} \lor \neg \left(z \leq 5.2 \cdot 10^{-18}\right) \land z \leq 3.8 \cdot 10^{+138}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -8.19999999999999979e-12 or 1.55000000000000003e-134 < z < 5.2000000000000001e-18 or 3.80000000000000012e138 < z

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t \cdot z - t \cdot y\right)} \]
    6. Applied egg-rr58.7%

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

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

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

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

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

    if -8.19999999999999979e-12 < z < -1.65e-250

    1. Initial program 99.9%

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

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

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

    if -1.65e-250 < z < 1.55000000000000003e-134 or 5.2000000000000001e-18 < z < 3.80000000000000012e138

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification44.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{-12}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-250}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-134} \lor \neg \left(z \leq 5.2 \cdot 10^{-18}\right) \land z \leq 3.8 \cdot 10^{+138}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 36.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(-z\right)\\ \mathbf{if}\;z \leq -3.5 \cdot 10^{-10}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.85 \cdot 10^{-248}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-134}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-20} \lor \neg \left(z \leq 1.45 \cdot 10^{+112}\right):\\ \;\;\;\;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 (<= z -3.5e-10)
     t_1
     (if (<= z -2.85e-248)
       x
       (if (<= z 1.55e-134)
         (* y t)
         (if (or (<= z 3.9e-20) (not (<= z 1.45e+112))) t_1 (* x (- y))))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * -z;
	double tmp;
	if (z <= -3.5e-10) {
		tmp = t_1;
	} else if (z <= -2.85e-248) {
		tmp = x;
	} else if (z <= 1.55e-134) {
		tmp = y * t;
	} else if ((z <= 3.9e-20) || !(z <= 1.45e+112)) {
		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 (z <= (-3.5d-10)) then
        tmp = t_1
    else if (z <= (-2.85d-248)) then
        tmp = x
    else if (z <= 1.55d-134) then
        tmp = y * t
    else if ((z <= 3.9d-20) .or. (.not. (z <= 1.45d+112))) 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 (z <= -3.5e-10) {
		tmp = t_1;
	} else if (z <= -2.85e-248) {
		tmp = x;
	} else if (z <= 1.55e-134) {
		tmp = y * t;
	} else if ((z <= 3.9e-20) || !(z <= 1.45e+112)) {
		tmp = t_1;
	} else {
		tmp = x * -y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * -z
	tmp = 0
	if z <= -3.5e-10:
		tmp = t_1
	elif z <= -2.85e-248:
		tmp = x
	elif z <= 1.55e-134:
		tmp = y * t
	elif (z <= 3.9e-20) or not (z <= 1.45e+112):
		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 (z <= -3.5e-10)
		tmp = t_1;
	elseif (z <= -2.85e-248)
		tmp = x;
	elseif (z <= 1.55e-134)
		tmp = Float64(y * t);
	elseif ((z <= 3.9e-20) || !(z <= 1.45e+112))
		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 (z <= -3.5e-10)
		tmp = t_1;
	elseif (z <= -2.85e-248)
		tmp = x;
	elseif (z <= 1.55e-134)
		tmp = y * t;
	elseif ((z <= 3.9e-20) || ~((z <= 1.45e+112)))
		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[z, -3.5e-10], t$95$1, If[LessEqual[z, -2.85e-248], x, If[LessEqual[z, 1.55e-134], N[(y * t), $MachinePrecision], If[Or[LessEqual[z, 3.9e-20], N[Not[LessEqual[z, 1.45e+112]], $MachinePrecision]], t$95$1, N[(x * (-y)), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.85 \cdot 10^{-248}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-134}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 3.9 \cdot 10^{-20} \lor \neg \left(z \leq 1.45 \cdot 10^{+112}\right):\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.4999999999999998e-10 or 1.55000000000000003e-134 < z < 3.90000000000000007e-20 or 1.4500000000000001e112 < z

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t \cdot z - t \cdot y\right)} \]
    6. Applied egg-rr58.0%

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

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

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

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

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

    if -3.4999999999999998e-10 < z < -2.8499999999999999e-248

    1. Initial program 99.9%

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

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

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

    if -2.8499999999999999e-248 < z < 1.55000000000000003e-134

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t \cdot z - t \cdot y\right)} \]
    6. Applied egg-rr79.7%

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

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

    if 3.90000000000000007e-20 < z < 1.4500000000000001e112

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)} \]
    10. Step-by-step derivation
      1. associate-*r*49.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.5 \cdot 10^{-10}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{elif}\;z \leq -2.85 \cdot 10^{-248}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-134}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-20} \lor \neg \left(z \leq 1.45 \cdot 10^{+112}\right):\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 66.7% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq -5.8 \cdot 10^{-149}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;y \leq 14000000000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.75000000000000008e-19 or 1.4e10 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto t \cdot y - x \cdot \color{blue}{\left(y + \left(-1\right)\right)} \]
      5. metadata-eval74.0%

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

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

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

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

    if -1.75000000000000008e-19 < y < -5.8e-149 or -2.90000000000000016e-192 < y < 1.4e10

    1. Initial program 100.0%

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

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

        \[\leadsto x + \color{blue}{\left(-x \cdot \left(y - z\right)\right)} \]
      2. distribute-lft-neg-out62.7%

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

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

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

      \[\leadsto x + \color{blue}{x \cdot z} \]
    7. Step-by-step derivation
      1. *-commutative61.8%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    8. Simplified61.8%

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

    if -5.8e-149 < y < -2.90000000000000016e-192

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t \cdot z - t \cdot y\right)} \]
    6. Applied egg-rr91.8%

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

      \[\leadsto \color{blue}{t \cdot y - t \cdot z} \]
    8. Step-by-step derivation
      1. distribute-lft-out--83.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{-19}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{-149}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-192}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 14000000000:\\ \;\;\;\;x + x \cdot z\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 70.3% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -0.36:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 3.55 \cdot 10^{-127}:\\
\;\;\;\;x - z \cdot t\\

\mathbf{elif}\;y \leq 35000000000:\\
\;\;\;\;x + x \cdot z\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -0.35999999999999999 or 5.40000000000000019e110 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.35999999999999999 < y < 3.5500000000000001e-127

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
    6. Simplified74.6%

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

    if 3.5500000000000001e-127 < y < 3.5e10

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{x \cdot z} \]
    7. Step-by-step derivation
      1. *-commutative64.4%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    8. Simplified64.4%

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

    if 3.5e10 < y < 5.40000000000000019e110

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t \cdot z - t \cdot y\right)} \]
    6. Applied egg-rr64.5%

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

      \[\leadsto \color{blue}{t \cdot y - t \cdot z} \]
    8. Step-by-step derivation
      1. distribute-lft-out--64.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.36:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 3.55 \cdot 10^{-127}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 35000000000:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+110}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 74.8% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;y \leq 1.75 \cdot 10^{-25}:\\
\;\;\;\;x + t\_1\\

\mathbf{elif}\;y \leq 70000000000:\\
\;\;\;\;x + x \cdot z\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -6.19999999999999992e27 or 1.09999999999999999e111 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.19999999999999992e27 < y < 1.7500000000000001e-25

    1. Initial program 100.0%

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

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

    if 1.7500000000000001e-25 < y < 7e10

    1. Initial program 100.0%

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

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

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

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

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

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

      \[\leadsto x + \color{blue}{x \cdot z} \]
    7. Step-by-step derivation
      1. *-commutative72.1%

        \[\leadsto x + \color{blue}{z \cdot x} \]
    8. Simplified72.1%

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

    if 7e10 < y < 1.09999999999999999e111

    1. Initial program 100.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{x - \left(t \cdot z - t \cdot y\right)} \]
    6. Applied egg-rr64.5%

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

      \[\leadsto \color{blue}{t \cdot y - t \cdot z} \]
    8. Step-by-step derivation
      1. distribute-lft-out--64.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+27}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-25}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 70000000000:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+111}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -650000 \lor \neg \left(y \leq 5.1 \cdot 10^{+14}\right):\\
\;\;\;\;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.5e5 or 5.1e14 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

        \[\leadsto t \cdot y - x \cdot \color{blue}{\left(y + \left(-1\right)\right)} \]
      5. metadata-eval74.2%

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

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

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

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

    if -6.5e5 < y < 5.1e14

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(t + \left(-x\right)\right)} \]
      2. distribute-lft-in97.7%

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

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

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

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

        \[\leadsto x + \left(x \cdot z + \color{blue}{\left(-1 \cdot t\right) \cdot z}\right) \]
      3. distribute-rgt-in89.6%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -650000 \lor \neg \left(y \leq 5.1 \cdot 10^{+14}\right):\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 84.4% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

    if -1.75000000000000008e-19 < y < 6.8e19

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-neg100.0%

        \[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(t + \left(-x\right)\right)} \]
      2. distribute-lft-in98.4%

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

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

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

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

        \[\leadsto x + \left(x \cdot z + \color{blue}{\left(-1 \cdot t\right) \cdot z}\right) \]
      3. distribute-rgt-in92.5%

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

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

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

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

    if 6.8e19 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{-19}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+19}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 53.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -13000000000 \lor \neg \left(x \leq 5.1 \cdot 10^{+197}\right):\\
\;\;\;\;x \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.3e10 or 5.09999999999999992e197 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(1 - y\right)} \]
    9. Taylor expanded in y around inf 45.3%

      \[\leadsto \color{blue}{-1 \cdot \left(x \cdot y\right)} \]
    10. Step-by-step derivation
      1. associate-*r*45.3%

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

        \[\leadsto \color{blue}{\left(-x\right)} \cdot y \]
    11. Simplified45.3%

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

    if -1.3e10 < x < 5.09999999999999992e197

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y - t \cdot z} \]
    8. Step-by-step derivation
      1. distribute-lft-out--62.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -13000000000 \lor \neg \left(x \leq 5.1 \cdot 10^{+197}\right):\\ \;\;\;\;x \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 63.1% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -505 \lor \neg \left(x \leq 5.8 \cdot 10^{+48}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -505 or 5.7999999999999998e48 < x

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    if -505 < x < 5.7999999999999998e48

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{t \cdot y - t \cdot z} \]
    8. Step-by-step derivation
      1. distribute-lft-out--70.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -505 \lor \neg \left(x \leq 5.8 \cdot 10^{+48}\right):\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 37.7% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-20} \lor \neg \left(y \leq 1.25 \cdot 10^{-34}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.2000000000000002e-20 or 1.2500000000000001e-34 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

    if -8.2000000000000002e-20 < y < 1.2500000000000001e-34

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8.2 \cdot 10^{-20} \lor \neg \left(y \leq 1.25 \cdot 10^{-34}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 17.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. Add Preprocessing
  3. Taylor expanded in t around inf 64.6%

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification19.7%

    \[\leadsto x \]
  6. Add Preprocessing

Developer target: 96.5% 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 2024039 
(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))))