พื้นฐานปาสคาลพื้นฐาน rapidqเว็บภาษาไทยเว็บภาษาอังกฤษ

MATH Function ( Rapid-Q BASIC )

ABS(numeric-expression) คืนค่าไม่คิดเครื่องหมาย
SGN(numeric-expression) คืนค่า -1, 0, 1 ตามแต่เครื่องหมายของ numeric-expr
example
    a%=ABS(-10)
    b%=ABS(10)
    print a%
    print b%
    print SGN(-25)
    print SGN(a%)
    print SGN(0)
    input s$ ' รอรับการ enter

SIN(numeric-expression) คืนค่า sine
COS(numeric-expression) คืนค่า cos
TAN(numeric-expression) คืนค่า tangent
ASIN(numeric-expression) คืนค่า arcsine
ACOS(numeric-expression) คืนค่า arccosine
ATN/ATAN(numeric-expression) คืนค่า arctangent
example
    CONST PI = 3.141593
    OneRadian = PI/180
    print "sine of 30 degree is "; sin( OneRadian*30 )
    input s$ ' รอรับการ enter

CEIL(numeric-expression) คืนค่าตัวเลขที่เพิ่มจนเป็นจำนวนเต็ม
เช่น CEIL(1.2) จะเท่ากับ 2 และเช่น CEIL(-1.2) จะเท่ากับ -1
ROUND(numeric-expression) คืนค่าตัวเลขจำนวนเต็ม
ปัดขึ้นเมื่อเลขหลังจุดทศนิยมมีค่าตั้งแต่ 5-9 ปัดลงเมื่อน้อยกว่า 5
FIX/INT(numeric-expression) คืนค่า จำนวนเต็มโดย (ตัดเลขทศนิยมทิ้ง)
FLOOR(numeric-expression) เหมือน FIX แต่ค่าลบที่มีเลขทศนิยมจะลดลง
FRAC(numeric-expression) คืนค่า จำนวนเลขทศนิยม (ตัดเลขจำนวนเต็มออก)
example
    print ROUND( 52.5 )
    input s$ ' รอรับการ enter

EXP(numeric-expression) คืนค่า exponential function
LOG(numeric-expression) คืนค่า natural logarithm
SQR(numeric-expression) คืนค่ารากที่ 2
example
    print "square root 2 of 9 is "; sqr( 9 )
    input s$ ' รอรับการ enter

RANDOMIZE [numeric-expression] กำหนดค่าตัวเลข ในการสร้างเลขสุ่ม
RND[(upper-bound)] คืนค่าเลขสุ่มตั้งแต่ 0 ถึง (upperbound-1)
example
    RANDOMIZE TIMER
    for i=1 to 10
    print "ramdom number is "; rnd( 120 )
    next
    input s$ ' รอรับการ enter
best view with ie 5.0++, screen 600x800