Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

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

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

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

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

Alternative 2: 51.7% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -6.8 \cdot 10^{-249}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;z \leq 4.3 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.60000000000000008e27

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + x \cdot \color{blue}{z} \]
    7. Taylor expanded in z around inf 55.4%

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

        \[\leadsto \color{blue}{z \cdot x} \]
    9. Simplified55.4%

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

    if -1.60000000000000008e27 < z < -6.7999999999999996e-249 or 1.6000000000000001e-17 < z < 4.3000000000000001e68

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

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

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out96.8%

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

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

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

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

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

    if -6.7999999999999996e-249 < z < 1.6000000000000001e-17

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(-x \cdot y\right)} \]
      2. *-rgt-identity69.0%

        \[\leadsto \color{blue}{x \cdot 1} + \left(-x \cdot y\right) \]
      3. distribute-rgt-neg-out69.0%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-y\right)} \]
      4. distribute-lft-in69.0%

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

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

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

    if 4.3000000000000001e68 < 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 86.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+27}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -6.8 \cdot 10^{-249}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-17}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+68}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 38.1% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-245}:\\
\;\;\;\;y \cdot t\\

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

\mathbf{elif}\;z \leq 1.1 \cdot 10^{+66}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.49999999999999997e24

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + x \cdot \color{blue}{z} \]
    7. Taylor expanded in z around inf 55.4%

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

        \[\leadsto \color{blue}{z \cdot x} \]
    9. Simplified55.4%

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

    if -1.49999999999999997e24 < z < -1.45e-245 or 1.64999999999999994e-16 < z < 1.0999999999999999e66

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

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

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out96.8%

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

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

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

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

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

    if -1.45e-245 < z < 1.64999999999999994e-16

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

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

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

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

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

    if 1.0999999999999999e66 < 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 86.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.5 \cdot 10^{+24}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-245}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 1.65 \cdot 10^{-16}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.1 \cdot 10^{+66}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 37.6% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;z \leq -1.4 \cdot 10^{-248}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 8.6 \cdot 10^{-19}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{+125}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3e17 or 1.55e125 < 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 53.2%

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

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

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

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

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

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

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

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

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

      \[\leadsto x + x \cdot \color{blue}{z} \]
    7. Taylor expanded in z around inf 49.2%

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

        \[\leadsto \color{blue}{z \cdot x} \]
    9. Simplified49.2%

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

    if -3e17 < z < -1.40000000000000005e-248 or 8.6e-19 < z < 1.55e125

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

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

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

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

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

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

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

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

    if -1.40000000000000005e-248 < z < 8.6e-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 96.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3 \cdot 10^{+17}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-248}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{-19}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{+125}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 70.7% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -3.25 \cdot 10^{-34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq -6 \cdot 10^{-130}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq 0.000165:\\ \;\;\;\;x - z \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 -3.25e-34)
     t_1
     (if (<= y -6e-130)
       (+ x (* x z))
       (if (<= y 0.000165) (- x (* z t)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double tmp;
	if (y <= -3.25e-34) {
		tmp = t_1;
	} else if (y <= -6e-130) {
		tmp = x + (x * z);
	} else if (y <= 0.000165) {
		tmp = x - (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 <= (-3.25d-34)) then
        tmp = t_1
    else if (y <= (-6d-130)) then
        tmp = x + (x * z)
    else if (y <= 0.000165d0) then
        tmp = x - (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 <= -3.25e-34) {
		tmp = t_1;
	} else if (y <= -6e-130) {
		tmp = x + (x * z);
	} else if (y <= 0.000165) {
		tmp = x - (z * t);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	tmp = 0
	if y <= -3.25e-34:
		tmp = t_1
	elif y <= -6e-130:
		tmp = x + (x * z)
	elif y <= 0.000165:
		tmp = x - (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 <= -3.25e-34)
		tmp = t_1;
	elseif (y <= -6e-130)
		tmp = Float64(x + Float64(x * z));
	elseif (y <= 0.000165)
		tmp = Float64(x - Float64(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 <= -3.25e-34)
		tmp = t_1;
	elseif (y <= -6e-130)
		tmp = x + (x * z);
	elseif (y <= 0.000165)
		tmp = x - (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, -3.25e-34], t$95$1, If[LessEqual[y, -6e-130], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.000165], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.24999999999999993e-34 or 1.65e-4 < y

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

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

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out97.8%

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

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

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

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

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

    if -3.24999999999999993e-34 < y < -5.99999999999999972e-130

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

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999972e-130 < y < 1.65e-4

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

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

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

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

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

      \[\leadsto x - z \cdot \color{blue}{t} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 6: 65.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -3.25 \cdot 10^{-34}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-129}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-60}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- t x))))
   (if (<= y -3.25e-34)
     t_1
     (if (<= y 4.6e-129) (+ x (* x z)) (if (<= y 4.1e-60) (* t (- z)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double tmp;
	if (y <= -3.25e-34) {
		tmp = t_1;
	} else if (y <= 4.6e-129) {
		tmp = x + (x * z);
	} else if (y <= 4.1e-60) {
		tmp = t * -z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = y * (t - x)
    if (y <= (-3.25d-34)) then
        tmp = t_1
    else if (y <= 4.6d-129) then
        tmp = x + (x * z)
    else if (y <= 4.1d-60) then
        tmp = t * -z
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double tmp;
	if (y <= -3.25e-34) {
		tmp = t_1;
	} else if (y <= 4.6e-129) {
		tmp = x + (x * z);
	} else if (y <= 4.1e-60) {
		tmp = t * -z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	tmp = 0
	if y <= -3.25e-34:
		tmp = t_1
	elif y <= 4.6e-129:
		tmp = x + (x * z)
	elif y <= 4.1e-60:
		tmp = t * -z
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t - x))
	tmp = 0.0
	if (y <= -3.25e-34)
		tmp = t_1;
	elseif (y <= 4.6e-129)
		tmp = Float64(x + Float64(x * z));
	elseif (y <= 4.1e-60)
		tmp = Float64(t * Float64(-z));
	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 <= -3.25e-34)
		tmp = t_1;
	elseif (y <= 4.6e-129)
		tmp = x + (x * z);
	elseif (y <= 4.1e-60)
		tmp = t * -z;
	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, -3.25e-34], t$95$1, If[LessEqual[y, 4.6e-129], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-60], N[(t * (-z)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.24999999999999993e-34 or 4.10000000000000013e-60 < y

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

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

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out98.0%

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

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

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

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

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

    if -3.24999999999999993e-34 < y < 4.5999999999999999e-129

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

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

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

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

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

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

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

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

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

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

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

    if 4.5999999999999999e-129 < y < 4.10000000000000013e-60

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.25 \cdot 10^{-34}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-129}:\\ \;\;\;\;x + x \cdot z\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-60}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 49.1% accurate, 0.5× speedup?

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

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

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

\mathbf{elif}\;z \leq 8.6 \cdot 10^{+66}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -1.45e17

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto x + x \cdot \color{blue}{z} \]
    7. Taylor expanded in z around inf 55.4%

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

        \[\leadsto \color{blue}{z \cdot x} \]
    9. Simplified55.4%

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

    if -1.45e17 < z < 2.0599999999999999e-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 0 60.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x + \color{blue}{\left(-x \cdot y\right)} \]
      2. *-rgt-identity60.8%

        \[\leadsto \color{blue}{x \cdot 1} + \left(-x \cdot y\right) \]
      3. distribute-rgt-neg-out60.8%

        \[\leadsto x \cdot 1 + \color{blue}{x \cdot \left(-y\right)} \]
      4. distribute-lft-in60.8%

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

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

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

    if 2.0599999999999999e-16 < z < 8.60000000000000054e66

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

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

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out100.0%

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

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

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

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

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

    if 8.60000000000000054e66 < 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 86.3%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+17}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 2.06 \cdot 10^{-16}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{+66}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(-z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 83.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{-27} \lor \neg \left(z \leq 4.6 \cdot 10^{+67}\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.25e-27) (not (<= z 4.6e+67)))
   (+ x (* z (- x t)))
   (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((z <= -1.25e-27) || !(z <= 4.6e+67)) {
		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.25d-27)) .or. (.not. (z <= 4.6d+67))) 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.25e-27) || !(z <= 4.6e+67)) {
		tmp = x + (z * (x - t));
	} else {
		tmp = x + (y * (t - x));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (z <= -1.25e-27) or not (z <= 4.6e+67):
		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.25e-27) || !(z <= 4.6e+67))
		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.25e-27) || ~((z <= 4.6e+67)))
		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.25e-27], N[Not[LessEqual[z, 4.6e+67]], $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.25 \cdot 10^{-27} \lor \neg \left(z \leq 4.6 \cdot 10^{+67}\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.25e-27 or 4.5999999999999997e67 < 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 87.0%

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

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

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

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

    if -1.25e-27 < z < 4.5999999999999997e67

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

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

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

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

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

Alternative 9: 81.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-53} \lor \neg \left(t \leq 1.45 \cdot 10^{-74}\right):\\
\;\;\;\;x + t \cdot \left(y - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.79999999999999985e-53 or 1.45e-74 < t

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

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

    if -2.79999999999999985e-53 < t < 1.45e-74

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 69.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+17}:\\
\;\;\;\;x + x \cdot \left(z - y\right)\\

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

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


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

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    if -3e17 < z < 1.2500000000000001e70

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

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

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

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

    if 1.2500000000000001e70 < 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 86.3%

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

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

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

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

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

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

Alternative 11: 37.4% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.3 \cdot 10^{-35} \lor \neg \left(y \leq 6 \cdot 10^{-91}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.3000000000000002e-35 or 6.0000000000000004e-91 < y

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

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

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot t + \left(y - z\right) \cdot \left(-x\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-rgt-neg-out98.0%

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

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

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

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

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

    if -4.3000000000000002e-35 < y < 6.0000000000000004e-91

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

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

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

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

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

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

Alternative 12: 17.7% 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 y around inf 58.9%

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

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

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

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

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

  :alt
  (! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))

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