03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

cos (métho<strong>de</strong> Math.cos)<br />

statique publique cos(x:Number) : Number<br />

Calcule et renvoie le cosinus <strong>de</strong> l'angle spécifié en radians. Pour calculer un radian, consultez<br />

la <strong>de</strong>scription <strong>de</strong> l'entrée <strong>de</strong> la classe Math.<br />

Disponibilité : <strong>ActionScript</strong> 1.0 ; Flash Player 5<br />

Paramètres<br />

x:Number - Un nombre représentant un angle mesuré en radians.<br />

Renvoie<br />

Number - Un nombre compris entre -1,0 et 1,0.<br />

Exemple<br />

L'exemple suivant affiche le cosinus <strong>de</strong> plusieurs angles différents.<br />

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

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

17<br />

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

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

Remarque : Le cosinus d'un angle à 90 <strong>de</strong>grés est zéro, mais en raison <strong>de</strong> l'inexactitu<strong>de</strong><br />

inhérente <strong>de</strong>s calculs décimaux intégrant <strong>de</strong>s nombres binaires, Flash Player renvoie un<br />

nombre le plus proche <strong>de</strong> zéro, mais pas égal à zéro.<br />

Voir également<br />

acos (métho<strong>de</strong> Math.acos), asin (métho<strong>de</strong> Math.asin), atan (métho<strong>de</strong> Math.atan),<br />

atan2 (métho<strong>de</strong> Math.atan2), sin (métho<strong>de</strong> Math.sin), tan (métho<strong>de</strong> Math.tan)<br />

E (propriété Math.E)<br />

statique publique E : Number<br />

Constante mathématique pour la base <strong>de</strong>s logarithmes népériens, exprimée en e. La valeur<br />

approximative <strong>de</strong> e est 2,71828182845905.<br />

Disponibilité : <strong>ActionScript</strong> 1.0 ; Flash Player 5<br />

Exemple<br />

Cet exemple illustre l'utilisation <strong>de</strong> Math.E pour calculer les intérêts composés <strong>de</strong> façon<br />

continue d'un cas simple portant sur un intérêt à 100 % sur un an.<br />

var principal:Number = 100;<br />

774 Chapitre 2: Classes <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!