Saturday, 13 October 2012

Lesson 18 - Arithmetic Functions

Function Syntax Explanation Example
ABS abs(number) returns the absolute value abs(-6) is 6
abs(6) is 6
ACOS acos(number) Returns arc cosine of given number .  The argument must be in the range of -1 to 1 ACOS(.3) is  1.26610367
ASIN asin(number) Returns the arc sine of given argument  which  must be in the range of -1 to 1. ASIN(.3) is  .304692654
ATAN ATAN(number) Returns the arc tangent ATAN(.3) is  .291456794
CEIL CEIL(number) Returns the smallest integer value that is greater than or equal to a number. ceil(46.72) is 47
ceil(-46.72) is -46.
FLOOR FLOOR(number) Returns the greatest number that is less than or equal to given number. floor(2.8) is 2
floor(5.2) is 5
floor(-7.9) is -8
LOG Log(x,y) Returns the logarithm of  x base y.  LOG(5,2) is .430676558
MOD mod( x, y ) Returns modulus value,  the remainder of x divided by y.  MOD(6,3) is 0
MOD(6,4) is 2
POWER Power( m, n ) Returns x raised to the y th power. Power(6,2) is 36
REMAINDER REMAINDER(x,y) Remainder function returns the remainder of  x divided by y. remainder(25, 6)  is  1
remainder(25, 5) is 0
ROUND ROUND(x,y) Round off the x to the precison to y ROUND(2345.124,2) is  2345.12
ROUND(2345.125,2) is   2345.13
ROUND(2345.125,-1) is  2350
ROUND(2345.125,-2) is  2300
SIGN sign(number) If number < 0, then sign returns -1.
If number = 0, then sign returns 0.
If number > 0, then sign returns 1.
 SIGN(46) is 1
 SIGN(-46) is -1
SQRT SQRT(number) Returns square root sqrt(36) is 6
TRUNC trunc(number, decimal_places) Returns a number truncated to a certain number of decimal places trunc(675.265) is 675
trunc(675.265, 0) is 675
trunc(675.265, 1) is 675.2
trunc(675.265, 2) is 675.26
trunc(675.265, 3) is 675.265
trunc(-675.265, 2) is -675.26
trunc(675.265, -1) is 670
trunc(675.265, -2) is 600

No comments:

Post a Comment