Math Class Arithmetic : Math « Development « Flash / Flex / ActionScript






Math Class Arithmetic

 

Method Call      Returns 
Math.pow(a, b)      a raised to the b power (ab)
Math.exp(a)      e raised to the a power (ea)
Math.floor(a)      a rounded down
Math.ceil(a)      a rounded up
Math.round(a)      a rounded to the nearest digit
Math.max(a, b, c...)      Maximum of the set a, b, c  
Math.min(a, b, c...)      Minimum of the set a, b, c  
Math.sqrt(a)      Square root of a 
Math.abs(a)      Absolute value of a 
Math.log(a)      Logarithm (base 10) of a 
Math.ln(a)      Natural logarithm (base e) of a 

        








Related examples in the same category

1.Math Constants
2.Math Class Trigonometry
3.Math class includes the constant Math.PI for the number, ratio of a circle's circumference to its diameter.
4.Finding Absolute Values
5.Rounding and Truncating Numbers: round(), ceiling(), and floor()
6.The ceil() method returns the next-highest integer value of the number passed it as an argument.
7.The floor()returns the next-lowest integer.
8.Use round(), ceiling(), and floor() to round or truncate to decimal place values.
9.Generating Random Numbers: The random() returns a floating-point value between 0 and 0.999999, inclusive.
10.Generate a random number within a range that does not start with 0
11.Random integer values
12.If you are working with one six-sided die, you want to generate a random number between 1 and 6 each time
13.Finding the Greater or Lesser of Two Numbers
14.The calculation for finding compound interest: newValue = originalValue * (1 + rate/cp)^(cp*t)
15.package{
16.The exp() method requires one parameter: a number. It then raises e (Math.E) to the power of that number.
17.atan2(), takes two parameters (an X- and a Y-coordinate), and returns the angle formed by the right triangle measured in radians: Math.atan2(x, y)
18.Use Math.round( ) to round a number to the nearest integer
19.Use Math.floor( ) to round a number down
20.Use Math.ceil( ) to round a number up.
21.To round a number to the nearest decimal place:
22.Use the identical math to round a number to the nearest multiple of an integer.
23.All trig functions operate on radians, an angular unit in which radians measure a full revolution.
24.Generate random number in a range