Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

Percentage Accurate: 100.0% → 100.0%
Time: 9.8s
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-def100.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. Final simplification100.0%

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

Alternative 2: 37.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+88}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-37}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-124}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-228}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-292}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+116} \lor \neg \left(z \leq 1.48 \cdot 10^{+153}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= z -4.3e+88)
   (* z x)
   (if (<= z -1.75e-37)
     (* y t)
     (if (<= z -1.35e-124)
       x
       (if (<= z -2.35e-228)
         (* y t)
         (if (<= z -4.4e-292)
           x
           (if (<= z 1.2e-26)
             (* y t)
             (if (or (<= z 6e+116) (not (<= z 1.48e+153)))
               (* z x)
               (* z (- t))))))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (z <= -4.3e+88) {
		tmp = z * x;
	} else if (z <= -1.75e-37) {
		tmp = y * t;
	} else if (z <= -1.35e-124) {
		tmp = x;
	} else if (z <= -2.35e-228) {
		tmp = y * t;
	} else if (z <= -4.4e-292) {
		tmp = x;
	} else if (z <= 1.2e-26) {
		tmp = y * t;
	} else if ((z <= 6e+116) || !(z <= 1.48e+153)) {
		tmp = z * x;
	} 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 (z <= (-4.3d+88)) then
        tmp = z * x
    else if (z <= (-1.75d-37)) then
        tmp = y * t
    else if (z <= (-1.35d-124)) then
        tmp = x
    else if (z <= (-2.35d-228)) then
        tmp = y * t
    else if (z <= (-4.4d-292)) then
        tmp = x
    else if (z <= 1.2d-26) then
        tmp = y * t
    else if ((z <= 6d+116) .or. (.not. (z <= 1.48d+153))) then
        tmp = z * x
    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 (z <= -4.3e+88) {
		tmp = z * x;
	} else if (z <= -1.75e-37) {
		tmp = y * t;
	} else if (z <= -1.35e-124) {
		tmp = x;
	} else if (z <= -2.35e-228) {
		tmp = y * t;
	} else if (z <= -4.4e-292) {
		tmp = x;
	} else if (z <= 1.2e-26) {
		tmp = y * t;
	} else if ((z <= 6e+116) || !(z <= 1.48e+153)) {
		tmp = z * x;
	} else {
		tmp = z * -t;
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if z <= -4.3e+88:
		tmp = z * x
	elif z <= -1.75e-37:
		tmp = y * t
	elif z <= -1.35e-124:
		tmp = x
	elif z <= -2.35e-228:
		tmp = y * t
	elif z <= -4.4e-292:
		tmp = x
	elif z <= 1.2e-26:
		tmp = y * t
	elif (z <= 6e+116) or not (z <= 1.48e+153):
		tmp = z * x
	else:
		tmp = z * -t
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (z <= -4.3e+88)
		tmp = Float64(z * x);
	elseif (z <= -1.75e-37)
		tmp = Float64(y * t);
	elseif (z <= -1.35e-124)
		tmp = x;
	elseif (z <= -2.35e-228)
		tmp = Float64(y * t);
	elseif (z <= -4.4e-292)
		tmp = x;
	elseif (z <= 1.2e-26)
		tmp = Float64(y * t);
	elseif ((z <= 6e+116) || !(z <= 1.48e+153))
		tmp = Float64(z * x);
	else
		tmp = Float64(z * Float64(-t));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (z <= -4.3e+88)
		tmp = z * x;
	elseif (z <= -1.75e-37)
		tmp = y * t;
	elseif (z <= -1.35e-124)
		tmp = x;
	elseif (z <= -2.35e-228)
		tmp = y * t;
	elseif (z <= -4.4e-292)
		tmp = x;
	elseif (z <= 1.2e-26)
		tmp = y * t;
	elseif ((z <= 6e+116) || ~((z <= 1.48e+153)))
		tmp = z * x;
	else
		tmp = z * -t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.3e+88], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.75e-37], N[(y * t), $MachinePrecision], If[LessEqual[z, -1.35e-124], x, If[LessEqual[z, -2.35e-228], N[(y * t), $MachinePrecision], If[LessEqual[z, -4.4e-292], x, If[LessEqual[z, 1.2e-26], N[(y * t), $MachinePrecision], If[Or[LessEqual[z, 6e+116], N[Not[LessEqual[z, 1.48e+153]], $MachinePrecision]], N[(z * x), $MachinePrecision], N[(z * (-t)), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.75 \cdot 10^{-37}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -1.35 \cdot 10^{-124}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq -2.35 \cdot 10^{-228}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -4.4 \cdot 10^{-292}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq 6 \cdot 10^{+116} \lor \neg \left(z \leq 1.48 \cdot 10^{+153}\right):\\
\;\;\;\;z \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.29999999999999974e88 or 1.2e-26 < z < 5.9999999999999997e116 or 1.47999999999999998e153 < 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 63.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot x} \]
    8. Simplified53.2%

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

    if -4.29999999999999974e88 < z < -1.7500000000000001e-37 or -1.35000000000000009e-124 < z < -2.3500000000000001e-228 or -4.40000000000000023e-292 < z < 1.2e-26

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr76.8%

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

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

    if -1.7500000000000001e-37 < z < -1.35000000000000009e-124 or -2.3500000000000001e-228 < z < -4.40000000000000023e-292

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

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

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

    if 5.9999999999999997e116 < z < 1.47999999999999998e153

    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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in z around inf 85.8%

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

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

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

      \[\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 -4.3 \cdot 10^{+88}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.75 \cdot 10^{-37}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{-124}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-228}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -4.4 \cdot 10^{-292}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+116} \lor \neg \left(z \leq 1.48 \cdot 10^{+153}\right):\\ \;\;\;\;z \cdot x\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 37.6% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;z \leq -1.02 \cdot 10^{-38}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -3.7 \cdot 10^{-121}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq -2.1 \cdot 10^{-228}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;z \leq -1.4 \cdot 10^{-289}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.29999999999999974e88 or 1.2e-26 < 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 59.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.29999999999999974e88 < z < -1.01999999999999998e-38 or -3.7000000000000002e-121 < z < -2.09999999999999991e-228 or -1.39999999999999993e-289 < z < 1.2e-26

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr76.8%

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

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

    if -1.01999999999999998e-38 < z < -3.7000000000000002e-121 or -2.09999999999999991e-228 < z < -1.39999999999999993e-289

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+88}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.02 \cdot 10^{-38}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -3.7 \cdot 10^{-121}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -2.1 \cdot 10^{-228}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;z \leq -1.4 \cdot 10^{-289}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-26}:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x + x \cdot \left(z - y\right)\\ t_2 := \left(y - z\right) \cdot t\\ t_3 := x + t_2\\ \mathbf{if}\;t \leq -3 \cdot 10^{-28}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -5.6 \cdot 10^{-199}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -5.8 \cdot 10^{-206}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{-32}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ x (* x (- z y)))) (t_2 (* (- y z) t)) (t_3 (+ x t_2)))
   (if (<= t -3e-28)
     t_3
     (if (<= t -5.6e-199)
       t_1
       (if (<= t -5.8e-206) t_2 (if (<= t 3.1e-32) t_1 t_3))))))
double code(double x, double y, double z, double t) {
	double t_1 = x + (x * (z - y));
	double t_2 = (y - z) * t;
	double t_3 = x + t_2;
	double tmp;
	if (t <= -3e-28) {
		tmp = t_3;
	} else if (t <= -5.6e-199) {
		tmp = t_1;
	} else if (t <= -5.8e-206) {
		tmp = t_2;
	} else if (t <= 3.1e-32) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	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) :: t_3
    real(8) :: tmp
    t_1 = x + (x * (z - y))
    t_2 = (y - z) * t
    t_3 = x + t_2
    if (t <= (-3d-28)) then
        tmp = t_3
    else if (t <= (-5.6d-199)) then
        tmp = t_1
    else if (t <= (-5.8d-206)) then
        tmp = t_2
    else if (t <= 3.1d-32) then
        tmp = t_1
    else
        tmp = t_3
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = x + (x * (z - y));
	double t_2 = (y - z) * t;
	double t_3 = x + t_2;
	double tmp;
	if (t <= -3e-28) {
		tmp = t_3;
	} else if (t <= -5.6e-199) {
		tmp = t_1;
	} else if (t <= -5.8e-206) {
		tmp = t_2;
	} else if (t <= 3.1e-32) {
		tmp = t_1;
	} else {
		tmp = t_3;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x + (x * (z - y))
	t_2 = (y - z) * t
	t_3 = x + t_2
	tmp = 0
	if t <= -3e-28:
		tmp = t_3
	elif t <= -5.6e-199:
		tmp = t_1
	elif t <= -5.8e-206:
		tmp = t_2
	elif t <= 3.1e-32:
		tmp = t_1
	else:
		tmp = t_3
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x + Float64(x * Float64(z - y)))
	t_2 = Float64(Float64(y - z) * t)
	t_3 = Float64(x + t_2)
	tmp = 0.0
	if (t <= -3e-28)
		tmp = t_3;
	elseif (t <= -5.6e-199)
		tmp = t_1;
	elseif (t <= -5.8e-206)
		tmp = t_2;
	elseif (t <= 3.1e-32)
		tmp = t_1;
	else
		tmp = t_3;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x + (x * (z - y));
	t_2 = (y - z) * t;
	t_3 = x + t_2;
	tmp = 0.0;
	if (t <= -3e-28)
		tmp = t_3;
	elseif (t <= -5.6e-199)
		tmp = t_1;
	elseif (t <= -5.8e-206)
		tmp = t_2;
	elseif (t <= 3.1e-32)
		tmp = t_1;
	else
		tmp = t_3;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$3 = N[(x + t$95$2), $MachinePrecision]}, If[LessEqual[t, -3e-28], t$95$3, If[LessEqual[t, -5.6e-199], t$95$1, If[LessEqual[t, -5.8e-206], t$95$2, If[LessEqual[t, 3.1e-32], t$95$1, t$95$3]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -5.6 \cdot 10^{-199}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq -5.8 \cdot 10^{-206}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t \leq 3.1 \cdot 10^{-32}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < -3.00000000000000003e-28 or 3.10000000000000011e-32 < 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 + \color{blue}{t \cdot \left(y - z\right)} \]

    if -3.00000000000000003e-28 < t < -5.60000000000000036e-199 or -5.8000000000000004e-206 < t < 3.10000000000000011e-32

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

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

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

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

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

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

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

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

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

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

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

    if -5.60000000000000036e-199 < t < -5.8000000000000004e-206

    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. Step-by-step derivation
      1. +-commutative100.0%

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in t around inf 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -3 \cdot 10^{-28}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \mathbf{elif}\;t \leq -5.6 \cdot 10^{-199}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{elif}\;t \leq -5.8 \cdot 10^{-206}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;t \leq 3.1 \cdot 10^{-32}:\\ \;\;\;\;x + x \cdot \left(z - y\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot t\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;y \leq 340000000000:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;y \leq 2.7 \cdot 10^{+108}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.6000000000000002e29 or 2.7e108 < 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 83.3%

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

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

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

    if -4.6000000000000002e29 < y < 3.4e11 or 8.2000000000000002e50 < y < 2.7e108

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

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

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

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

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

    if 3.4e11 < y < 8.2000000000000002e50

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+29}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 340000000000:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+50}:\\ \;\;\;\;x + t \cdot \left(y - z\right)\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{+108}:\\ \;\;\;\;x + z \cdot \left(x - t\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \left(t - x\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 60.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.82 \cdot 10^{+102} \lor \neg \left(x \leq 1.65 \cdot 10^{-214} \lor \neg \left(x \leq 4.1 \cdot 10^{-168}\right) \land x \leq 9.2 \cdot 10^{+40}\right):\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= x -1.82e+102)
         (not
          (or (<= x 1.65e-214) (and (not (<= x 4.1e-168)) (<= x 9.2e+40)))))
   (* x (- 1.0 y))
   (* t (- y z))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.82e+102) || !((x <= 1.65e-214) || (!(x <= 4.1e-168) && (x <= 9.2e+40)))) {
		tmp = x * (1.0 - y);
	} else {
		tmp = 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.82d+102)) .or. (.not. (x <= 1.65d-214) .or. (.not. (x <= 4.1d-168)) .and. (x <= 9.2d+40))) then
        tmp = x * (1.0d0 - y)
    else
        tmp = 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.82e+102) || !((x <= 1.65e-214) || (!(x <= 4.1e-168) && (x <= 9.2e+40)))) {
		tmp = x * (1.0 - y);
	} else {
		tmp = t * (y - z);
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.82e+102) or not ((x <= 1.65e-214) or (not (x <= 4.1e-168) and (x <= 9.2e+40))):
		tmp = x * (1.0 - y)
	else:
		tmp = t * (y - z)
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.82e+102) || !((x <= 1.65e-214) || (!(x <= 4.1e-168) && (x <= 9.2e+40))))
		tmp = Float64(x * Float64(1.0 - y));
	else
		tmp = Float64(t * Float64(y - z));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if ((x <= -1.82e+102) || ~(((x <= 1.65e-214) || (~((x <= 4.1e-168)) && (x <= 9.2e+40)))))
		tmp = x * (1.0 - y);
	else
		tmp = t * (y - z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.82e+102], N[Not[Or[LessEqual[x, 1.65e-214], And[N[Not[LessEqual[x, 4.1e-168]], $MachinePrecision], LessEqual[x, 9.2e+40]]]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.82 \cdot 10^{+102} \lor \neg \left(x \leq 1.65 \cdot 10^{-214} \lor \neg \left(x \leq 4.1 \cdot 10^{-168}\right) \land x \leq 9.2 \cdot 10^{+40}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.8200000000000001e102 or 1.6499999999999999e-214 < x < 4.0999999999999998e-168 or 9.19999999999999975e40 < 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 90.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8200000000000001e102 < x < 1.6499999999999999e-214 or 4.0999999999999998e-168 < x < 9.19999999999999975e40

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr74.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in t around inf 68.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.82 \cdot 10^{+102} \lor \neg \left(x \leq 1.65 \cdot 10^{-214} \lor \neg \left(x \leq 4.1 \cdot 10^{-168}\right) \land x \leq 9.2 \cdot 10^{+40}\right):\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 61.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-11} \lor \neg \left(t \leq -5.6 \cdot 10^{-199} \lor \neg \left(t \leq -2.35 \cdot 10^{-207}\right) \land t \leq 7.5 \cdot 10^{+15}\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -1.59999999999999997e-11 or -5.60000000000000036e-199 < t < -2.35000000000000014e-207 or 7.5e15 < 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 87.6%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr87.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in t around inf 78.4%

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

    if -1.59999999999999997e-11 < t < -5.60000000000000036e-199 or -2.35000000000000014e-207 < t < 7.5e15

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{-11} \lor \neg \left(t \leq -5.6 \cdot 10^{-199} \lor \neg \left(t \leq -2.35 \cdot 10^{-207}\right) \land t \leq 7.5 \cdot 10^{+15}\right):\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;x + z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 51.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;x \leq 1.65 \cdot 10^{-214}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;x \leq 4.2 \cdot 10^{-169}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{+85}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -6.1000000000000002e102 or 9.49999999999999945e85 < 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 93.7%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{z \cdot x} \]
    8. Simplified47.9%

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

    if -6.1000000000000002e102 < x < 1.6499999999999999e-214 or 4.2000000000000001e-169 < x < 9.49999999999999945e85

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr74.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in t around inf 66.8%

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

    if 1.6499999999999999e-214 < x < 4.2000000000000001e-169

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.1 \cdot 10^{+102}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{-214}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-169}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{+85}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 58.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \left(y - z\right)\\ \mathbf{if}\;z \leq -4.2 \cdot 10^{+88}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-56}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-29}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+211}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* t (- y z))))
   (if (<= z -4.2e+88)
     (* z x)
     (if (<= z -1.65e-56)
       t_1
       (if (<= z 1.2e-29) (+ x (* y t)) (if (<= z 2.6e+211) t_1 (* z x)))))))
double code(double x, double y, double z, double t) {
	double t_1 = t * (y - z);
	double tmp;
	if (z <= -4.2e+88) {
		tmp = z * x;
	} else if (z <= -1.65e-56) {
		tmp = t_1;
	} else if (z <= 1.2e-29) {
		tmp = x + (y * t);
	} else if (z <= 2.6e+211) {
		tmp = t_1;
	} else {
		tmp = z * 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) :: t_1
    real(8) :: tmp
    t_1 = t * (y - z)
    if (z <= (-4.2d+88)) then
        tmp = z * x
    else if (z <= (-1.65d-56)) then
        tmp = t_1
    else if (z <= 1.2d-29) then
        tmp = x + (y * t)
    else if (z <= 2.6d+211) then
        tmp = t_1
    else
        tmp = z * x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = t * (y - z);
	double tmp;
	if (z <= -4.2e+88) {
		tmp = z * x;
	} else if (z <= -1.65e-56) {
		tmp = t_1;
	} else if (z <= 1.2e-29) {
		tmp = x + (y * t);
	} else if (z <= 2.6e+211) {
		tmp = t_1;
	} else {
		tmp = z * x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = t * (y - z)
	tmp = 0
	if z <= -4.2e+88:
		tmp = z * x
	elif z <= -1.65e-56:
		tmp = t_1
	elif z <= 1.2e-29:
		tmp = x + (y * t)
	elif z <= 2.6e+211:
		tmp = t_1
	else:
		tmp = z * x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(t * Float64(y - z))
	tmp = 0.0
	if (z <= -4.2e+88)
		tmp = Float64(z * x);
	elseif (z <= -1.65e-56)
		tmp = t_1;
	elseif (z <= 1.2e-29)
		tmp = Float64(x + Float64(y * t));
	elseif (z <= 2.6e+211)
		tmp = t_1;
	else
		tmp = Float64(z * x);
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = t * (y - z);
	tmp = 0.0;
	if (z <= -4.2e+88)
		tmp = z * x;
	elseif (z <= -1.65e-56)
		tmp = t_1;
	elseif (z <= 1.2e-29)
		tmp = x + (y * t);
	elseif (z <= 2.6e+211)
		tmp = t_1;
	else
		tmp = z * x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+88], N[(z * x), $MachinePrecision], If[LessEqual[z, -1.65e-56], t$95$1, If[LessEqual[z, 1.2e-29], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+211], t$95$1, N[(z * x), $MachinePrecision]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.65 \cdot 10^{-56}:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;z \leq 2.6 \cdot 10^{+211}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.2e88 or 2.5999999999999998e211 < 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 66.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.2e88 < z < -1.64999999999999992e-56 or 1.19999999999999996e-29 < z < 2.5999999999999998e211

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr56.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in t around inf 52.9%

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

    if -1.64999999999999992e-56 < z < 1.19999999999999996e-29

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{+88}:\\ \;\;\;\;z \cdot x\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-56}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{-29}:\\ \;\;\;\;x + y \cdot t\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{+211}:\\ \;\;\;\;t \cdot \left(y - z\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 69.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+102} \lor \neg \left(x \leq 3.35 \cdot 10^{+81}\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 -1.65e+102) (not (<= x 3.35e+81)))
   (+ x (* z x))
   (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if ((x <= -1.65e+102) || !(x <= 3.35e+81)) {
		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 <= (-1.65d+102)) .or. (.not. (x <= 3.35d+81))) 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 <= -1.65e+102) || !(x <= 3.35e+81)) {
		tmp = x + (z * x);
	} else {
		tmp = x + (t * (y - z));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if (x <= -1.65e+102) or not (x <= 3.35e+81):
		tmp = x + (z * x)
	else:
		tmp = x + (t * (y - z))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((x <= -1.65e+102) || !(x <= 3.35e+81))
		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 <= -1.65e+102) || ~((x <= 3.35e+81)))
		tmp = x + (z * x);
	else
		tmp = x + (t * (y - z));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.65e+102], N[Not[LessEqual[x, 3.35e+81]], $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 -1.65 \cdot 10^{+102} \lor \neg \left(x \leq 3.35 \cdot 10^{+81}\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 < -1.64999999999999999e102 or 3.34999999999999981e81 < 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 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.64999999999999999e102 < x < 3.34999999999999981e81

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

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

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

Alternative 11: 37.1% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.3 \cdot 10^{-107} \lor \neg \left(y \leq 1.78 \cdot 10^{-12}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.30000000000000004e-107 or 1.7800000000000001e-12 < 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 59.3%

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    5. Applied egg-rr59.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y - z, t, x\right)} \]
    6. Taylor expanded in y around inf 43.1%

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

    if -3.30000000000000004e-107 < y < 1.7800000000000001e-12

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{-107} \lor \neg \left(y \leq 1.78 \cdot 10^{-12}\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(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 13: 18.0% 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 62.6%

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification16.1%

    \[\leadsto x \]
  6. 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 2024021 
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

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

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