Math.PI - JavaScript | MDN

  • Skip to main content
  • Skip to search

Cette page a été traduite à partir de l'anglais par la communauté. Vous pouvez contribuer en rejoignant la communauté francophone sur MDN Web Docs.

View in English Always switch to English

Math.PI Baseline Widely available

Cette fonctionnalité est bien établie et fonctionne sur de nombreux appareils et versions de navigateurs. Elle est disponible sur tous les navigateurs depuis juillet 2015.

  • Learn more
  • See full compatibility
  • Report feedback

La propriété Math.PI représente le ratio entre le périmètre d'un cercle et son diamètre. Elle vaut environ 3.14159:

Math.PI=π≈3.14159\mathtt{\mi{Math.PI}} = \pi \approx 3.14159

Dans cet article

  • Exemple interactif
  • Description
  • Exemples
  • Spécifications
  • Compatibilité des navigateurs
  • Voir aussi

Exemple interactif

function calculateCircumference(radius) { return 2 * Math.PI * radius; } console.log(Math.PI); // Expected output: 3.141592653589793 console.log(calculateCircumference(10)); // Expected output: 62.83185307179586
Attributs de Math.PI
ÉcrivableNon
ÉnumérableNon
ConfigurableNon

Description

PI est une propriété statique de l'objet Math et doit toujours être utilisée avec la syntaxe Math.PI plutôt que d'être appelée comme la propriété d'un autre objet qui aurait été crée (Math n'est pas un constructeur).

Exemples

Utiliser Math.PI

La fonction suivante utilise Math.PI afin de calculer le périmètre d'un cercle à partir du rayon passé en argument.

jsfunction calculPérimètre(rayon) { return 2 * Math.PI * rayon; } calculPérimètre(1); // 6.283185307179586

Spécifications

Specification
ECMAScript® 2026 Language Specification# sec-math.pi

Compatibilité des navigateurs

Voir aussi

  • Math

Help improve MDN

Cette page vous a-t-elle été utile ? Yes No Learn how to contribute

Cette page a été modifiée le 17 févr. 2025 par les contributeurs du MDN.

View this page on GitHub • Report a problem with this content Filter sidebar
  1. Objets natifs standards
  2. Math
  3. Méthodes statiques
    1. Math.abs()
    2. Math.acos()
    3. Math.acosh()
    4. Math.asin()
    5. Math.asinh()
    6. Math.atan()
    7. Math.atan2()
    8. Math.atanh()
    9. Math.cbrt()
    10. Math.ceil()
    11. Math.clz32()
    12. Math.cos()
    13. Math.cosh()
    14. Math.exp()
    15. Math.expm1()
    16. f16round()
    17. Math.floor()
    18. Math.fround()
    19. Math.hypot()
    20. Math.imul()
    21. Math.log()
    22. Math.log1p()
    23. Math.log2()
    24. Math.log10()
    25. Math.max()
    26. Math.min()
    27. Math.pow()
    28. Math.random()
    29. Math.round()
    30. Math.sign()
    31. Math.sin()
    32. Math.sinh()
    33. Math.sqrt()
    34. sumPrecise()
    35. Math.tan()
    36. Math.tanh()
    37. Math.trunc()
  4. Propriétés statiques
    1. Math.E
    2. Math.LN2
    3. Math.LN10
    4. Math.LOG2E
    5. Math.LOG10E
    6. Math.PI
    7. Math.SQRT1_2
    8. Math.SQRT2

Tag » Approximation Of Pi Javascript