ICT
the blog for ICT
ken013194
暱稱: ホロ
性別: 男
國家: 香港
地區: 葵青區
« July 2026 »
SMTWTFS
1234
567891011
12131415161718
19202122232425
262728293031
最新文章
Text File
Arrays
String Procedures
String Functions
String Operation
文章分類
全部 (23)
Programming Language (23)
訪客留言
最近三個月尚無任何留言
每月文章
日誌訂閱
尚未訂閱任何日誌
好友名單
尚無任何好友
網站連結
尚無任何連結
最近訪客
最近沒有訪客
日誌統計
文章總數: 23
留言總數: 0
今日人氣: 0
累積人氣: 73
站內搜尋
RSS 訂閱
RSS Feed
2009 年 9 月 11 日  星期五   晴天


Math Functions 分類: Programming Language

High-level Programming Language (Pascal)

Mathematical Functions

  • predefined functions that are used to perform arithmetic operation in Pascal
  • common characteristic of Pascal function
    • has a function name and an argument list
    • the function will return a value
  • for example, the function sqrt (X) is used to find the square root of the expression or variable inside the bracket
    • function has a name (e.g. sqrt), which is followed by expression(s) or variable(s) inside a pair of brackets (e.g. sqrt (X)).
    • the returned value of the function sqrt (X) is always a real number.
    • the argument X of the function sqrt (X) may be either an integer or a real number which must be greater than or equal to zero
       
  • a list of some common Pascal arithmetic functions is shown as follows:

    Pascal Function
    Purpose
    Argument Type
    Return Type
    abs (x) return the absolute value of x real or integer same as argument
    round (x) return the value of x rounded to the nearest integer real or integer integer
    sqr (x) return the square of x real or integer same as argument
    sqrt (x) return the positive square root of x real or integer
    (non-negative)
    real
    (non-negative)
    trunc (x) return the integral part of x real or integer integer
    random (x) return a random number that is greater than or equal to zero but less than x integer
    (non-negative)
    integer
    (non-negative)
    randomize initializes the built-in random number generator --- ---

    Remark :
    In order to have the random numbers, the standard procedure randomize should be called before calling the function random (x), otherwise, the same sequence of numbers would be generated. The function of the procedure randomize is to initialize the built-in random number generator.





訪客留言 (返回 ken013194 的日誌)

訪客名稱:
電郵地址: (不會公開)
驗證碼:  按此更新驗證碼 (如看不清楚驗證碼請點擊圖片刷新)
俏俏話: (必需 登入 後才能使用此功能)
[ 開啟多功能編輯器 ]