# 一般數值函數

在這些一般數值函數中，引數是運算式，其中 x 應解譯為真實的值數字。所有函數皆可用於載入指令碼和圖表運算式。

使用各個函數的下拉式清單，查看各函數的簡短描述及語法。按一下語法描述中的函數名稱以取得更多詳細資料。

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### bitcount

BitCount() 發現二進位對等數字中的位元數量設定為 1。換言之，該函數會傳回 integer\_number 中的設定位元數，其中 integer\_number 會解譯為帶正負號的 32 位元整數。

[**bitcount**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/bitcount.htm)(integer\_number)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### div

Div() 會傳回第一個引數除以第二個引數的算術除法的整數部分。兩個參數都會解譯為實數，亦即不必為整數。

[**div**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/div.htm)(integer\_number1, integer\_number2)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### fabs

Fabs() 會傳回 x 的絕對值。結果是正數。

[**fabs**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/fabs.htm)(x)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### fact

Fact() 會傳回正整數 x 的階乘。

[**fact**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/fact.htm)(x)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### frac

Frac() 會傳回 x 小數點右方的分數，其中 x 為實數。

[**frac**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/frac.htm)(x)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### sign

視 x 為正數、0 或負數而定，Sign() 會分別傳回 1、0 或 -1。

[**sign**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/sign.htm)(x)

## 組合與排列函數

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### combin

Combin() 會傳回從一組 p 個項目中挑選 q 個元素的可能組合數目。由以下公式表示：`Combin(p,q) = p! / q!(p-q)!` 選取項目的順序並不重要。

[**combin**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/combin.htm)(p, q)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### permut

Permut() 會傳回從一組 p 個項目中選取 q 個元素的可能排列數目。由以下公式表示：`Permut(p,q) = (p)! / (p - q)!` 選取項目的順序非常重要。

[**permut**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/permut.htm)(p, q)

## 模數函數

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### fmod

fmod() 是模數函數，會傳回第一個引數 (被除數) 除以第二個引數 (除數) 的除法的餘數。結果是實數。兩個引數都會解譯為實數，亦即不必為整數。

[**fmod**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/fmod.htm)(a, b)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### mod

Mod() 是模數函數，會傳回整數除法的非負餘數。第一個引數為被除數，第二個引數為除數，兩個引數都必須為整數值。

[**mod**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/mod.htm)(integer\_number1, integer\_number2)

## 同位函數

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### even

若 integer\_number 為偶數或零，Even() 會傳回 True (-1)。若 integer\_number 為奇數，會傳回 False (0)；若 integer\_number 為非整數，則會傳回 NULL。

[**even**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/even.htm)(integer\_number)

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### odd

若 integer\_number 為奇數或零，Odd() 會傳回 True (-1)。若 integer\_number 為偶數，會傳回 False (0)；若 integer\_number 為非整數，則會傳回 NULL。

[**odd**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/odd.htm)(integer\_number)

## 捨入函數

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### ceil

Ceil() 會將 x 向上捨入至最近的 step [+ offset] 的倍數。 offset 的預設值為 0。

[**ceil**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/ceil.htm)(x[, step[, offset]])

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### floor

Floor() 會將 x 向下捨入至最近的 step [+ offset] 的倍數。 offset 的預設值為 0。

[**floor**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/floor.htm)(x[, step[, offset]])

[](https://help.qlik.com/en-US/qlikview/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### round

Round() 會傳回將 x 向上或向下捨入至最近的 step [+ offset] 的倍數的結果。 offset 的預設值為 0。

[**round**](https://help.qlik.com/zh-TW/qlikview/September2026/Subsystems/Client/Content/QV_QlikView/ChartFunctions/GeneralNumericFunctions/round.htm)( x [ , step [ , offset ]])