Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(y - z, t - x, x\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (fma (- y z) (- t x) x))
double code(double x, double y, double z, double t) {
	return fma((y - z), (t - x), x);
}
function code(x, y, z, t)
	return fma(Float64(y - z), Float64(t - x), x)
end
code[x_, y_, z_, t_] := N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

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

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

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t - x, x\right)} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 2: 37.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq 1.45 \cdot 10^{-6}:\\
\;\;\;\;x\\

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

\mathbf{elif}\;y \leq 2.55 \cdot 10^{+205} \lor \neg \left(y \leq 1.2 \cdot 10^{+222}\right):\\
\;\;\;\;y \cdot \left(-x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.32000000000000004e-20 or 2.55e205 < y < 1.2000000000000001e222

    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.7%

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    5. Step-by-step derivation
      1. *-commutative50.8%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified50.8%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    7. Taylor expanded in x around 0 50.0%

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

    if -1.32000000000000004e-20 < y < 1.4500000000000001e-6

    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 71.0%

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

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

    if 1.4500000000000001e-6 < y < 1.9000000000000001e63

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 37.8%

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

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

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

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

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

    if 1.9000000000000001e63 < y < 2.55e205 or 1.2000000000000001e222 < 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.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.32 \cdot 10^{-20}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-6}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+63}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 2.55 \cdot 10^{+205} \lor \neg \left(y \leq 1.2 \cdot 10^{+222}\right):\\ \;\;\;\;y \cdot \left(-x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 50.9% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := x + y \cdot t\\
\mathbf{if}\;x \leq -2 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 6.2 \cdot 10^{-300}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 7 \cdot 10^{-263}:\\
\;\;\;\;x - z \cdot t\\

\mathbf{elif}\;x \leq 620000000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2e51 or 6.2e8 < x

    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.2%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+86.2%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg86.2%

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

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

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

    if -2e51 < x < 6.2000000000000005e-300 or 6.99999999999999938e-263 < x < 6.2e8

    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 80.9%

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

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

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified61.7%

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

    if 6.2000000000000005e-300 < x < 6.99999999999999938e-263

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+51}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;x \leq 6.2 \cdot 10^{-300}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;x \leq 7 \cdot 10^{-263}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;x \leq 620000000:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 50.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_1 := x + z \cdot x\\
t_2 := x + y \cdot t\\
\mathbf{if}\;x \leq -1.95 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 3.3 \cdot 10^{-299}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;x \leq 1.25 \cdot 10^{-262}:\\
\;\;\;\;z \cdot \left(-t\right)\\

\mathbf{elif}\;x \leq 550000000:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.94999999999999992e51 or 5.5e8 < x

    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.2%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+86.2%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg86.2%

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

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

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

    if -1.94999999999999992e51 < x < 3.3000000000000002e-299 or 1.24999999999999998e-262 < x < 5.5e8

    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 80.9%

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

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

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified61.7%

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

    if 3.3000000000000002e-299 < x < 1.24999999999999998e-262

    1. Initial program 100.0%

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

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

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

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

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

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 88.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.95 \cdot 10^{+51}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-299}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{-262}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;x \leq 550000000:\\ \;\;\;\;x + y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 49.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + z \cdot x\\ t_2 := x \cdot \left(1 - y\right)\\ \mathbf{if}\;z \leq -1.75 \cdot 10^{+79}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-197}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-229}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+26}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* z x))) (t_2 (* x (- 1.0 y))))
   (if (<= z -1.75e+79)
     t_1
     (if (<= z -8.2e-197)
       t_2
       (if (<= z -2.9e-229) (* y t) (if (<= z 4e+26) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (z * x);
	double t_2 = x * (1.0 - y);
	double tmp;
	if (z <= -1.75e+79) {
		tmp = t_1;
	} else if (z <= -8.2e-197) {
		tmp = t_2;
	} else if (z <= -2.9e-229) {
		tmp = y * t;
	} else if (z <= 4e+26) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = x + (z * x)
    t_2 = x * (1.0d0 - y)
    if (z <= (-1.75d+79)) then
        tmp = t_1
    else if (z <= (-8.2d-197)) then
        tmp = t_2
    else if (z <= (-2.9d-229)) then
        tmp = y * t
    else if (z <= 4d+26) then
        tmp = t_2
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x + (z * x);
	double t_2 = x * (1.0 - y);
	double tmp;
	if (z <= -1.75e+79) {
		tmp = t_1;
	} else if (z <= -8.2e-197) {
		tmp = t_2;
	} else if (z <= -2.9e-229) {
		tmp = y * t;
	} else if (z <= 4e+26) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (z * x)
	t_2 = x * (1.0 - y)
	tmp = 0
	if z <= -1.75e+79:
		tmp = t_1
	elif z <= -8.2e-197:
		tmp = t_2
	elif z <= -2.9e-229:
		tmp = y * t
	elif z <= 4e+26:
		tmp = t_2
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(z * x))
	t_2 = Float64(x * Float64(1.0 - y))
	tmp = 0.0
	if (z <= -1.75e+79)
		tmp = t_1;
	elseif (z <= -8.2e-197)
		tmp = t_2;
	elseif (z <= -2.9e-229)
		tmp = Float64(y * t);
	elseif (z <= 4e+26)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (z * x);
	t_2 = x * (1.0 - y);
	tmp = 0.0;
	if (z <= -1.75e+79)
		tmp = t_1;
	elseif (z <= -8.2e-197)
		tmp = t_2;
	elseif (z <= -2.9e-229)
		tmp = y * t;
	elseif (z <= 4e+26)
		tmp = t_2;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.75e+79], t$95$1, If[LessEqual[z, -8.2e-197], t$95$2, If[LessEqual[z, -2.9e-229], N[(y * t), $MachinePrecision], If[LessEqual[z, 4e+26], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -8.2 \cdot 10^{-197}:\\
\;\;\;\;t\_2\\

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

\mathbf{elif}\;z \leq 4 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.7499999999999999e79 or 4.00000000000000019e26 < 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 0 60.9%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+60.9%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub060.9%

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg60.9%

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

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

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

    if -1.7499999999999999e79 < z < -8.2e-197 or -2.9e-229 < z < 4.00000000000000019e26

    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 85.7%

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

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

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

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

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

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

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

    if -8.2e-197 < z < -2.9e-229

    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 100.0%

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

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

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified100.0%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    7. Taylor expanded in x around 0 78.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+79}:\\ \;\;\;\;x + z \cdot x\\ \mathbf{elif}\;z \leq -8.2 \cdot 10^{-197}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq -2.9 \cdot 10^{-229}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 4 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 44.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{+174}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;t \leq 2.15 \cdot 10^{-43}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\

\mathbf{elif}\;t \leq 4 \cdot 10^{+184}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -5.7999999999999999e174 or 2.14999999999999982e-43 < t < 4.00000000000000007e184

    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.6%

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    5. Step-by-step derivation
      1. *-commutative55.2%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified55.2%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    7. Taylor expanded in x around 0 49.7%

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

    if -5.7999999999999999e174 < t < 2.14999999999999982e-43

    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 60.1%

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

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

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

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

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

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

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

    if 4.00000000000000007e184 < t

    1. Initial program 99.8%

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

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

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

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

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

      \[\leadsto x - \color{blue}{t \cdot z} \]
    7. Taylor expanded in x around 0 70.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -5.8 \cdot 10^{+174}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;t \leq 2.15 \cdot 10^{-43}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;t \leq 4 \cdot 10^{+184}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+24} \lor \neg \left(z \leq 3300000000000\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.35e24 or 3.3e12 < z

    1. Initial program 100.0%

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

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

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

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

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

    if -1.35e24 < z < 3.3e12

    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 90.6%

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

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

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

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

Alternative 8: 80.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{+95} \lor \neg \left(x \leq 7 \cdot 10^{-24}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.8500000000000001e95 or 6.9999999999999993e-24 < x

    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-rgt-neg-in86.3%

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+86.3%

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

        \[\leadsto x + x \cdot \left(\color{blue}{\left(-\left(-z\right)\right)} - y\right) \]
      8. remove-double-neg86.3%

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

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

    if -1.8500000000000001e95 < x < 6.9999999999999993e-24

    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 85.0%

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

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

Alternative 9: 69.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+143} \lor \neg \left(x \leq 660000000\right):\\
\;\;\;\;x + z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.1999999999999998e143 or 6.6e8 < x

    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 88.6%

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

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

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

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

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

        \[\leadsto x + x \cdot \left(0 - \color{blue}{\left(\left(-z\right) + y\right)}\right) \]
      6. associate--r+88.6%

        \[\leadsto x + x \cdot \color{blue}{\left(\left(0 - \left(-z\right)\right) - y\right)} \]
      7. neg-sub088.6%

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

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

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

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

    if -7.1999999999999998e143 < x < 6.6e8

    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 80.0%

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

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

Alternative 10: 36.9% accurate, 0.6× speedup?

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

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

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

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


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

    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 58.9%

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

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

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified48.3%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    7. Taylor expanded in x around 0 47.5%

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

    if -1.32000000000000004e-20 < y < 750

    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 71.1%

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

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

    if 750 < 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 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 37.9% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.02000000000000001e-20 or 2.1000000000000001e-16 < 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 54.1%

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

      \[\leadsto x + \color{blue}{t \cdot y} \]
    5. Step-by-step derivation
      1. *-commutative41.9%

        \[\leadsto x + \color{blue}{y \cdot t} \]
    6. Simplified41.9%

      \[\leadsto x + \color{blue}{y \cdot t} \]
    7. Taylor expanded in x around 0 41.1%

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

    if -1.02000000000000001e-20 < y < 2.1000000000000001e-16

    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 70.6%

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

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

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

Alternative 12: 100.0% accurate, 1.0× speedup?

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

\\
x + \left(z - y\right) \cdot \left(x - t\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(z - y\right) \cdot \left(x - t\right) \]
  4. Add Preprocessing

Alternative 13: 17.6% 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 61.7%

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

    \[\leadsto \color{blue}{x} \]
  5. Add Preprocessing

Developer target: 96.3% 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 2024106 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

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

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