blob: e7897db852950710e1e9503e12e316aaf1773492 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
---
title: Math.log10()
slug: Web/JavaScript/Reference/Global_Objects/Math/log10
translation_of: Web/JavaScript/Reference/Global_Objects/Math/log10
original_slug: Web/JavaScript/Referencia/Objetos_globales/Math/log10
---
<div>{{JSRef}}</div>
<p><strong><code>Math.log10()</code></strong> funcion que retorna el logaritmo de base 10 de un numero, esto es</p>
<p><math display="block"><semantics><mrow><mo>∀</mo><mi>x</mi><mo>></mo><mn>0</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.log10</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><msub><mo lspace="0em" rspace="0em">log</mo><mn>10</mn></msub><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mtext>la unica</mtext><mspace width="thickmathspace"></mspace><mi>y tal que</mi><mspace width="thickmathspace"></mspace><mtext></mtext><mspace width="thickmathspace"></mspace><msup><mn>10</mn><mi>y</mi></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x > 0, \mathtt{\operatorname{Math.log10}(x)} = \log_10(x) = \text{the unique} \; y \; \text{such that} \; 10^y = x</annotation></semantics></math></p>
<h2 id="Sintaxis">Sintaxis</h2>
<pre class="syntaxbox">Math.log10(<var>x</var>)</pre>
<h3 id="Parametros">Parametros</h3>
<dl>
<dt><code>x</code></dt>
<dd>Un Numero</dd>
</dl>
<h3 id="Valor_de_Retorno">Valor de Retorno</h3>
<p>El logaritmo de base 10 del numero dado. SI el numero es negativo, {{jsxref("NaN")}} es devuelto.</p>
<h2 id="Descripción">Descripción</h2>
<p>Si el valor de x es menor que cero, el valor de retorno siempre es {{jsxref("NaN")}}.</p>
<p>Porque <code>log10()</code> <code>es un metodo estatico de Math</code>, debe usarse siempre <code>Math.log10()</code>, en vez de usarse como un metodo del objeto math que se ha creado (<code>Math</code> no es un constructor).</p>
<p>Esta función es equivalente de Math.log(x) / Math.log(10). Para log10(e) use la constante {{jsxref("Math.LOG10E")}} que es 1 / {{jsxref("Math.LN10")}}. </p>
<h2 id="Ejemplos">Ejemplos</h2>
<h3 id="usando_Math.log10()">usando <code>Math.log10()</code></h3>
<pre class="brush: js">Math.log10(2); // 0.3010299956639812
Math.log10(1); // 0
Math.log10(0); // -Infinito
Math.log10(-2); // NaN
Math.log10(100000); // 5
</pre>
<h2 id="Polyfill">Polyfill</h2>
<p>Puede ser emulada con la siguiente función</p>
<pre class="brush: js">Math.log10 = Math.log10 || function(x) {
return Math.log(x) * Math.LOG10E;
};
</pre>
<h2 id="Especificaciones">Especificaciones</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Especificacion</th>
<th scope="col">Estado</th>
<th scope="col">Comentarios</th>
</tr>
<tr>
<td>{{SpecName('ES6', '#sec-math.log10', 'Math.log10')}}</td>
<td>{{Spec2('ES6')}}</td>
<td>Initial definition.</td>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-math.log10', 'Math.log10')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td> </td>
</tr>
</tbody>
</table>
<h2 id="Compatibilidad_con_Navegadores">Compatibilidad con Navegadores</h2>
{{Compat("javascript.builtins.Math.log10")}}
<h2 id="Vea_Tambien">Vea Tambien</h2>
<ul>
<li>{{jsxref("Math.exp()")}}</li>
<li>{{jsxref("Math.log()")}}</li>
<li>{{jsxref("Math.log1p()")}}</li>
<li>{{jsxref("Math.log2()")}}</li>
<li>{{jsxref("Math.pow()")}}</li>
</ul>
|