更多的數學函式

EXP - 返回將數字提升為冪的結果。

EXP(基數,指數)

MESSAGE EXP(10, 2) VIEW-AS ALERT-BOX. // Messages 100

SQRT - 返回數字的平方根。

SQRT(數量)

MESSAGE "The square root of 256 is " SQRT(256) VIEW-AS ALERT-BOX. // Messages 16

MODULO - 確定除法後的餘數。

表達 MODULO 鹼

DISPLAY 52 MODULO 12. //Displays 4

ROUND - 將小數表示式舍入到小數點後的指定位數。

ROUND(數字,精度)

DISPLAY ROUND(67.12345, 6) FORMAT "99.99999". // 67.12345
DISPLAY ROUND(67.12345, 5) FORMAT "99.99999". // 67.12345
DISPLAY ROUND(67.12345, 4) FORMAT "99.99999". // 67.12350
DISPLAY ROUND(67.12345, 3) FORMAT "99.99999". // 67.12300
DISPLAY ROUND(67.12345, 2) FORMAT "99.99999". // 67.12000
DISPLAY ROUND(67.12345, 1) FORMAT "99.99999". // 67.10000
DISPLAY ROUND(67.12345, 0) FORMAT "99.99999". // 67.00000

TRUNCATE 將十進位制表示式截斷為指定的小數位數,並返回十進位制值。

TRUNCATE(數字,地點)

DISPLAY TRUNCATE(67.12345, 6) FORMAT "99.99999". // 67.12345
DISPLAY TRUNCATE(67.12345, 5) FORMAT "99.99999". // 67.12345
DISPLAY TRUNCATE(67.12345, 4) FORMAT "99.99999". // 67.12340
DISPLAY TRUNCATE(67.12345, 3) FORMAT "99.99999". // 67.12300
DISPLAY TRUNCATE(67.12345, 2) FORMAT "99.99999". // 67.12000
DISPLAY TRUNCATE(67.12345, 1) FORMAT "99.99999". // 67.10000
DISPLAY TRUNCATE(67.12345, 0) FORMAT "99.99999". // 67.00000

ABSOLUTE - 返回數字的絕對值

DISPLAY ABS(10 - 12). //Displays 2
DISPLAY ABS(-2) = ABS(2). //Displays yes

MINIMUMMAXIMUM - 返回小數和最大數

MINIMUM(number1,number2,… numbern)

MAXIMUM(number1,number2,… numbern)

DEFINE VARIABLE i AS INTEGER     NO-UNDO.
DEFINE VARIABLE j AS INTEGER     NO-UNDO.
DEFINE VARIABLE k AS INTEGER     NO-UNDO.

i = 40.
j = 45.
k = 56.

DISPLAY MINIMUM(i, j, k) MAXIMUM(i, j, k). // Displays 40 and 56