Logo

BICO

Updated 2024-03-07 19:56:04.057000

Syntax

SELECT [westclintech].[wct].[BICO] (
  <@N, float,>
 ,<@K, float,>)

Description

Use the scalar function BICO to calculate the binomial coefficient. This is the equivalent of the COMBIN function in the XLeratorDB/math module

\binom{n}{k}=\frac{n!}{k!(n-k)!}

if 0 ≤ k ≤ n.

Arguments

@N

is any positive number. @N is an expression of type float or of a type that can be implicitly converted to float.

@K

is any positive number. @K is an expression of type float or of a type that can be implicitly converted to float.

Return Type

float

Remarks

If @N <0, BICO returns an error.

If @K =0, BICO returns an error.

If @K > @N, BICO returns an error.

Both @N and @K are truncated to zero decimal places.

Examples

SELECT wct.BICO(14, 3);

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"364"}]}