From 074785cea106179cb3305637055ab0a009ca74f2 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:52 -0500 Subject: initial commit --- .../reference/global_objects/math/pi/index.html | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 files/pt-br/web/javascript/reference/global_objects/math/pi/index.html (limited to 'files/pt-br/web/javascript/reference/global_objects/math/pi') diff --git a/files/pt-br/web/javascript/reference/global_objects/math/pi/index.html b/files/pt-br/web/javascript/reference/global_objects/math/pi/index.html new file mode 100644 index 0000000000..22d97c22e9 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/math/pi/index.html @@ -0,0 +1,82 @@ +--- +title: Math.PI +slug: Web/JavaScript/Reference/Global_Objects/Math/PI +tags: + - JavaScript + - Math + - PI + - Propriedade +translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI +--- +
{{JSRef}}
+ +

A propriedade Math.PI representa a proporção entre circunferência de um círculo com o seu diâmetro, aproximadamente 3.14159:

+ +

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

+ +

{{EmbedInteractiveExample("pages/js/math-pi.html")}}

+ + + +
{{js_property_attributes(0, 0, 0)}}
+ +

Descrição

+ +

Como PI é uma propriedade estática de Math, sempre use-a como Math.PI, ao invés de uma propriedade de um objeto Math que você criou (Math não é um construtor).

+ +

Exemplos

+ +

Usando Math.PI

+ +

A seguinte função usa Math.PI para calcular a circunferência de um círculo com um dado raio.

+ +
function calcularCircunferencia(raio) {
+  return 2 * Math.PI * raio;
+}
+
+calcularCircunferencia(1);  // 6.283185307179586
+
+ +

Especificações

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('ES1')}}{{Spec2('ES1')}}Definiçao inicial. Implementado no JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.6', 'Math.PI')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.pi', 'Math.PI')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-math.pi', 'Math.PI')}}{{Spec2('ESDraft')}} 
+ +

Compatibilidade de navegadores

+ + + +

{{Compat("javascript.builtins.Math.PI")}}

+ +

Veja também

+ + -- cgit v1.2.3-54-g00ecf