diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:42:52 -0500 |
commit | 074785cea106179cb3305637055ab0a009ca74f2 (patch) | |
tree | e6ae371cccd642aa2b67f39752a2cdf1fd4eb040 /files/pt-br/web/javascript/reference/global_objects/math/cos | |
parent | da78a9e329e272dedb2400b79a3bdeebff387d47 (diff) | |
download | translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.gz translated-content-074785cea106179cb3305637055ab0a009ca74f2.tar.bz2 translated-content-074785cea106179cb3305637055ab0a009ca74f2.zip |
initial commit
Diffstat (limited to 'files/pt-br/web/javascript/reference/global_objects/math/cos')
-rw-r--r-- | files/pt-br/web/javascript/reference/global_objects/math/cos/index.html | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/files/pt-br/web/javascript/reference/global_objects/math/cos/index.html b/files/pt-br/web/javascript/reference/global_objects/math/cos/index.html new file mode 100644 index 0000000000..c0b0662477 --- /dev/null +++ b/files/pt-br/web/javascript/reference/global_objects/math/cos/index.html @@ -0,0 +1,102 @@ +--- +title: Math.cos() +slug: Web/JavaScript/Reference/Global_Objects/Math/cos +tags: + - Geometria + - JavaScript + - Matemática + - Math + - Trigonometría + - cos + - cosseno + - metodo +translation_of: Web/JavaScript/Reference/Global_Objects/Math/cos +--- +<div>{{JSRef}}</div> + +<p><span style="display: none;"> </span><span class="seoSummary">A função <strong><code>Math.cos()</code></strong> ,que é estatica, retorna o {{interwiki("wikipedia", "cosseno")}} de um ângulo, que deve estar em {{interwiki("wikipedia", "radianos")}}. A expressão é </span><math style="display: inline;"> <mstyle displaystyle="true"> <mfrac> <msub> <mrow> <mtext>length</mtext> </mrow> <mrow> <mrow> <mtext>adjacent</mtext> </mrow> </mrow> </msub> <msub> <mrow> <mtext>length</mtext> </mrow> <mrow> <mrow> <mtext>hypotenuse</mtext> </mrow> </mrow> </msub> </mfrac> </mstyle> </math>.<span style="display: none;"> </span></p> + +<div>{{EmbedInteractiveExample("pages/js/math-cos.html")}}</div> + + + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="syntaxbox"><code>Math.cos(<var>x</var>)</code></pre> + +<h3 id="Parâmetros">Parâmetros</h3> + +<dl> + <dt><code>x</code></dt> + <dd>Ângulo em radianos</dd> +</dl> + +<h3 id="Valor_de_retorno">Valor de retorno</h3> + +<p>O cosseno do número: x</p> + +<h2 id="Descrição">Descrição</h2> + +<p><code>Math.cos()</code> é um método que retorna um número entre -1 e 1, que representa o cosseno de um ângulo.</p> + +<p>Já que <code>cos()</code> é um método estático de <code>Math</code>, você sempre deve usar <code>Math.cos()</code>, ao invez de criar um objeto de <code>Math</code> (<code>Math</code> não tem construtor).</p> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Usando_Math.cos()">Usando <code>Math.cos()</code></h3> + +<pre class="brush: js">Math.cos(0); // 1 +Math.cos(1); // 0.5403023058681398 + +Math.cos(Math.PI); // -1 +Math.cos(2 * Math.PI); // 1 +</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>Initial definition. Implemented in JavaScript 1.0.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.8.2.7', 'Math.cos')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-math.cos', 'Math.cos')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-math.cos', 'Math.cos')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_dos_Browsers">Compatibilidade dos Browsers</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("javascript.builtins.Math.cos")}}</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{jsxref("Math.acos()")}}</li> + <li>{{jsxref("Math.asin()")}}</li> + <li>{{jsxref("Math.atan()")}}</li> + <li>{{jsxref("Math.atan2()")}}</li> + <li>{{jsxref("Math.sin()")}}</li> + <li>{{jsxref("Math.tan()")}}</li> +</ul> |