Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

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

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

Alternative 2: 65.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := x \cdot \left(z + 1\right)\\ t_2 := y \cdot \left(t - x\right)\\ t_3 := \left(y - z\right) \cdot t\\ \mathbf{if}\;y \leq -19500:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-40}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq -1.55 \cdot 10^{-125}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-134}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 3.15 \cdot 10^{-198}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-81}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-54}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* x (+ z 1.0))) (t_2 (* y (- t x))) (t_3 (* (- y z) t)))
   (if (<= y -19500.0)
     t_2
     (if (<= y -5e-40)
       t_3
       (if (<= y -1.55e-125)
         t_1
         (if (<= y -1.4e-134)
           t_3
           (if (<= y 3.15e-198)
             t_1
             (if (<= y 3.6e-81) t_3 (if (<= y 4.9e-54) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
	double t_1 = x * (z + 1.0);
	double t_2 = y * (t - x);
	double t_3 = (y - z) * t;
	double tmp;
	if (y <= -19500.0) {
		tmp = t_2;
	} else if (y <= -5e-40) {
		tmp = t_3;
	} else if (y <= -1.55e-125) {
		tmp = t_1;
	} else if (y <= -1.4e-134) {
		tmp = t_3;
	} else if (y <= 3.15e-198) {
		tmp = t_1;
	} else if (y <= 3.6e-81) {
		tmp = t_3;
	} else if (y <= 4.9e-54) {
		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) :: t_3
    real(8) :: tmp
    t_1 = x * (z + 1.0d0)
    t_2 = y * (t - x)
    t_3 = (y - z) * t
    if (y <= (-19500.0d0)) then
        tmp = t_2
    else if (y <= (-5d-40)) then
        tmp = t_3
    else if (y <= (-1.55d-125)) then
        tmp = t_1
    else if (y <= (-1.4d-134)) then
        tmp = t_3
    else if (y <= 3.15d-198) then
        tmp = t_1
    else if (y <= 3.6d-81) then
        tmp = t_3
    else if (y <= 4.9d-54) 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 + 1.0);
	double t_2 = y * (t - x);
	double t_3 = (y - z) * t;
	double tmp;
	if (y <= -19500.0) {
		tmp = t_2;
	} else if (y <= -5e-40) {
		tmp = t_3;
	} else if (y <= -1.55e-125) {
		tmp = t_1;
	} else if (y <= -1.4e-134) {
		tmp = t_3;
	} else if (y <= 3.15e-198) {
		tmp = t_1;
	} else if (y <= 3.6e-81) {
		tmp = t_3;
	} else if (y <= 4.9e-54) {
		tmp = t_1;
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = x * (z + 1.0)
	t_2 = y * (t - x)
	t_3 = (y - z) * t
	tmp = 0
	if y <= -19500.0:
		tmp = t_2
	elif y <= -5e-40:
		tmp = t_3
	elif y <= -1.55e-125:
		tmp = t_1
	elif y <= -1.4e-134:
		tmp = t_3
	elif y <= 3.15e-198:
		tmp = t_1
	elif y <= 3.6e-81:
		tmp = t_3
	elif y <= 4.9e-54:
		tmp = t_1
	else:
		tmp = t_2
	return tmp
function code(x, y, z, t)
	t_1 = Float64(x * Float64(z + 1.0))
	t_2 = Float64(y * Float64(t - x))
	t_3 = Float64(Float64(y - z) * t)
	tmp = 0.0
	if (y <= -19500.0)
		tmp = t_2;
	elseif (y <= -5e-40)
		tmp = t_3;
	elseif (y <= -1.55e-125)
		tmp = t_1;
	elseif (y <= -1.4e-134)
		tmp = t_3;
	elseif (y <= 3.15e-198)
		tmp = t_1;
	elseif (y <= 3.6e-81)
		tmp = t_3;
	elseif (y <= 4.9e-54)
		tmp = t_1;
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = x * (z + 1.0);
	t_2 = y * (t - x);
	t_3 = (y - z) * t;
	tmp = 0.0;
	if (y <= -19500.0)
		tmp = t_2;
	elseif (y <= -5e-40)
		tmp = t_3;
	elseif (y <= -1.55e-125)
		tmp = t_1;
	elseif (y <= -1.4e-134)
		tmp = t_3;
	elseif (y <= 3.15e-198)
		tmp = t_1;
	elseif (y <= 3.6e-81)
		tmp = t_3;
	elseif (y <= 4.9e-54)
		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 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[y, -19500.0], t$95$2, If[LessEqual[y, -5e-40], t$95$3, If[LessEqual[y, -1.55e-125], t$95$1, If[LessEqual[y, -1.4e-134], t$95$3, If[LessEqual[y, 3.15e-198], t$95$1, If[LessEqual[y, 3.6e-81], t$95$3, If[LessEqual[y, 4.9e-54], t$95$1, t$95$2]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -5 \cdot 10^{-40}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;y \leq -1.55 \cdot 10^{-125}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -1.4 \cdot 10^{-134}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;y \leq 3.15 \cdot 10^{-198}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 3.6 \cdot 10^{-81}:\\
\;\;\;\;t_3\\

\mathbf{elif}\;y \leq 4.9 \cdot 10^{-54}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -19500 or 4.90000000000000021e-54 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -19500 < y < -4.99999999999999965e-40 or -1.55000000000000006e-125 < y < -1.3999999999999999e-134 or 3.15000000000000008e-198 < y < 3.5999999999999999e-81

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999965e-40 < y < -1.55000000000000006e-125 or -1.3999999999999999e-134 < y < 3.15000000000000008e-198 or 3.5999999999999999e-81 < y < 4.90000000000000021e-54

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -19500:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-40}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq -1.55 \cdot 10^{-125}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-134}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 3.15 \cdot 10^{-198}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-81}:\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{elif}\;y \leq 4.9 \cdot 10^{-54}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 3: 38.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(-t\right)\\ \mathbf{if}\;y \leq -1.7 \cdot 10^{-12}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-53}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-126}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.0018:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- t))))
   (if (<= y -1.7e-12)
     (* y t)
     (if (<= y -1.4e-39)
       t_1
       (if (<= y -5.5e-53)
         (* y t)
         (if (<= y -1.2e-126)
           x
           (if (<= y 1.7e-80) t_1 (if (<= y 0.0018) x (* y (- x))))))))))
double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (y <= -1.7e-12) {
		tmp = y * t;
	} else if (y <= -1.4e-39) {
		tmp = t_1;
	} else if (y <= -5.5e-53) {
		tmp = y * t;
	} else if (y <= -1.2e-126) {
		tmp = x;
	} else if (y <= 1.7e-80) {
		tmp = t_1;
	} else if (y <= 0.0018) {
		tmp = x;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = z * -t
    if (y <= (-1.7d-12)) then
        tmp = y * t
    else if (y <= (-1.4d-39)) then
        tmp = t_1
    else if (y <= (-5.5d-53)) then
        tmp = y * t
    else if (y <= (-1.2d-126)) then
        tmp = x
    else if (y <= 1.7d-80) then
        tmp = t_1
    else if (y <= 0.0018d0) then
        tmp = x
    else
        tmp = y * -x
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = z * -t;
	double tmp;
	if (y <= -1.7e-12) {
		tmp = y * t;
	} else if (y <= -1.4e-39) {
		tmp = t_1;
	} else if (y <= -5.5e-53) {
		tmp = y * t;
	} else if (y <= -1.2e-126) {
		tmp = x;
	} else if (y <= 1.7e-80) {
		tmp = t_1;
	} else if (y <= 0.0018) {
		tmp = x;
	} else {
		tmp = y * -x;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = z * -t
	tmp = 0
	if y <= -1.7e-12:
		tmp = y * t
	elif y <= -1.4e-39:
		tmp = t_1
	elif y <= -5.5e-53:
		tmp = y * t
	elif y <= -1.2e-126:
		tmp = x
	elif y <= 1.7e-80:
		tmp = t_1
	elif y <= 0.0018:
		tmp = x
	else:
		tmp = y * -x
	return tmp
function code(x, y, z, t)
	t_1 = Float64(z * Float64(-t))
	tmp = 0.0
	if (y <= -1.7e-12)
		tmp = Float64(y * t);
	elseif (y <= -1.4e-39)
		tmp = t_1;
	elseif (y <= -5.5e-53)
		tmp = Float64(y * t);
	elseif (y <= -1.2e-126)
		tmp = x;
	elseif (y <= 1.7e-80)
		tmp = t_1;
	elseif (y <= 0.0018)
		tmp = x;
	else
		tmp = Float64(y * Float64(-x));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = z * -t;
	tmp = 0.0;
	if (y <= -1.7e-12)
		tmp = y * t;
	elseif (y <= -1.4e-39)
		tmp = t_1;
	elseif (y <= -5.5e-53)
		tmp = y * t;
	elseif (y <= -1.2e-126)
		tmp = x;
	elseif (y <= 1.7e-80)
		tmp = t_1;
	elseif (y <= 0.0018)
		tmp = x;
	else
		tmp = y * -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -1.7e-12], N[(y * t), $MachinePrecision], If[LessEqual[y, -1.4e-39], t$95$1, If[LessEqual[y, -5.5e-53], N[(y * t), $MachinePrecision], If[LessEqual[y, -1.2e-126], x, If[LessEqual[y, 1.7e-80], t$95$1, If[LessEqual[y, 0.0018], x, N[(y * (-x)), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.4 \cdot 10^{-39}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -5.5 \cdot 10^{-53}:\\
\;\;\;\;y \cdot t\\

\mathbf{elif}\;y \leq -1.2 \cdot 10^{-126}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 1.7 \cdot 10^{-80}:\\
\;\;\;\;t_1\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.7e-12 or -1.4000000000000001e-39 < y < -5.50000000000000023e-53

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7e-12 < y < -1.4000000000000001e-39 or -1.20000000000000003e-126 < y < 1.7e-80

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative76.9%

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

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

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

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

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

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

    if -5.50000000000000023e-53 < y < -1.20000000000000003e-126 or 1.7e-80 < y < 0.0018

    1. Initial program 99.9%

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

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

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

    if 0.0018 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.7 \cdot 10^{-12}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1.4 \cdot 10^{-39}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-53}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq -1.2 \cdot 10^{-126}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{-80}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{elif}\;y \leq 0.0018:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]

Alternative 4: 71.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -1.9 \cdot 10^{-11}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-79}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 800000000:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- t x))))
   (if (<= y -1.9e-11)
     t_1
     (if (<= y 4.7e-79)
       (- x (* z t))
       (if (<= y 800000000.0)
         (* x (+ z 1.0))
         (if (<= y 4.8e+19) (* z (- t)) t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double tmp;
	if (y <= -1.9e-11) {
		tmp = t_1;
	} else if (y <= 4.7e-79) {
		tmp = x - (z * t);
	} else if (y <= 800000000.0) {
		tmp = x * (z + 1.0);
	} else if (y <= 4.8e+19) {
		tmp = 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 <= (-1.9d-11)) then
        tmp = t_1
    else if (y <= 4.7d-79) then
        tmp = x - (z * t)
    else if (y <= 800000000.0d0) then
        tmp = x * (z + 1.0d0)
    else if (y <= 4.8d+19) then
        tmp = 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 <= -1.9e-11) {
		tmp = t_1;
	} else if (y <= 4.7e-79) {
		tmp = x - (z * t);
	} else if (y <= 800000000.0) {
		tmp = x * (z + 1.0);
	} else if (y <= 4.8e+19) {
		tmp = z * -t;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	tmp = 0
	if y <= -1.9e-11:
		tmp = t_1
	elif y <= 4.7e-79:
		tmp = x - (z * t)
	elif y <= 800000000.0:
		tmp = x * (z + 1.0)
	elif y <= 4.8e+19:
		tmp = 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 <= -1.9e-11)
		tmp = t_1;
	elseif (y <= 4.7e-79)
		tmp = Float64(x - Float64(z * t));
	elseif (y <= 800000000.0)
		tmp = Float64(x * Float64(z + 1.0));
	elseif (y <= 4.8e+19)
		tmp = Float64(z * Float64(-t));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = y * (t - x);
	tmp = 0.0;
	if (y <= -1.9e-11)
		tmp = t_1;
	elseif (y <= 4.7e-79)
		tmp = x - (z * t);
	elseif (y <= 800000000.0)
		tmp = x * (z + 1.0);
	elseif (y <= 4.8e+19)
		tmp = 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, -1.9e-11], t$95$1, If[LessEqual[y, 4.7e-79], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 800000000.0], N[(x * N[(z + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+19], N[(z * (-t)), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq 800000000:\\
\;\;\;\;x \cdot \left(z + 1\right)\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.8999999999999999e-11 or 4.8e19 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e-11 < y < 4.7000000000000002e-79

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative74.8%

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

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

    if 4.7000000000000002e-79 < y < 8e8

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

    if 8e8 < y < 4.8e19

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative75.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 4.7 \cdot 10^{-79}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 800000000:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+19}:\\ \;\;\;\;z \cdot \left(-t\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 5: 72.1% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -4.8 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-80}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+25}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* y (- t x))))
   (if (<= y -4.8e-12)
     t_1
     (if (<= y 2.9e-80)
       (- x (* z t))
       (if (<= y 9e+25) (* x (+ (- z y) 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = y * (t - x);
	double tmp;
	if (y <= -4.8e-12) {
		tmp = t_1;
	} else if (y <= 2.9e-80) {
		tmp = x - (z * t);
	} else if (y <= 9e+25) {
		tmp = x * ((z - y) + 1.0);
	} 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 <= (-4.8d-12)) then
        tmp = t_1
    else if (y <= 2.9d-80) then
        tmp = x - (z * t)
    else if (y <= 9d+25) then
        tmp = x * ((z - y) + 1.0d0)
    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 <= -4.8e-12) {
		tmp = t_1;
	} else if (y <= 2.9e-80) {
		tmp = x - (z * t);
	} else if (y <= 9e+25) {
		tmp = x * ((z - y) + 1.0);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = y * (t - x)
	tmp = 0
	if y <= -4.8e-12:
		tmp = t_1
	elif y <= 2.9e-80:
		tmp = x - (z * t)
	elif y <= 9e+25:
		tmp = x * ((z - y) + 1.0)
	else:
		tmp = t_1
	return tmp
function code(x, y, z, t)
	t_1 = Float64(y * Float64(t - x))
	tmp = 0.0
	if (y <= -4.8e-12)
		tmp = t_1;
	elseif (y <= 2.9e-80)
		tmp = Float64(x - Float64(z * t));
	elseif (y <= 9e+25)
		tmp = Float64(x * Float64(Float64(z - y) + 1.0));
	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 <= -4.8e-12)
		tmp = t_1;
	elseif (y <= 2.9e-80)
		tmp = x - (z * t);
	elseif (y <= 9e+25)
		tmp = x * ((z - y) + 1.0);
	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, -4.8e-12], t$95$1, If[LessEqual[y, 2.9e-80], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+25], N[(x * N[(N[(z - y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.79999999999999974e-12 or 9.0000000000000006e25 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.79999999999999974e-12 < y < 2.89999999999999998e-80

    1. Initial program 100.0%

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

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

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

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

        \[\leadsto \color{blue}{x - t \cdot z} \]
      3. *-commutative74.8%

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

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

    if 2.89999999999999998e-80 < y < 9.0000000000000006e25

    1. Initial program 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-12}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{-80}:\\ \;\;\;\;x - z \cdot t\\ \mathbf{elif}\;y \leq 9 \cdot 10^{+25}:\\ \;\;\;\;x \cdot \left(\left(z - y\right) + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \end{array} \]

Alternative 6: 78.8% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-131} \lor \neg \left(t \leq 6.2 \cdot 10^{-142}\right):\\
\;\;\;\;x - t \cdot \left(z - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -5.19999999999999993e-131 or 6.2e-142 < t

    1. Initial program 100.0%

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

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

    if -5.19999999999999993e-131 < t < 6.2e-142

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 7: 53.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-156} \lor \neg \left(t \leq 2.95 \cdot 10^{-195}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.50000000000000004e-156 or 2.95000000000000003e-195 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.50000000000000004e-156 < t < 2.95000000000000003e-195

    1. Initial program 99.9%

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

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

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

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

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

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

        \[\leadsto \color{blue}{-x \cdot y} \]
      2. distribute-lft-neg-out49.3%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.5 \cdot 10^{-156} \lor \neg \left(t \leq 2.95 \cdot 10^{-195}\right):\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]

Alternative 8: 60.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.35 \cdot 10^{-119} \lor \neg \left(t \leq 4.6 \cdot 10^{-142}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.35000000000000001e-119 or 4.60000000000000005e-142 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.35000000000000001e-119 < t < 4.60000000000000005e-142

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

Alternative 9: 60.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-150} \lor \neg \left(t \leq 9.6 \cdot 10^{-127}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -6.19999999999999996e-150 or 9.59999999999999929e-127 < t

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.19999999999999996e-150 < t < 9.59999999999999929e-127

    1. Initial program 99.9%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -6.2 \cdot 10^{-150} \lor \neg \left(t \leq 9.6 \cdot 10^{-127}\right):\\ \;\;\;\;\left(y - z\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(1 - y\right)\\ \end{array} \]

Alternative 10: 100.0% accurate, 1.0× speedup?

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

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

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

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

Alternative 11: 36.6% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.3000000000000001e-40 < y < 0.00169999999999999991

    1. Initial program 100.0%

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

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

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

    if 0.00169999999999999991 < y

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.3 \cdot 10^{-40}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 0.0017:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(-x\right)\\ \end{array} \]

Alternative 12: 36.0% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{-48} \lor \neg \left(y \leq 4.7 \cdot 10^{-55}\right):\\
\;\;\;\;y \cdot t\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.15e-48 or 4.7e-55 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15e-48 < y < 4.7e-55

    1. Initial program 100.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{-48} \lor \neg \left(y \leq 4.7 \cdot 10^{-55}\right):\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 13: 17.6% accurate, 9.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
	return x;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = x
end function
public static double code(double x, double y, double z, double t) {
	return x;
}
def code(x, y, z, t):
	return x
function code(x, y, z, t)
	return x
end
function tmp = code(x, y, z, t)
	tmp = x;
end
code[x_, y_, z_, t_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 100.0%

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

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

    \[\leadsto \color{blue}{x} \]
  4. Final simplification18.0%

    \[\leadsto x \]

Developer target: 96.1% accurate, 0.6× speedup?

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

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

Reproduce

?
herbie shell --seed 2023320 
(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))))