數字類的資料型態
Type Storage size Range
Byte 1 0 to 255
ShortInt 1 -127 to 127
Word 2 0 to 65,535
SmallInt 2 -32,768 to 32,767
LongWord 4 0 to 4,294,967,295
Cardinal 4* 0 to 4,294,967,295
LongInt 4 -2,147,483,648 to 2,147,483,647
Integer 4* -2,147,483,648 to 2,147,483,647
Int64 8 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Single 4 7 significant digits, exponent -38 to +38
Currency 8 50+ significant digits, fixed 4 decimal places
Double 8 15 significant digits, exponent -308 to +308
Extended 10 19 significant digits, exponent -4932 to +4932
* Note : the Integer and Cardinal types are both 4 bytes in size at present (Delphi release 7), but are not guaranteed to be this size in the future. All other type sizes are guaranteed.
數字型的運算元
+ : Add one number to another
– : Subtract one number from another
* : Multiply two numbers
/ : Divide one decimal number by another
div : Divide one integer number by another(整數位的商)
mod : Remainder from dividing one integer by another(整數位的餘)
數字類的涵數
Abs Returns the absolute value of a signed number
Max Gives the maximum of two integer values
Min Gives the minimum of two integer values
Mean Gives the average of a set of numbers
Sqr Gives the square of a number(平方)
Sqrt Gives the square root of a number(均方根)
Exp Gives the exponent of a number(指數)
Shl Shifts the bits in a number left
Shr Shifts the bits in a number right
Tan Gives the Tangent of a number(三角涵數 正切)
Cos Gives the Cosine of a number(三角涵數 餘弦)
Sin Gives the Sine of a number(三角涵數 正弦)
數值轉字串涵數
Str Converts a number to a string in a simple manner
CurrToStr Converts a Currency variable to a string
Format Number to string conversion with formatting
IntToStr Converts an integer to a string
IntToHex Converts a number into a hexadecimal string
字串轉數值涵數
StrToInt Converts an integer string into an integer
StrToIntDef Fault tolerant version of StrToInt
StrToFloat Converts a decimal string to a number
隨機文章
- 小米手機 紅米機 台灣版 第二波搶購開箱 (2013-12-22)
- 不是iPhone5是4S (2011-10-05)
- 企業成功實施BPR的五條忠告 (2007-11-02)
- 評論:9層樓高台一躍而下 王世堅赴日兌諾高空彈跳 (2012-03-14)
- PTT無法註冊新帳號 (2017-11-16)