# 一般數值函數

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

使用每個函數中的下拉式功能表，以查看每個函數的簡要描述及語法。按一下語法描述中的函數名稱，以取得進一步詳細資料。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### bitcount

BitCount() 傳回十進位數的等效二進數中有多少個位元設定為 1。即，該函數會傳回 integer\_number 中的設定位元數，其中 integer\_number 會解譯為帶正負號的 32 位元整數。

[**bitcount**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/bitcount.htm)(integer\_number)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### div

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

[**div**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/div.htm)(integer\_number1, integer\_number2)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### fabs

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

[**fabs**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/fabs.htm)(x)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

####

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

[**fact**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/fact.htm)(x)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### frac

Frac() 傳回 x 的分數部分。

[**frac**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/frac.htm)(x)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### sign

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

[**sign**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/sign.htm)(x)

## 組合與排列函數

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/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/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/combin.htm)(p, q)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### permut

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

[**permut**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/permut.htm)(p, q)

## 模數函數

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### fmod

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

[**fmod**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/fmod.htm)(a, b)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### mod

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

[**mod**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/mod.htm)(integer\_number1, integer\_number2)

## 同位函數

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### even

如果 integer\_number 是偶數整數或零，則 Even() 傳回 True (-1)。如果 integer\_number 是奇數整數及 NULL，並且如果 integer\_number 不是整數，則它傳回 False (0)。

[**even**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/even.htm)(integer\_number)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### odd

如果 integer\_number 是奇數整數或零，則 Odd() 傳回 True (-1)。如果 integer\_number 偶整數整數及 NULL，並且如果 integer\_number 不是整數，則它傳回 False (0)。

[**odd**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/odd.htm)(integer\_number)

## 捨入函數

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### ceil

Ceil() 會將數字向上捨入為 offset 數字偏移之 step 的最近倍數。

[**ceil**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/ceil.htm)(x[, step[, offset]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### floor

Floor() 會將數字向下捨入為 offset 數字偏移之 step 的最近倍數。

[**floor**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/floor.htm)(x[, step[, offset]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/general-numeric-functions-charts.htm)

#### round

Round() 傳回會將數字向上或向下捨入為 offset 數字偏移之 step 的最近倍數的結果。

[**round**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/GeneralNumericFunctions/round.htm)( x [ , step [ , offset ]])