Data.Metrics.Snapshot:quantile from metrics-0.3.0.2

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

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

Initial Program: 100.0% accurate, 1.0× speedup?

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

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

Alternative 1: 100.0% accurate, 1.0× speedup?

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

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

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

Alternative 2: 73.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(y - z\right) \cdot t\\ t_2 := \mathsf{fma}\left(x, z - y, x\right)\\ \mathbf{if}\;t \leq -2.6 \cdot 10^{+162}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq -1.75 \cdot 10^{+62}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;t \leq -100000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-33}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* (- y z) t)) (t_2 (fma x (- z y) x)))
   (if (<= t -2.6e+162)
     t_1
     (if (<= t -1.75e+62)
       t_2
       (if (<= t -100000000000.0) t_1 (if (<= t 5.2e-33) t_2 t_1))))))
double code(double x, double y, double z, double t) {
	double t_1 = (y - z) * t;
	double t_2 = fma(x, (z - y), x);
	double tmp;
	if (t <= -2.6e+162) {
		tmp = t_1;
	} else if (t <= -1.75e+62) {
		tmp = t_2;
	} else if (t <= -100000000000.0) {
		tmp = t_1;
	} else if (t <= 5.2e-33) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * t)
	t_2 = fma(x, Float64(z - y), x)
	tmp = 0.0
	if (t <= -2.6e+162)
		tmp = t_1;
	elseif (t <= -1.75e+62)
		tmp = t_2;
	elseif (t <= -100000000000.0)
		tmp = t_1;
	elseif (t <= 5.2e-33)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.6e+162], t$95$1, If[LessEqual[t, -1.75e+62], t$95$2, If[LessEqual[t, -100000000000.0], t$95$1, If[LessEqual[t, 5.2e-33], t$95$2, t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t \leq -1.75 \cdot 10^{+62}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;t \leq -100000000000:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t \leq 5.2 \cdot 10^{-33}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -2.6e162 or -1.74999999999999992e62 < t < -1e11 or 5.19999999999999988e-33 < t

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
    4. Step-by-step derivation
      1. +-rgt-identityN/A

        \[\leadsto \color{blue}{t \cdot \left(y - z\right) + 0} \]
      2. accelerator-lowering-fma.f64N/A

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, 0\right)} \]
    6. Step-by-step derivation
      1. +-rgt-identityN/A

        \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y - z\right) \cdot t} \]
      3. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(y - z\right) \cdot t} \]
      4. --lowering--.f6486.0

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

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

    if -2.6e162 < t < -1.74999999999999992e62 or -1e11 < t < 5.19999999999999988e-33

    1. Initial program 100.0%

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

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

        \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
      2. distribute-lft-inN/A

        \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
      3. *-rgt-identityN/A

        \[\leadsto x \cdot \left(-1 \cdot \left(y - z\right)\right) + \color{blue}{x} \]
      4. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, -1 \cdot \left(y - z\right), x\right)} \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
      6. sub-negN/A

        \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)}\right), x\right) \]
      7. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
      8. distribute-neg-inN/A

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
      9. unsub-negN/A

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
      10. remove-double-negN/A

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
      11. --lowering--.f6478.7

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{z - y}, x\right) \]
    5. Simplified78.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, z - y, x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 71.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.75 \cdot 10^{-182}:\\ \;\;\;\;y \cdot \left(t - x\right)\\ \mathbf{elif}\;z \leq 560000000:\\ \;\;\;\;\mathsf{fma}\left(y, t, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (* z (- x t))))
   (if (<= z -5.5e+62)
     t_1
     (if (<= z -2.75e-182)
       (* y (- t x))
       (if (<= z 560000000.0) (fma y t x) t_1)))))
double code(double x, double y, double z, double t) {
	double t_1 = z * (x - t);
	double tmp;
	if (z <= -5.5e+62) {
		tmp = t_1;
	} else if (z <= -2.75e-182) {
		tmp = y * (t - x);
	} else if (z <= 560000000.0) {
		tmp = fma(y, t, x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t)
	t_1 = Float64(z * Float64(x - t))
	tmp = 0.0
	if (z <= -5.5e+62)
		tmp = t_1;
	elseif (z <= -2.75e-182)
		tmp = Float64(y * Float64(t - x));
	elseif (z <= 560000000.0)
		tmp = fma(y, t, x);
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+62], t$95$1, If[LessEqual[z, -2.75e-182], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 560000000.0], N[(y * t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 560000000:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -5.4999999999999997e62 or 5.6e8 < z

    1. Initial program 100.0%

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

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

        \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \left(t - x\right)\right)} \]
      2. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{z \cdot \left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
      3. mul-1-negN/A

        \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \left(t - x\right)\right)} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(t - x\right)\right)} \]
      5. mul-1-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
      6. sub-negN/A

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right) \]
      7. +-commutativeN/A

        \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + t\right)}\right)\right) \]
      8. distribute-neg-inN/A

        \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(t\right)\right)\right)} \]
      9. unsub-negN/A

        \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) - t\right)} \]
      10. remove-double-negN/A

        \[\leadsto z \cdot \left(\color{blue}{x} - t\right) \]
      11. --lowering--.f6482.2

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

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

    if -5.4999999999999997e62 < z < -2.74999999999999996e-182

    1. Initial program 100.0%

      \[x + \left(y - z\right) \cdot \left(t - x\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)} \]
      2. sub-negN/A

        \[\leadsto x + \left(t - x\right) \cdot \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
      3. +-commutativeN/A

        \[\leadsto x + \left(t - x\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} \]
      4. distribute-lft-inN/A

        \[\leadsto x + \color{blue}{\left(\left(t - x\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + \left(t - x\right) \cdot y\right)} \]
      5. *-commutativeN/A

        \[\leadsto x + \left(\left(t - x\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{y \cdot \left(t - x\right)}\right) \]
      6. accelerator-lowering-fma.f64N/A

        \[\leadsto x + \color{blue}{\mathsf{fma}\left(t - x, \mathsf{neg}\left(z\right), y \cdot \left(t - x\right)\right)} \]
      7. --lowering--.f64N/A

        \[\leadsto x + \mathsf{fma}\left(\color{blue}{t - x}, \mathsf{neg}\left(z\right), y \cdot \left(t - x\right)\right) \]
      8. neg-sub0N/A

        \[\leadsto x + \mathsf{fma}\left(t - x, \color{blue}{0 - z}, y \cdot \left(t - x\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto x + \mathsf{fma}\left(t - x, \color{blue}{0 - z}, y \cdot \left(t - x\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto x + \mathsf{fma}\left(t - x, 0 - z, \color{blue}{y \cdot \left(t - x\right)}\right) \]
      11. --lowering--.f64100.0

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

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

      \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
      2. --lowering--.f6474.4

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

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

    if -2.74999999999999996e-182 < z < 5.6e8

    1. Initial program 99.9%

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

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

        \[\leadsto \color{blue}{y \cdot \left(t - x\right) + x} \]
      2. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, t - x, x\right)} \]
      3. --lowering--.f6489.9

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t - x}, x\right) \]
    5. Simplified89.9%

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

      \[\leadsto \mathsf{fma}\left(y, \color{blue}{t}, x\right) \]
    7. Step-by-step derivation
      1. Simplified73.2%

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{t}, x\right) \]
    8. Recombined 3 regimes into one program.
    9. Add Preprocessing

    Alternative 4: 84.3% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -5000000000000:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.75 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* y (- t x))))
       (if (<= y -5000000000000.0)
         t_1
         (if (<= y 3.75e+34) (fma z (- x t) x) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = y * (t - x);
    	double tmp;
    	if (y <= -5000000000000.0) {
    		tmp = t_1;
    	} else if (y <= 3.75e+34) {
    		tmp = fma(z, (x - t), x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	t_1 = Float64(y * Float64(t - x))
    	tmp = 0.0
    	if (y <= -5000000000000.0)
    		tmp = t_1;
    	elseif (y <= 3.75e+34)
    		tmp = fma(z, Float64(x - t), x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5000000000000.0], t$95$1, If[LessEqual[y, 3.75e+34], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := y \cdot \left(t - x\right)\\
    \mathbf{if}\;y \leq -5000000000000:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq 3.75 \cdot 10^{+34}:\\
    \;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -5e12 or 3.74999999999999988e34 < y

      1. Initial program 100.0%

        \[x + \left(y - z\right) \cdot \left(t - x\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)} \]
        2. sub-negN/A

          \[\leadsto x + \left(t - x\right) \cdot \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
        3. +-commutativeN/A

          \[\leadsto x + \left(t - x\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} \]
        4. distribute-lft-inN/A

          \[\leadsto x + \color{blue}{\left(\left(t - x\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + \left(t - x\right) \cdot y\right)} \]
        5. *-commutativeN/A

          \[\leadsto x + \left(\left(t - x\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{y \cdot \left(t - x\right)}\right) \]
        6. accelerator-lowering-fma.f64N/A

          \[\leadsto x + \color{blue}{\mathsf{fma}\left(t - x, \mathsf{neg}\left(z\right), y \cdot \left(t - x\right)\right)} \]
        7. --lowering--.f64N/A

          \[\leadsto x + \mathsf{fma}\left(\color{blue}{t - x}, \mathsf{neg}\left(z\right), y \cdot \left(t - x\right)\right) \]
        8. neg-sub0N/A

          \[\leadsto x + \mathsf{fma}\left(t - x, \color{blue}{0 - z}, y \cdot \left(t - x\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto x + \mathsf{fma}\left(t - x, \color{blue}{0 - z}, y \cdot \left(t - x\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto x + \mathsf{fma}\left(t - x, 0 - z, \color{blue}{y \cdot \left(t - x\right)}\right) \]
        11. --lowering--.f6493.9

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

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

        \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
      6. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
        2. --lowering--.f6481.1

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

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

      if -5e12 < y < 3.74999999999999988e34

      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

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

          \[\leadsto \color{blue}{-1 \cdot \left(z \cdot \left(t - x\right)\right) + x} \]
        2. mul-1-negN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(z \cdot \left(t - x\right)\right)\right)} + x \]
        3. distribute-rgt-neg-inN/A

          \[\leadsto \color{blue}{z \cdot \left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} + x \]
        4. mul-1-negN/A

          \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \left(t - x\right)\right)} + x \]
        5. accelerator-lowering-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(z, -1 \cdot \left(t - x\right), x\right)} \]
        6. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{\mathsf{neg}\left(\left(t - x\right)\right)}, x\right) \]
        7. sub-negN/A

          \[\leadsto \mathsf{fma}\left(z, \mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(x\right)\right)\right)}\right), x\right) \]
        8. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(z, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + t\right)}\right), x\right) \]
        9. distribute-neg-inN/A

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(t\right)\right)}, x\right) \]
        10. unsub-negN/A

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) - t}, x\right) \]
        11. remove-double-negN/A

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{x} - t, x\right) \]
        12. --lowering--.f6489.9

          \[\leadsto \mathsf{fma}\left(z, \color{blue}{x - t}, x\right) \]
      5. Simplified89.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(z, x - t, x\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 5: 84.0% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := z \cdot \left(x - t\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq 3000000000:\\ \;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* z (- x t))))
       (if (<= z -5.5e+62) t_1 (if (<= z 3000000000.0) (fma y (- t x) x) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = z * (x - t);
    	double tmp;
    	if (z <= -5.5e+62) {
    		tmp = t_1;
    	} else if (z <= 3000000000.0) {
    		tmp = fma(y, (t - x), x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	t_1 = Float64(z * Float64(x - t))
    	tmp = 0.0
    	if (z <= -5.5e+62)
    		tmp = t_1;
    	elseif (z <= 3000000000.0)
    		tmp = fma(y, Float64(t - x), x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+62], t$95$1, If[LessEqual[z, 3000000000.0], N[(y * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := z \cdot \left(x - t\right)\\
    \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;z \leq 3000000000:\\
    \;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -5.4999999999999997e62 or 3e9 < z

      1. Initial program 100.0%

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

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

          \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \left(t - x\right)\right)} \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto \color{blue}{z \cdot \left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \left(t - x\right)\right)} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(t - x\right)\right)} \]
        5. mul-1-negN/A

          \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
        6. sub-negN/A

          \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right) \]
        7. +-commutativeN/A

          \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + t\right)}\right)\right) \]
        8. distribute-neg-inN/A

          \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(t\right)\right)\right)} \]
        9. unsub-negN/A

          \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) - t\right)} \]
        10. remove-double-negN/A

          \[\leadsto z \cdot \left(\color{blue}{x} - t\right) \]
        11. --lowering--.f6482.2

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

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

      if -5.4999999999999997e62 < z < 3e9

      1. Initial program 100.0%

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

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

          \[\leadsto \color{blue}{y \cdot \left(t - x\right) + x} \]
        2. accelerator-lowering-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(y, t - x, x\right)} \]
        3. --lowering--.f6486.9

          \[\leadsto \mathsf{fma}\left(y, \color{blue}{t - x}, x\right) \]
      5. Simplified86.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, t - x, x\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 6: 67.5% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := y \cdot \left(t - x\right)\\ \mathbf{if}\;y \leq -82:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (let* ((t_1 (* y (- t x))))
       (if (<= y -82.0) t_1 (if (<= y 3.7e+34) (fma x z x) t_1))))
    double code(double x, double y, double z, double t) {
    	double t_1 = y * (t - x);
    	double tmp;
    	if (y <= -82.0) {
    		tmp = t_1;
    	} else if (y <= 3.7e+34) {
    		tmp = fma(x, z, x);
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	t_1 = Float64(y * Float64(t - x))
    	tmp = 0.0
    	if (y <= -82.0)
    		tmp = t_1;
    	elseif (y <= 3.7e+34)
    		tmp = fma(x, z, x);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -82.0], t$95$1, If[LessEqual[y, 3.7e+34], N[(x * z + x), $MachinePrecision], t$95$1]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := y \cdot \left(t - x\right)\\
    \mathbf{if}\;y \leq -82:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;y \leq 3.7 \cdot 10^{+34}:\\
    \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -82 or 3.70000000000000009e34 < y

      1. Initial program 100.0%

        \[x + \left(y - z\right) \cdot \left(t - x\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto x + \color{blue}{\left(t - x\right) \cdot \left(y - z\right)} \]
        2. sub-negN/A

          \[\leadsto x + \left(t - x\right) \cdot \color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)} \]
        3. +-commutativeN/A

          \[\leadsto x + \left(t - x\right) \cdot \color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)} \]
        4. distribute-lft-inN/A

          \[\leadsto x + \color{blue}{\left(\left(t - x\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + \left(t - x\right) \cdot y\right)} \]
        5. *-commutativeN/A

          \[\leadsto x + \left(\left(t - x\right) \cdot \left(\mathsf{neg}\left(z\right)\right) + \color{blue}{y \cdot \left(t - x\right)}\right) \]
        6. accelerator-lowering-fma.f64N/A

          \[\leadsto x + \color{blue}{\mathsf{fma}\left(t - x, \mathsf{neg}\left(z\right), y \cdot \left(t - x\right)\right)} \]
        7. --lowering--.f64N/A

          \[\leadsto x + \mathsf{fma}\left(\color{blue}{t - x}, \mathsf{neg}\left(z\right), y \cdot \left(t - x\right)\right) \]
        8. neg-sub0N/A

          \[\leadsto x + \mathsf{fma}\left(t - x, \color{blue}{0 - z}, y \cdot \left(t - x\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto x + \mathsf{fma}\left(t - x, \color{blue}{0 - z}, y \cdot \left(t - x\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto x + \mathsf{fma}\left(t - x, 0 - z, \color{blue}{y \cdot \left(t - x\right)}\right) \]
        11. --lowering--.f6493.9

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

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

        \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
      6. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \color{blue}{y \cdot \left(t - x\right)} \]
        2. --lowering--.f6480.4

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

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

      if -82 < y < 3.70000000000000009e34

      1. Initial program 100.0%

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

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

          \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
        2. distribute-lft-inN/A

          \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
        3. *-rgt-identityN/A

          \[\leadsto x \cdot \left(-1 \cdot \left(y - z\right)\right) + \color{blue}{x} \]
        4. accelerator-lowering-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, -1 \cdot \left(y - z\right), x\right)} \]
        5. mul-1-negN/A

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
        6. sub-negN/A

          \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)}\right), x\right) \]
        7. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
        8. distribute-neg-inN/A

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
        9. unsub-negN/A

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
        10. remove-double-negN/A

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
        11. --lowering--.f6459.1

          \[\leadsto \mathsf{fma}\left(x, \color{blue}{z - y}, x\right) \]
      5. Simplified59.1%

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

        \[\leadsto \color{blue}{x + x \cdot z} \]
      7. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{x \cdot z + x} \]
        2. accelerator-lowering-fma.f6457.7

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, x\right)} \]
      8. Simplified57.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, x\right)} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 7: 54.8% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 540000000000:\\ \;\;\;\;\mathsf{fma}\left(y, t, x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \end{array} \]
    (FPCore (x y z t)
     :precision binary64
     (if (<= z -5.5e+62) (* x z) (if (<= z 540000000000.0) (fma y t x) (* x z))))
    double code(double x, double y, double z, double t) {
    	double tmp;
    	if (z <= -5.5e+62) {
    		tmp = x * z;
    	} else if (z <= 540000000000.0) {
    		tmp = fma(y, t, x);
    	} else {
    		tmp = x * z;
    	}
    	return tmp;
    }
    
    function code(x, y, z, t)
    	tmp = 0.0
    	if (z <= -5.5e+62)
    		tmp = Float64(x * z);
    	elseif (z <= 540000000000.0)
    		tmp = fma(y, t, x);
    	else
    		tmp = Float64(x * z);
    	end
    	return tmp
    end
    
    code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+62], N[(x * z), $MachinePrecision], If[LessEqual[z, 540000000000.0], N[(y * t + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
    \;\;\;\;x \cdot z\\
    
    \mathbf{elif}\;z \leq 540000000000:\\
    \;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;x \cdot z\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if z < -5.4999999999999997e62 or 5.4e11 < z

      1. Initial program 100.0%

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

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

          \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \left(t - x\right)\right)} \]
        2. distribute-rgt-neg-inN/A

          \[\leadsto \color{blue}{z \cdot \left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \left(t - x\right)\right)} \]
        4. *-lowering-*.f64N/A

          \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(t - x\right)\right)} \]
        5. mul-1-negN/A

          \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
        6. sub-negN/A

          \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right) \]
        7. +-commutativeN/A

          \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + t\right)}\right)\right) \]
        8. distribute-neg-inN/A

          \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(t\right)\right)\right)} \]
        9. unsub-negN/A

          \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) - t\right)} \]
        10. remove-double-negN/A

          \[\leadsto z \cdot \left(\color{blue}{x} - t\right) \]
        11. --lowering--.f6482.2

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

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

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

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

        if -5.4999999999999997e62 < z < 5.4e11

        1. Initial program 100.0%

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

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

            \[\leadsto \color{blue}{y \cdot \left(t - x\right) + x} \]
          2. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(y, t - x, x\right)} \]
          3. --lowering--.f6486.9

            \[\leadsto \mathsf{fma}\left(y, \color{blue}{t - x}, x\right) \]
        5. Simplified86.9%

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

          \[\leadsto \mathsf{fma}\left(y, \color{blue}{t}, x\right) \]
        7. Step-by-step derivation
          1. Simplified63.6%

            \[\leadsto \mathsf{fma}\left(y, \color{blue}{t}, x\right) \]
        8. Recombined 2 regimes into one program.
        9. Final simplification55.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 540000000000:\\ \;\;\;\;\mathsf{fma}\left(y, t, x\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
        10. Add Preprocessing

        Alternative 8: 50.7% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -42:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 3.7 \cdot 10^{+34}:\\ \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (if (<= y -42.0) (* y t) (if (<= y 3.7e+34) (fma x z x) (* y t))))
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if (y <= -42.0) {
        		tmp = y * t;
        	} else if (y <= 3.7e+34) {
        		tmp = fma(x, z, x);
        	} else {
        		tmp = y * t;
        	}
        	return tmp;
        }
        
        function code(x, y, z, t)
        	tmp = 0.0
        	if (y <= -42.0)
        		tmp = Float64(y * t);
        	elseif (y <= 3.7e+34)
        		tmp = fma(x, z, x);
        	else
        		tmp = Float64(y * t);
        	end
        	return tmp
        end
        
        code[x_, y_, z_, t_] := If[LessEqual[y, -42.0], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.7e+34], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -42:\\
        \;\;\;\;y \cdot t\\
        
        \mathbf{elif}\;y \leq 3.7 \cdot 10^{+34}:\\
        \;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;y \cdot t\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -42 or 3.70000000000000009e34 < y

          1. Initial program 100.0%

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

            \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
          4. Step-by-step derivation
            1. +-rgt-identityN/A

              \[\leadsto \color{blue}{t \cdot \left(y - z\right) + 0} \]
            2. accelerator-lowering-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, 0\right)} \]
            3. --lowering--.f6457.5

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

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

            \[\leadsto \color{blue}{t \cdot y} \]
          7. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{y \cdot t} \]
            2. *-lowering-*.f6446.5

              \[\leadsto \color{blue}{y \cdot t} \]
          8. Simplified46.5%

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

          if -42 < y < 3.70000000000000009e34

          1. Initial program 100.0%

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

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

              \[\leadsto x \cdot \color{blue}{\left(-1 \cdot \left(y - z\right) + 1\right)} \]
            2. distribute-lft-inN/A

              \[\leadsto \color{blue}{x \cdot \left(-1 \cdot \left(y - z\right)\right) + x \cdot 1} \]
            3. *-rgt-identityN/A

              \[\leadsto x \cdot \left(-1 \cdot \left(y - z\right)\right) + \color{blue}{x} \]
            4. accelerator-lowering-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, -1 \cdot \left(y - z\right), x\right)} \]
            5. mul-1-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{neg}\left(\left(y - z\right)\right)}, x\right) \]
            6. sub-negN/A

              \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(y + \left(\mathsf{neg}\left(z\right)\right)\right)}\right), x\right) \]
            7. +-commutativeN/A

              \[\leadsto \mathsf{fma}\left(x, \mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(z\right)\right) + y\right)}\right), x\right) \]
            8. distribute-neg-inN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) + \left(\mathsf{neg}\left(y\right)\right)}, x\right) \]
            9. unsub-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(z\right)\right)\right)\right) - y}, x\right) \]
            10. remove-double-negN/A

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{z} - y, x\right) \]
            11. --lowering--.f6459.1

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{z - y}, x\right) \]
          5. Simplified59.1%

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

            \[\leadsto \color{blue}{x + x \cdot z} \]
          7. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{x \cdot z + x} \]
            2. accelerator-lowering-fma.f6457.7

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, x\right)} \]
          8. Simplified57.7%

            \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, x\right)} \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 9: 39.0% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 12000000000:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \end{array} \]
        (FPCore (x y z t)
         :precision binary64
         (if (<= z -5.5e+62) (* x z) (if (<= z 12000000000.0) (* y t) (* x z))))
        double code(double x, double y, double z, double t) {
        	double tmp;
        	if (z <= -5.5e+62) {
        		tmp = x * z;
        	} else if (z <= 12000000000.0) {
        		tmp = y * t;
        	} else {
        		tmp = x * z;
        	}
        	return tmp;
        }
        
        real(8) function code(x, y, z, t)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            real(8), intent (in) :: z
            real(8), intent (in) :: t
            real(8) :: tmp
            if (z <= (-5.5d+62)) then
                tmp = x * z
            else if (z <= 12000000000.0d0) then
                tmp = y * t
            else
                tmp = x * z
            end if
            code = tmp
        end function
        
        public static double code(double x, double y, double z, double t) {
        	double tmp;
        	if (z <= -5.5e+62) {
        		tmp = x * z;
        	} else if (z <= 12000000000.0) {
        		tmp = y * t;
        	} else {
        		tmp = x * z;
        	}
        	return tmp;
        }
        
        def code(x, y, z, t):
        	tmp = 0
        	if z <= -5.5e+62:
        		tmp = x * z
        	elif z <= 12000000000.0:
        		tmp = y * t
        	else:
        		tmp = x * z
        	return tmp
        
        function code(x, y, z, t)
        	tmp = 0.0
        	if (z <= -5.5e+62)
        		tmp = Float64(x * z);
        	elseif (z <= 12000000000.0)
        		tmp = Float64(y * t);
        	else
        		tmp = Float64(x * z);
        	end
        	return tmp
        end
        
        function tmp_2 = code(x, y, z, t)
        	tmp = 0.0;
        	if (z <= -5.5e+62)
        		tmp = x * z;
        	elseif (z <= 12000000000.0)
        		tmp = y * t;
        	else
        		tmp = x * z;
        	end
        	tmp_2 = tmp;
        end
        
        code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+62], N[(x * z), $MachinePrecision], If[LessEqual[z, 12000000000.0], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
        \;\;\;\;x \cdot z\\
        
        \mathbf{elif}\;z \leq 12000000000:\\
        \;\;\;\;y \cdot t\\
        
        \mathbf{else}:\\
        \;\;\;\;x \cdot z\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if z < -5.4999999999999997e62 or 1.2e10 < z

          1. Initial program 100.0%

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

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(z \cdot \left(t - x\right)\right)} \]
            2. distribute-rgt-neg-inN/A

              \[\leadsto \color{blue}{z \cdot \left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
            3. mul-1-negN/A

              \[\leadsto z \cdot \color{blue}{\left(-1 \cdot \left(t - x\right)\right)} \]
            4. *-lowering-*.f64N/A

              \[\leadsto \color{blue}{z \cdot \left(-1 \cdot \left(t - x\right)\right)} \]
            5. mul-1-negN/A

              \[\leadsto z \cdot \color{blue}{\left(\mathsf{neg}\left(\left(t - x\right)\right)\right)} \]
            6. sub-negN/A

              \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(t + \left(\mathsf{neg}\left(x\right)\right)\right)}\right)\right) \]
            7. +-commutativeN/A

              \[\leadsto z \cdot \left(\mathsf{neg}\left(\color{blue}{\left(\left(\mathsf{neg}\left(x\right)\right) + t\right)}\right)\right) \]
            8. distribute-neg-inN/A

              \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) + \left(\mathsf{neg}\left(t\right)\right)\right)} \]
            9. unsub-negN/A

              \[\leadsto z \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) - t\right)} \]
            10. remove-double-negN/A

              \[\leadsto z \cdot \left(\color{blue}{x} - t\right) \]
            11. --lowering--.f6482.2

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

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

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

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

            if -5.4999999999999997e62 < z < 1.2e10

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
            4. Step-by-step derivation
              1. +-rgt-identityN/A

                \[\leadsto \color{blue}{t \cdot \left(y - z\right) + 0} \]
              2. accelerator-lowering-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, 0\right)} \]
              3. --lowering--.f6447.1

                \[\leadsto \mathsf{fma}\left(t, \color{blue}{y - z}, 0\right) \]
            5. Simplified47.1%

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

              \[\leadsto \color{blue}{t \cdot y} \]
            7. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{y \cdot t} \]
              2. *-lowering-*.f6436.7

                \[\leadsto \color{blue}{y \cdot t} \]
            8. Simplified36.7%

              \[\leadsto \color{blue}{y \cdot t} \]
          8. Recombined 2 regimes into one program.
          9. Final simplification41.4%

            \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 12000000000:\\ \;\;\;\;y \cdot t\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
          10. Add Preprocessing

          Alternative 10: 37.7% accurate, 0.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.1 \cdot 10^{-20}:\\ \;\;\;\;y \cdot t\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot t\\ \end{array} \end{array} \]
          (FPCore (x y z t)
           :precision binary64
           (if (<= y -1.1e-20) (* y t) (if (<= y 6.8e-71) x (* y t))))
          double code(double x, double y, double z, double t) {
          	double tmp;
          	if (y <= -1.1e-20) {
          		tmp = y * t;
          	} else if (y <= 6.8e-71) {
          		tmp = x;
          	} else {
          		tmp = y * t;
          	}
          	return tmp;
          }
          
          real(8) function code(x, y, z, t)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8), intent (in) :: z
              real(8), intent (in) :: t
              real(8) :: tmp
              if (y <= (-1.1d-20)) then
                  tmp = y * t
              else if (y <= 6.8d-71) then
                  tmp = x
              else
                  tmp = y * t
              end if
              code = tmp
          end function
          
          public static double code(double x, double y, double z, double t) {
          	double tmp;
          	if (y <= -1.1e-20) {
          		tmp = y * t;
          	} else if (y <= 6.8e-71) {
          		tmp = x;
          	} else {
          		tmp = y * t;
          	}
          	return tmp;
          }
          
          def code(x, y, z, t):
          	tmp = 0
          	if y <= -1.1e-20:
          		tmp = y * t
          	elif y <= 6.8e-71:
          		tmp = x
          	else:
          		tmp = y * t
          	return tmp
          
          function code(x, y, z, t)
          	tmp = 0.0
          	if (y <= -1.1e-20)
          		tmp = Float64(y * t);
          	elseif (y <= 6.8e-71)
          		tmp = x;
          	else
          		tmp = Float64(y * t);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x, y, z, t)
          	tmp = 0.0;
          	if (y <= -1.1e-20)
          		tmp = y * t;
          	elseif (y <= 6.8e-71)
          		tmp = x;
          	else
          		tmp = y * t;
          	end
          	tmp_2 = tmp;
          end
          
          code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e-20], N[(y * t), $MachinePrecision], If[LessEqual[y, 6.8e-71], x, N[(y * t), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y \leq -1.1 \cdot 10^{-20}:\\
          \;\;\;\;y \cdot t\\
          
          \mathbf{elif}\;y \leq 6.8 \cdot 10^{-71}:\\
          \;\;\;\;x\\
          
          \mathbf{else}:\\
          \;\;\;\;y \cdot t\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y < -1.09999999999999995e-20 or 6.80000000000000007e-71 < y

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{t \cdot \left(y - z\right)} \]
            4. Step-by-step derivation
              1. +-rgt-identityN/A

                \[\leadsto \color{blue}{t \cdot \left(y - z\right) + 0} \]
              2. accelerator-lowering-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(t, y - z, 0\right)} \]
              3. --lowering--.f6456.8

                \[\leadsto \mathsf{fma}\left(t, \color{blue}{y - z}, 0\right) \]
            5. Simplified56.8%

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

              \[\leadsto \color{blue}{t \cdot y} \]
            7. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \color{blue}{y \cdot t} \]
              2. *-lowering-*.f6442.2

                \[\leadsto \color{blue}{y \cdot t} \]
            8. Simplified42.2%

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

            if -1.09999999999999995e-20 < y < 6.80000000000000007e-71

            1. Initial program 100.0%

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

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

                \[\leadsto \color{blue}{y \cdot \left(t - x\right) + x} \]
              2. accelerator-lowering-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(y, t - x, x\right)} \]
              3. --lowering--.f6438.3

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

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

              \[\leadsto \color{blue}{x} \]
            7. Step-by-step derivation
              1. Simplified33.0%

                \[\leadsto \color{blue}{x} \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 11: 18.6% accurate, 15.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 z around 0

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

                \[\leadsto \color{blue}{y \cdot \left(t - x\right) + x} \]
              2. accelerator-lowering-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(y, t - x, x\right)} \]
              3. --lowering--.f6456.6

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

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

              \[\leadsto \color{blue}{x} \]
            7. Step-by-step derivation
              1. Simplified16.9%

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

              Developer Target 1: 96.4% 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 2024195 
              (FPCore (x y z t)
                :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
                :precision binary64
              
                :alt
                (! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
              
                (+ x (* (- y z) (- t x))))