03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Returns<br />

Number - A number from -1.0 to 1.0.<br />

Example<br />

The following example displays the cosine for several different angles.<br />

trace (Math.cos(0)); // 0 degree angle. Output: 1<br />

trace (Math.cos(Math.PI/2)); // 90 degree angle. Output: 6.12303176911189e-<br />

17<br />

trace (Math.cos(Math.PI)); // 180 degree angle. Output: -1<br />

trace (Math.cos(Math.PI*2)); // 360 degree angle. Output: 1<br />

Note: The cosine of a 90 degree angle is zero, but because of the inherent inaccuracy of<br />

decimal calculations using binary numbers, Flash Player will report a number extremely close<br />

to, but not exactly equal to, zero.<br />

See also<br />

acos (Math.acos method), asin (Math.asin method), atan (Math.atan method),<br />

atan2 (Math.atan2 method), sin (Math.sin method), tan (Math.tan method)<br />

E (Math.E property)<br />

public static E : Number<br />

A mathematical constant for the base of natural logarithms, expressed as e. The approximate<br />

value of eis 2.71828182845905.<br />

Example<br />

This example shows how Math.E is used to compute continuously compounded interest for a<br />

simple case of 100 percent interest over a one-year period.<br />

var principal:Number = 100;<br />

var simpleInterest:Number = 100;<br />

var continuouslyCompoundedInterest:Number = (100 * Math.E) - principal;<br />

trace ("Beginning principal: $" + principal);<br />

trace ("Simple interest after one year: $" + simpleInterest);<br />

trace ("Continuously compounded interest after one year: $" +<br />

continuouslyCompoundedInterest);<br />

//<br />

Output:<br />

Beginning principal: $100<br />

Simple interest after one year: $100<br />

Continuously compounded interest after one year: $171.828182845905<br />

Math 383

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!