--- title: Math.LN2 slug: Web/JavaScript/Reference/Global_Objects/Math/LN2 tags: - JavaScript - Math - Property - Reference translation_of: Web/JavaScript/Reference/Global_Objects/Math/LN2 ---
A propriedade Math.LN2
representa o logaritmo natural (também conhecido como logaritmo neperiano) de 2, que é aproximadamente 0.693:
Por LN2
ser uma propriedade estática de Math
, deve-se sempre usá-la como Math.LN2
, e não como uma propriedade de um objeto Math
que você criou.
Math.LN2
A função a seguir retorna o logaritmo natural de 2:
function getNatLog2() { return Math.LN2; } getNatLog2(); // 0.6931471805599453
Specification | Status | Comment |
---|---|---|
{{SpecName('ES1')}} | {{Spec2('ES1')}} | Initial definition. Implemented in JavaScript 1.0. |
{{SpecName('ES5.1', '#sec-15.8.1.3', 'Math.LN2')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-math.ln2', 'Math.LN2')}} | {{Spec2('ES6')}} | |
{{SpecName('ESDraft', '#sec-math.ln2', 'Math.LN2')}} | {{Spec2('ESDraft')}} |
{{Compat("javascript.builtins.Math.LN2")}}