From 95aca4b4d8fa62815d4bd412fff1a364f842814a Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Thu, 29 Apr 2021 16:16:42 -0700 Subject: remove retired locales (#699) --- .../reference/global_objects/math/abs/index.html | 130 ------------- .../reference/global_objects/math/acos/index.html | 132 ------------- .../reference/global_objects/math/acosh/index.html | 127 ------------- .../reference/global_objects/math/asin/index.html | 134 ------------- .../reference/global_objects/math/asinh/index.html | 126 ------------- .../reference/global_objects/math/atan/index.html | 128 ------------- .../reference/global_objects/math/atan2/index.html | 140 -------------- .../reference/global_objects/math/atanh/index.html | 128 ------------- .../reference/global_objects/math/cbrt/index.html | 123 ------------ .../reference/global_objects/math/ceil/index.html | 198 -------------------- .../reference/global_objects/math/clz32/index.html | 156 ---------------- .../reference/global_objects/math/cos/index.html | 129 ------------- .../reference/global_objects/math/cosh/index.html | 131 ------------- .../reference/global_objects/math/e/index.html | 119 ------------ .../reference/global_objects/math/exp/index.html | 124 ------------ .../reference/global_objects/math/expm1/index.html | 123 ------------ .../reference/global_objects/math/floor/index.html | 195 ------------------- .../global_objects/math/fround/index.html | 119 ------------ .../reference/global_objects/math/hypot/index.html | 140 -------------- .../reference/global_objects/math/imul/index.html | 121 ------------ .../reference/global_objects/math/index.html | 206 -------------------- .../reference/global_objects/math/ln10/index.html | 119 ------------ .../reference/global_objects/math/ln2/index.html | 119 ------------ .../reference/global_objects/math/log/index.html | 138 -------------- .../reference/global_objects/math/log10/index.html | 127 ------------- .../global_objects/math/log10e/index.html | 119 ------------ .../reference/global_objects/math/log1p/index.html | 126 ------------- .../reference/global_objects/math/log2/index.html | 128 ------------- .../reference/global_objects/math/log2e/index.html | 119 ------------ .../reference/global_objects/math/max/index.html | 135 ------------- .../reference/global_objects/math/min/index.html | 141 -------------- .../reference/global_objects/math/pi/index.html | 117 ------------ .../reference/global_objects/math/pow/index.html | 141 -------------- .../global_objects/math/random/index.html | 127 ------------- .../reference/global_objects/math/round/index.html | 208 --------------------- .../reference/global_objects/math/sign/index.html | 132 ------------- .../reference/global_objects/math/sin/index.html | 128 ------------- .../reference/global_objects/math/sinh/index.html | 130 ------------- .../reference/global_objects/math/sqrt/index.html | 128 ------------- .../global_objects/math/sqrt1_2/index.html | 118 ------------ .../reference/global_objects/math/sqrt2/index.html | 118 ------------ .../reference/global_objects/math/tan/index.html | 141 -------------- .../reference/global_objects/math/tanh/index.html | 143 -------------- .../reference/global_objects/math/trunc/index.html | 130 ------------- 44 files changed, 5961 deletions(-) delete mode 100644 files/ca/web/javascript/reference/global_objects/math/abs/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/acos/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/acosh/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/asin/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/asinh/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/atan/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/atan2/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/atanh/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/cbrt/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/ceil/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/clz32/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/cos/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/cosh/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/e/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/exp/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/expm1/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/floor/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/fround/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/hypot/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/imul/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/ln10/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/ln2/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/log/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/log10/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/log10e/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/log1p/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/log2/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/log2e/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/max/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/min/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/pi/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/pow/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/random/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/round/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/sign/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/sin/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/sinh/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/sqrt/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/sqrt1_2/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/sqrt2/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/tan/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/tanh/index.html delete mode 100644 files/ca/web/javascript/reference/global_objects/math/trunc/index.html (limited to 'files/ca/web/javascript/reference/global_objects/math') diff --git a/files/ca/web/javascript/reference/global_objects/math/abs/index.html b/files/ca/web/javascript/reference/global_objects/math/abs/index.html deleted file mode 100644 index db78802c1f..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/abs/index.html +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Math.abs() -slug: Web/JavaScript/Reference/Global_Objects/Math/abs -translation_of: Web/JavaScript/Reference/Global_Objects/Math/abs -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/abs ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.abs() retorna el valor absolut d'un nombre. És a dir:

- -

Math.abs(x)=|x|={xifx>00ifx=0-xifx<0{\mathtt{\operatorname{Math.abs}(x)}} = {|x|} = \begin{cases} x & \text{if} \quad x \geq 0 \\ -x & \text{if} \quad x < 0 \end{cases}

- -

Sintaxi

- -
Math.abs(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Degut a que abs() és un mètode estàtic de Math, sempre s'utilitza com a Math.abs(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Comportament de Math.abs()

- -

Si li passem una string no numèric o bé una variable {{jsxref("undefined")}}/buida retorna {{jsxref("NaN")}}. Passar {{jsxref("null")}} retorna 0.

- -
Math.abs('-1');     // 1
-Math.abs(-2);       // 2
-Math.abs(null);     // 0
-Math.abs('string'); // NaN
-Math.abs();         // NaN
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.1', 'Math.abs')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.abs', 'Math.abs')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/acos/index.html b/files/ca/web/javascript/reference/global_objects/math/acos/index.html deleted file mode 100644 index 0adb3c11e4..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/acos/index.html +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: Math.acos() -slug: Web/JavaScript/Reference/Global_Objects/Math/acos -translation_of: Web/JavaScript/Reference/Global_Objects/Math/acos -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/acos ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.acos() retorna l'arccosinus (mesurat en radians) d'un nombre, és a dir:x[-1;1],Math.acos(x)=arccos(x)= l'únic y[0;π]tal quecos(y)=x\forall x \in [{-1};1],\;\mathtt{\operatorname{Math.acos}(x)} = \arccos(x) = \text{ the unique } \; y \in [0; \pi] \, \text{such that} \; \cos(y) = x

- -

Sintaxi

- -
Math.acos(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

El mètode Math.acos() retorna un valor numèric entre 0 i π radians per a x entre -1 i 1. Si el valor de x està fora d'aquest rang, retorna {{jsxref("NaN")}}.

- -

Degut a que acos() és un mètode estàtic de Math, sempre s'utilitza com a Math.acos(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.acos()

- -
Math.acos(-2);  // NaN
-Math.acos(-1);  // 3.141592653589793
-Math.acos(0);   // 1.5707963267948966
-Math.acos(0.5); // 1.0471975511965979
-Math.acos(1);   // 0
-Math.acos(2);   // NaN
-
- -

Per a valors menors que -1 o majors que 1, Math.acos() retorna {{jsxref("NaN")}}.

- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.2', 'Math.acos')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.acos', 'Math.acos')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/acosh/index.html b/files/ca/web/javascript/reference/global_objects/math/acosh/index.html deleted file mode 100644 index 08561aeed1..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/acosh/index.html +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: Math.acosh() -slug: Web/JavaScript/Reference/Global_Objects/Math/acosh -translation_of: Web/JavaScript/Reference/Global_Objects/Math/acosh -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/acosh ---- -
{{JSRef}}
- -

La funció Math.acosh() retorna l'accosinus hiperbòlic d'un nombre, és a dir

- -

x1,Math.acosh(x)=arcosh(x)= l'única y0tal quecosh(y)=x\forall x \geq 1, \mathtt{\operatorname{Math.acosh}(x)} = \operatorname{arcosh}(x) = \text{ the unique } \; y \geq 0 \; \text{such that} \; \cosh(y) = x

- -

Sintaxi

- -
Math.acosh(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que que acosh() és un mètode estàtic de Math, sempre s'utilitza com a Math.acosh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.acosh()

- -
Math.acosh(-1); // NaN
-Math.acosh(0);  // NaN
-Math.acosh(0.5) // NaN
-Math.acosh(1);  // 0
-Math.acosh(2);  // 1.3169578969248166
-
- -

Math.acosh() retorna {{jsxref("NaN")}} per a valors menors que 1.

- -

Polyfill

- -

Per a tot x1x \geq 1, tenim que arcosh(x)=ln(x+x2-1)\operatorname {arcosh} (x) = \ln \left(x + \sqrt{x^{2} - 1} \right) i, per tant, es pot emular mitjançant la funció següent:

- -
Math.acosh = Math.acosh || function(x) {
-  return Math.log(x + Math.sqrt(x * x - 1));
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacionsEstatComentaris
{{SpecName('ES6', '#sec-math.acosh', 'Math.acosh')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/asin/index.html b/files/ca/web/javascript/reference/global_objects/math/asin/index.html deleted file mode 100644 index 5174ee4643..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/asin/index.html +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: Math.asin() -slug: Web/JavaScript/Reference/Global_Objects/Math/asin -translation_of: Web/JavaScript/Reference/Global_Objects/Math/asin -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/asin ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.asin() retorna l'arcsinus (en radians) d'un nombre, és a dir:

- -

x[-1;1],Math.asin(x)=arcsin(x)= l'únic y[-π2;π2]tal que  sin(y)=x\forall x \in [{-1};1],\;\mathtt{\operatorname{Math.asin}(x)} = \arcsin(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \sin(y) = x

- -

Sintaxi

- -
Math.asin(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

El mètode Math.asin() retorna un valor numèric entre -π2-\frac{\pi}{2} i π2\frac{\pi}{2} radians per a x entre -1 i 1. Si el valor de x està fora d'aquest rang la funció retorna {{jsxref("NaN")}}.

- -

Degut a que asin() és un mètode estàtic de Math, sempre s'utilitza com a Math.asin(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Ús de Math.asin()

- -
Math.asin(-2);  // NaN
-Math.asin(-1);  // -1.5707963267948966 (-pi/2)
-Math.asin(0);   // 0
-Math.asin(0.5); // 0.5235987755982989
-Math.asin(1);   // 1.570796326794897 (pi/2)
-Math.asin(2);   // NaN
-
- -

Per a valors menors que -1 o majors que 1, Math.asin() retorna {{jsxref("NaN")}}.

- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.3', 'Math.asin')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.asin', 'Math.asin')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/asinh/index.html b/files/ca/web/javascript/reference/global_objects/math/asinh/index.html deleted file mode 100644 index 52c70da63f..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/asinh/index.html +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: Math.asinh() -slug: Web/JavaScript/Reference/Global_Objects/Math/asinh -translation_of: Web/JavaScript/Reference/Global_Objects/Math/asinh -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/asinh ---- -
{{JSRef}}
- -

La funció Math.asinh() retorna l'arcsinus hiperbòlic d'un nombre, és a dir

- -

Math.asinh(x)=arsinh(x)= l'única ytal quesinh(y)=x\mathtt{\operatorname{Math.asinh}(x)} = \operatorname{arsinh}(x) = \text{ the unique } \; y \; \text{such that} \; \sinh(y) = x

- -

Sintaxi

- -
Math.asinh(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que que asinh() és un mètode estàtic de Math, sempre s'utilitza com a Math.asinh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.asinh()

- -
Math.asinh(1);  // 0.881373587019543
-Math.asinh(0);  // 0
-
- -

Polyfill

- -

Tenim que arsinh(x)=ln(x+x2+1)\operatorname {arsinh} (x) = \ln \left(x + \sqrt{x^{2} + 1} \right) amb el que podem emular el comportament amb la funció següent:

- -
Math.asinh = Math.asinh || function(x) {
-  if (x === -Infinity) {
-    return x;
-  } else {
-    return Math.log(x + Math.sqrt(x * x + 1));
-  }
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.asinh', 'Math.asinh')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/atan/index.html b/files/ca/web/javascript/reference/global_objects/math/atan/index.html deleted file mode 100644 index 01832ac269..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/atan/index.html +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Math.atan() -slug: Web/JavaScript/Reference/Global_Objects/Math/atan -translation_of: Web/JavaScript/Reference/Global_Objects/Math/atan -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/atan ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.atan() retorna l'arctangent (en radians) d'un nombre, és a dir:

- -

Math.atan(x)=arctan(x)= l'unic y[-π2;π2]tal quetan(y)=x\mathtt{\operatorname{Math.atan}(x)} = \arctan(x) = \text{ the unique } \; y \in \left[-\frac{\pi}{2}; \frac{\pi}{2}\right] \, \text{such that} \; \tan(y) = x

- -

Sintaxi

- -
Math.atan(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

El mètode Math.atan() retorna un valor numèric entre -π2-\frac{\pi}{2} i π2\frac{\pi}{2} radians.

- -

Degut a que atan() és un mètode estàtic de Math, sempre s'utilitza com a Math.atan(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.atan()

- -
Math.atan(1);  // 0.7853981633974483
-Math.atan(0);  // 0
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.4', 'Math.atan')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.atan', 'Math.atan')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/atan2/index.html b/files/ca/web/javascript/reference/global_objects/math/atan2/index.html deleted file mode 100644 index 6cd84d1004..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/atan2/index.html +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: Math.atan2() -slug: Web/JavaScript/Reference/Global_Objects/Math/atan2 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/atan2 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/atan2 ---- -
{{JSRef}}
- -

La funció Math.atan2() retorna l'arctangent del quocient dels arguments passats.

- -

Sintaxi

- -
Math.atan2(y, x)
- -

Paràmetres

- -
-
y
-
Primer nombre.
-
x
-
Segon nombre.
-
- -

Descripció

- -

El mètode Math.atan2() retorn aun valor numèric entre -π i π que representa l'angle theta d'un punt (x, y). Aquest angle es representa en radiants, en sentit contrari a les agulles del rellotge, entre l'eix positiu X i el punt (x, y). Cal destacar que els arguments d'aquesta funció representen les coordenades del punt, on el primer argument representa la coordenada y i el segon argument representa la coordenada x.

- -

Math.atan2() rep els arguments x i y de forma separada mentre que Math.atan() rep la relació (ratio) entre aquests dos arguments.

- -

Com que que atan2() és un mètode estàtic de Math, sempre s'utilitza com a Math.atan2(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.atan2()

- -
Math.atan2(90, 15); // 1.4056476493802699
-Math.atan2(15, 90); // 0.16514867741462683
-
-Math.atan2(±0, -0);               // ±PI.
-Math.atan2(±0, +0);               // ±0.
-Math.atan2(±0, -x);               // ±PI for x > 0.
-Math.atan2(±0, x);                // ±0 for x > 0.
-Math.atan2(-y, ±0);               // -PI/2 for y > 0.
-Math.atan2(y, ±0);                // PI/2 for y > 0.
-Math.atan2(±y, -Infinity);        // ±PI for finite y > 0.
-Math.atan2(±y, +Infinity);        // ±0 for finite y > 0.
-Math.atan2(±Infinity, x);         // ±PI/2 for finite x.
-Math.atan2(±Infinity, -Infinity); // ±3*PI/4.
-Math.atan2(±Infinity, +Infinity); // ±PI/4.
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.5', 'Math.atan2')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.atan2', 'Math.atan2')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/atanh/index.html b/files/ca/web/javascript/reference/global_objects/math/atanh/index.html deleted file mode 100644 index 2b492dbdcc..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/atanh/index.html +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Math.atanh() -slug: Web/JavaScript/Reference/Global_Objects/Math/atanh -translation_of: Web/JavaScript/Reference/Global_Objects/Math/atanh -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/atanh ---- -
{{JSRef}}
- -

La funció Math.atanh() retorna l'arctangent hiperbòlica d'un nombre, és a dir

- -

x(-1,1),Math.atanh(x)=arctanh(x)= l'única ytal quetanh(y)=x\forall x \in \left( -1, 1 \right), \mathtt{\operatorname{Math.atanh}(x)} = \operatorname{arctanh}(x) = \text{ the unique } \; y \; \text{such that} \; \tanh(y) = x

- -

Sintaxi

- -
Math.atanh(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que que atanh() és un mètode estàtic de Math, sempre s'utilitza com a Math.atanh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.atanh()

- -
Math.atanh(-2);  // NaN
-Math.atanh(-1);  // -Infinity
-Math.atanh(0);   // 0
-Math.atanh(0.5); // 0.5493061443340548
-Math.atanh(1);   // Infinity
-Math.atanh(2);   // NaN
-
- -

Es retorna {{jsxref("NaN")}} per a valors més grans que 1 o més petits que -1.

- -

Polyfill

- -

Per a |x|<1\left|x\right| < 1, tenim que artanh(x)=12ln(1+x1-x)\operatorname {artanh} (x) = \frac{1}{2}\ln \left( \frac{1 + x}{1 - x} \right) , que podem emular amb la funció següent:

- -
Math.atanh = Math.atanh || function(x) {
-  return Math.log((1+x)/(1-x)) / 2;
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.atanh', 'Math.atanh')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/cbrt/index.html b/files/ca/web/javascript/reference/global_objects/math/cbrt/index.html deleted file mode 100644 index a973b5e724..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/cbrt/index.html +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: Math.cbrt() -slug: Web/JavaScript/Reference/Global_Objects/Math/cbrt -translation_of: Web/JavaScript/Reference/Global_Objects/Math/cbrt -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/cbrt ---- -
{{JSRef}}
- -

La funció Math.cbrt() retorna la rel cúbica d'un nombre, és a dir

- -

Math.cbrt(x)=x3=la únicaytal quey3=x\mathtt{Math.cbrt(x)} = \sqrt[3]{x} = \text{the unique} \; y \; \text{such that} \; y^3 = x

- -

Sintaxi

- -
Math.cbrt(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Degut a que cbrt() és un mètode estàtic de Math, sempre s'utilitza com a Math.cbrt(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.cbrt()

- -
Math.cbrt(-1); // -1
-Math.cbrt(0);  // 0
-Math.cbrt(1);  // 1
-
-Math.cbrt(2);  // 1.2599210498948734
-
- -

Polyfill

- -

Per a tot x0x \geq 0, tenim que x3=x1/3\sqrt[3]{x} = x^{1/3} , podem llavors emular aquest comportament amb la funció següent:

- -
Math.cbrt = Math.cbrt || function(x) {
-  var y = Math.pow(Math.abs(x), 1/3);
-  return x < 0 ? -y : y;
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.cbrt', 'Math.cbrt')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/ceil/index.html b/files/ca/web/javascript/reference/global_objects/math/ceil/index.html deleted file mode 100644 index 5495818286..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/ceil/index.html +++ /dev/null @@ -1,198 +0,0 @@ ---- -title: Math.ceil() -slug: Web/JavaScript/Reference/Global_Objects/Math/ceil -translation_of: Web/JavaScript/Reference/Global_Objects/Math/ceil -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/ceil ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.ceil() retorna el més petit dels nombres sencers més grans o iguals a un nombre donat.

- -

Sintaxi

- -
Math.ceil(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Degut a que ceil() és un mètode estàtic de Math, sempre s'utilitza com a Math.ceil(), ren comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Ús de Math.ceil()

- -

L'exemple següent mostra l'ús de Math.ceil().

- -
Math.ceil(.95);   // 1
-Math.ceil(4);     // 4
-Math.ceil(7.004); // 8
-
- -

Exemple: Ajust decimal

- -
// Closure
-(function() {
-  /**
-   * Decimal adjustment of a number.
-   *
-   * @param {String}  type  The type of adjustment.
-   * @param {Number}  value The number.
-   * @param {Integer} exp   The exponent (the 10 logarithm of the adjustment base).
-   * @returns {Number} The adjusted value.
-   */
-  function decimalAdjust(type, value, exp) {
-    // If the exp is undefined or zero...
-    if (typeof exp === 'undefined' || +exp === 0) {
-      return Math[type](value);
-    }
-    value = +value;
-    exp = +exp;
-    // If the value is not a number or the exp is not an integer...
-    if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
-      return NaN;
-    }
-    // Shift
-    value = value.toString().split('e');
-    value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
-    // Shift back
-    value = value.toString().split('e');
-    return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
-  }
-
-  // Decimal round
-  if (!Math.round10) {
-    Math.round10 = function(value, exp) {
-      return decimalAdjust('round', value, exp);
-    };
-  }
-  // Decimal floor
-  if (!Math.floor10) {
-    Math.floor10 = function(value, exp) {
-      return decimalAdjust('floor', value, exp);
-    };
-  }
-  // Decimal ceil
-  if (!Math.ceil10) {
-    Math.ceil10 = function(value, exp) {
-      return decimalAdjust('ceil', value, exp);
-    };
-  }
-})();
-
-// Round
-Math.round10(55.55, -1);   // 55.6
-Math.round10(55.549, -1);  // 55.5
-Math.round10(55, 1);       // 60
-Math.round10(54.9, 1);     // 50
-Math.round10(-55.55, -1);  // -55.5
-Math.round10(-55.551, -1); // -55.6
-Math.round10(-55, 1);      // -50
-Math.round10(-55.1, 1);    // -60
-// Floor
-Math.floor10(55.59, -1);   // 55.5
-Math.floor10(59, 1);       // 50
-Math.floor10(-55.51, -1);  // -55.6
-Math.floor10(-51, 1);      // -60
-// Ceil
-Math.ceil10(55.51, -1);    // 55.6
-Math.ceil10(51, 1);        // 60
-Math.ceil10(-55.59, -1);   // -55.5
-Math.ceil10(-59, 1);       // -50
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.6', 'Math.ceil')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.ceil', 'Math.ceil')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/clz32/index.html b/files/ca/web/javascript/reference/global_objects/math/clz32/index.html deleted file mode 100644 index 74c1cecef7..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/clz32/index.html +++ /dev/null @@ -1,156 +0,0 @@ ---- -title: Math.clz32() -slug: Web/JavaScript/Reference/Global_Objects/Math/clz32 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/clz32 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/clz32 ---- -
{{JSRef}}
- -

La funció Math.clz32() retorna el nombre de zeros a l'esquerra que apareixen en una representació binària de 32 bits per a un nombre.

- -

Sintaxi

- -
Math.clz32(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

"clz32" és una abreviació de CountLeadingZeroes32.

- -

Si x no és un nombre, primer es convertirà a un nombre, i després es convertirà a un nombre sencer de 32 bits sense signe.

- -

Si el nombre sencer sense signe de 32 bits és 0, la funció retornarà 32 ja que tots els bits són 0.

- -

Aquesta funció és particulament útil per a sistemes que compilin en JavaScript, com ara Emscripten.

- -

Exemples

- -

Utilitzar Math.clz32()

- -
Math.clz32(1);                // 31
-Math.clz32(1000);             // 22
-Math.clz32();                 // 32
-
-[NaN, Infinity, -Infinity, 0, -0, null, undefined, 'foo', {}, []].filter(
-function(n) {
-  return Math.clz32(n) !== 32
-});                           // []
-
-Math.clz32(true);             // 31
-Math.clz32(3.5);              // 30
-
- -

Polyfill

- -

Aquesta funció polyfill utilitza {{jsxref("Math.imul")}}.

- -
Math.clz32 = Math.clz32 || (function () {
-  'use strict';
-
-  var table = [
-    32, 31,  0, 16,  0, 30,  3,  0, 15,  0,  0,  0, 29, 10,  2,  0,
-     0,  0, 12, 14, 21,  0, 19,  0,  0, 28,  0, 25,  0,  9,  1,  0,
-    17,  0,  4,   ,  0,  0, 11,  0, 13, 22, 20,  0, 26,  0,  0, 18,
-     5,  0,  0, 23,  0, 27,  0,  6,  0, 24,  7,  0,  8,  0,  0,  0]
-
-  // Adaptat d'un algorisme trobat a Hacker's Delight, pàgina 103.
-  return function (x) {
-    // Tingueu en compte que les variables no tenen perquè ser les mateixes.
-
-    // 1. On n = ToUint32(x).
-    var v = Number(x) >>> 0
-
-    // 2. On p és el nombre de zeros a l'esquerra en la representació binària de 32 bits de n.
-    v |= v >>> 1
-    v |= v >>> 2
-    v |= v >>> 4
-    v |= v >>> 8
-    v |= v >>> 16
-    v = table[Math.imul(v, 0x06EB14F9) >>> 26]
-
-    // Retorna p.
-    return v
-  }
-})();
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.clz32', 'Math.clz32')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("31")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("31")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/cos/index.html b/files/ca/web/javascript/reference/global_objects/math/cos/index.html deleted file mode 100644 index 00d090ed20..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/cos/index.html +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: Math.cos() -slug: Web/JavaScript/Reference/Global_Objects/Math/cos -translation_of: Web/JavaScript/Reference/Global_Objects/Math/cos -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/cos ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.cos() retorna el cosinus d'un nombre.

- -

Sintaxi

- -
Math.cos(x)
- -

Paràmetres

- -
-
x
-
Un nombre, mesurat en radians.
-
- -

Descripció

- -

El mètode Math.cos() retorna un valor numèric entre -1 i 1, que representa el cosinus d'un angle.

- -

Degut a que cos() és un mètode estàtic de Math, sempre s'utilitza com a Math.cos(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.cos()

- -
Math.cos(0);           // 1
-Math.cos(1);           // 0.5403023058681398
-
-Math.cos(Math.PI);     // -1
-Math.cos(2 * Math.PI); // 1
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.7', 'Math.cos')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.cos', 'Math.cos')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/cosh/index.html b/files/ca/web/javascript/reference/global_objects/math/cosh/index.html deleted file mode 100644 index f3d4dffb1b..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/cosh/index.html +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: Math.cosh() -slug: Web/JavaScript/Reference/Global_Objects/Math/cosh -translation_of: Web/JavaScript/Reference/Global_Objects/Math/cosh -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/cosh ---- -
{{JSRef}}
- -

La funció Math.cosh() retorna el cosinus hiperbòlic d'un nombre, això es pot expressar utilitzant la {{jsxref("Math.E", "constant e", "", 1)}}:

- -

Math.cosh(x)=ex+e-x2\mathtt{\operatorname{Math.cosh(x)}} = \frac{e^x + e^{-x}}{2}

- -

Sintaxi

- -
Math.cosh(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que que cosh() és un mètode estàtic de Math, sempre s'utilitza com a Math.cosh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.cosh()

- -
Math.cosh(0);  // 1
-Math.cosh(1);  // 1.5430806348152437
-Math.cosh(-1); // 1.5430806348152437
-
- -

Polyfill

- -

Aquesta funció es pot emular amb l'ajuda de la funció {{jsxref("Math.exp()")}}:

- -
Math.cosh = Math.cosh || function(x) {
-  return (Math.exp(x) + Math.exp(-x)) / 2;
-}
-
- -

o bé utilitzant només una crida a la funció {{jsxref("Math.exp()")}}:

- -
Math.cosh = Math.cosh || function(x) {
-  var y = Math.exp(x);
-  return (y + 1 / y) / 2;
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.cosh', 'Math.cosh')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/e/index.html b/files/ca/web/javascript/reference/global_objects/math/e/index.html deleted file mode 100644 index 90dba24a0d..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/e/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Math.E -slug: Web/JavaScript/Reference/Global_Objects/Math/E -translation_of: Web/JavaScript/Reference/Global_Objects/Math/E -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/E ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.E representa la base dels logaritmes naturals, e, el seu valor aproximat és de 2.718.

- -

Math.E=e2.718\mathtt{\mi{Math.E}} = e \approx 2.718

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Com que E és una propietat estàtica de Math, sempre s'utilitza com Math.E en comptes de com una propietat d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.E

- -

La funció que trobareu a continuació retorna e:

- -
function getNapier() {
-  return Math.E;
-}
-
-getNapier(); // 2.718281828459045
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat en JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.1', 'Math.E')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.e', 'Math.E')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/exp/index.html b/files/ca/web/javascript/reference/global_objects/math/exp/index.html deleted file mode 100644 index 2b1b92004f..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/exp/index.html +++ /dev/null @@ -1,124 +0,0 @@ ---- -title: Math.exp() -slug: Web/JavaScript/Reference/Global_Objects/Math/exp -translation_of: Web/JavaScript/Reference/Global_Objects/Math/exp -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/exp ---- -
{{JSRef}}
- -

La funció Math.exp() retorna ex, on x és l'argument, i e és {{jsxref("Math.E", "la constant d'Euler", "", 1)}}, la base dels logaritmes naturals.

- -

Sintaxi

- -
Math.exp(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Deguat a que exp() és un mètode estàtic de Math, aquest pot emprar-se com a Math.exp(), en comptes de cridar-lo com un mètode d'un objecte de tipus Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.exp()

- -
Math.exp(-1); // 0.36787944117144233
-Math.exp(0);  // 1
-Math.exp(1);  // 2.718281828459045
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.8', 'Math.exp')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.exp', 'Math.exp')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/expm1/index.html b/files/ca/web/javascript/reference/global_objects/math/expm1/index.html deleted file mode 100644 index 017cdc895a..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/expm1/index.html +++ /dev/null @@ -1,123 +0,0 @@ ---- -title: Math.expm1() -slug: Web/JavaScript/Reference/Global_Objects/Math/expm1 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/expm1 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/expm1 ---- -
{{JSRef}}
- -

La funció Math.expm1() retorna ex - 1, on x és l'argument i {{jsxref("Math.E", "e", "", 1)}} és la base dels logaritmes naturals.

- -

Sintaxi

- -
Math.expm1(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que expm1() és un mètode estàtic de Math, sempre s'utilitza com Math.expm1() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.expm1()

- -
Math.expm1(-1); // -0.6321205588285577
-Math.expm1(0);  // 0
-Math.expm1(1);  // 1.718281828459045
-
- -

Polyfill

- -

Aquesta funció pot ser emulada amb l'ajuda de la funció {{jsxref("Math.exp()")}}:

- -
Math.expm1 = Math.expm1 || function(x) {
-  return Math.exp(x) - 1;
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.expm1', 'Math.expm1')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/floor/index.html b/files/ca/web/javascript/reference/global_objects/math/floor/index.html deleted file mode 100644 index f86e9d6ed8..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/floor/index.html +++ /dev/null @@ -1,195 +0,0 @@ ---- -title: Math.floor() -slug: Web/JavaScript/Reference/Global_Objects/Math/floor -translation_of: Web/JavaScript/Reference/Global_Objects/Math/floor -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/floor ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.floor() retorna el nombre més gran dels nombres més petits o iguals a un nombre donat.

- -

Sintaxi

- -
Math.floor(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Degut a que floor() és un mètode estàtic de Math, sempre s'utilitza com a Math.floor(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.floor()

- -
Math.floor( 45.95); //  45
-Math.floor(-45.95); // -46
-
- -

Exemple: Ajust decimal

- -
// Closure
-(function() {
-  /**
-   * Ajust decimal d'un nombre.
-   *
-   * @param {String}  type  El tipus d'ajust.
-   * @param {Number}  value El nombre.
-   * @param {Integer} exp   L'exponent (L'algoritme en base 10  de la base d'ajust
-   * @returns {Number} El valor ajustat.
-   */
-  function decimalAdjust(type, value, exp) {
-    // Si exp és undefined o zero...
-    if (typeof exp === 'undefined' || +exp === 0) {
-      return Math[type](value);
-    }
-    value = +value;
-    exp = +exp;
-    // Si value no és un nombre o exp no és un nombre sencer...
-    if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
-      return NaN;
-    }
-    // Desplaçament
-    value = value.toString().split('e');
-    value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
-    // Desfer el desplaçament
-    value = value.toString().split('e');
-    return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
-  }
-
-  // Arrodoniment decimal
-  if (!Math.round10) {
-    Math.round10 = function(value, exp) {
-      return decimalAdjust('round', value, exp);
-    };
-  }
-  // Arrodoniment decimal a la baixa
-  if (!Math.floor10) {
-    Math.floor10 = function(value, exp) {
-      return decimalAdjust('floor', value, exp);
-    };
-  }
-  // Arrodoniment decimal a l'alça
-  if (!Math.ceil10) {
-    Math.ceil10 = function(value, exp) {
-      return decimalAdjust('ceil', value, exp);
-    };
-  }
-})();
-
-// Arrodoniments
-Math.round10(55.55, -1);   // 55.6
-Math.round10(55.549, -1);  // 55.5
-Math.round10(55, 1);       // 60
-Math.round10(54.9, 1);     // 50
-Math.round10(-55.55, -1);  // -55.5
-Math.round10(-55.551, -1); // -55.6
-Math.round10(-55, 1);      // -50
-Math.round10(-55.1, 1);    // -60
-// Arrodoniments a la baixa
-Math.floor10(55.59, -1);   // 55.5
-Math.floor10(59, 1);       // 50
-Math.floor10(-55.51, -1);  // -55.6
-Math.floor10(-51, 1);      // -60
-// Arrodoniments a l'alça
-Math.ceil10(55.51, -1);    // 55.6
-Math.ceil10(51, 1);        // 60
-Math.ceil10(-55.59, -1);   // -55.5
-Math.ceil10(-59, 1);       // -50
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a EdicióStandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.9', 'Math.floor')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.floor', 'Math.floor')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/fround/index.html b/files/ca/web/javascript/reference/global_objects/math/fround/index.html deleted file mode 100644 index dd4cd2c762..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/fround/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Math.fround() -slug: Web/JavaScript/Reference/Global_Objects/Math/fround -translation_of: Web/JavaScript/Reference/Global_Objects/Math/fround -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/fround ---- -
{{JSRef}}
- -

La funció Math.fround() retorna la representació en coma flotant de precisió simple més propera d'un nombre.

- -

Sintaxi

- -
Math.fround(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que fround() és un mètode estàtic de Math, sempre s'utilitza com Math.fround() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.fround()

- -
Math.fround(0);     // 0
-Math.fround(1);     // 1
-Math.fround(1.337); // 1.3370000123977661
-Math.fround(1.5);   // 1.5
-Math.fround(NaN);   // NaN
-
- -

Polyfill

- -

El comportament d'aquesta funció pot ser emulat amb la funció següent, si {{jsxref("Float32Array")}} està suportat:

- -
Math.fround = Math.fround || function(x) {
-  return new Float32Array([x])[0];
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.fround', 'Math.fround')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("26")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/hypot/index.html b/files/ca/web/javascript/reference/global_objects/math/hypot/index.html deleted file mode 100644 index c7a8994995..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/hypot/index.html +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: Math.hypot() -slug: Web/JavaScript/Reference/Global_Objects/Math/hypot -translation_of: Web/JavaScript/Reference/Global_Objects/Math/hypot -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/hypot ---- -
{{JSRef}}
- -

La funció Math.hypot() retorna la rel quadrada de la suma dels quadrats dels seus arguments, és a dir:

- -

Math.hypot(v1,v2,,vn)=i=1nvi2=v12+v22++vn2\mathtt{\operatorname{Math.hypot}(v_1, v_2, \dots, v_n)} = \sqrt{\sum_{i=1}^n v_i^2} = \sqrt{v_1^2 + v_2^2 + \dots + v_n^2}

- -

Sintaxi

- -
Math.hypot([valor1[, valor2[, ...]]])
- -

Paràmetres

- -
-
valor1, valor2, ...
-
Nombres.
-
- -

Descripció

- -

Com que que hypot() és un mètode estàtic de Math, sempre s'utilitza com a Math.hypot(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Si no es passa cap argument, el resultat és +0.

- -

Si al menys un dels arguments no pot ser convertit a nombre el resultat és {{jsxref("Global_Objects/NaN", "NaN")}}.

- -

Quan se li passa només un argument, Math.hypot() retorna el mateix valor que retornaria Math.abs().

- -

Exemples

- -

Utilitzar Math.hypot()

- -
Math.hypot(3, 4);        // 5
-Math.hypot(3, 4, 5);     // 7.0710678118654755
-Math.hypot();            // 0
-Math.hypot(NaN);         // NaN
-Math.hypot(3, 4, 'foo'); // NaN, +'foo' => NaN
-Math.hypot(3, 4, '5');   // 7.0710678118654755, +'5' => 5
-Math.hypot(-3);          // 3, el mateix que Math.abs(-3)
-
- -

Polyfill

- -

Aquest mètode pot emular-se mitjançant la funció següent:

- -
Math.hypot = Math.hypot || function() {
-  var y = 0;
-  var length = arguments.length;
-
-  for (var i = 0; i < length; i++) {
-    if (arguments[i] === Infinity || arguments[i] === -Infinity) {
-      return Infinity;
-    }
-    y += arguments[i] * arguments[i];
-  }
-  return Math.sqrt(y);
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.hypot', 'Math.hypot')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("27")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("27")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/imul/index.html b/files/ca/web/javascript/reference/global_objects/math/imul/index.html deleted file mode 100644 index a82ab70eb5..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/imul/index.html +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: Math.imul() -slug: Web/JavaScript/Reference/Global_Objects/Math/imul -translation_of: Web/JavaScript/Reference/Global_Objects/Math/imul -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/imul ---- -
{{JSRef}}
- -

La funció Math.imul() retorna el resultat de la multiplicació de 32 bits similar a la de C dels dos paràmetres.

- -

Sintaxi

- -
Math.imul(a, b)
- -

Paràmetres

- -
-
a
-
Primer nombre.
-
b
-
Segon nombre.
-
- -

Descripció

- -

Math.imul() permet una multiplicació ràpida de nombres sencers de 32 bits amb una semàtica similar a la de C. Aquesta característica esdevé útil per a projectes com Emscripten. Com que imul() és un mètode estàtic de Math, sempre s'utilitza com Math.imul() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.imul()

- -
Math.imul(2, 4);          // 8
-Math.imul(-1, 8);         // -8
-Math.imul(-2, -2);        // 4
-Math.imul(0xffffffff, 5); // -5
-Math.imul(0xfffffffe, 5); // -10
-
- -

Polyfill

- -

Aquesta funció pot ser emulada mitjançant la següent funció:

- -
Math.imul = Math.imul || function(a, b) {
-  var ah = (a >>> 16) & 0xffff;
-  var al = a & 0xffff;
-  var bh = (b >>> 16) & 0xffff;
-  var bl = b & 0xffff;
-  // el desplaçament de zero posicions solventa el signe a la part més significativa
-  // el |0 del final converteix el valor sense signe en un valor amb signe
-  return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.imul', 'Math.imul')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("28")}}{{CompatGeckoDesktop("20")}}{{CompatUnknown}}{{CompatOpera("16")}}{{CompatSafari("7")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatUnknown}}{{CompatUnknown}}{{CompatGeckoMobile("20")}}{{CompatUnknown}}{{CompatUnknown}}7
-
diff --git a/files/ca/web/javascript/reference/global_objects/math/index.html b/files/ca/web/javascript/reference/global_objects/math/index.html deleted file mode 100644 index aaaf1f008c..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/index.html +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: Math -slug: Web/JavaScript/Reference/Global_Objects/Math -translation_of: Web/JavaScript/Reference/Global_Objects/Math -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

Math és un objecte proporcionat pel llenguatge que té propietats i mètodes que pretenen ajudar en càlculs matemàtics. L'objecte conté constants i funcions matemàtiques.

- -

Descripció

- -

A diferència d'altres objectes globals, Math no és un constructor. Totes les propietats i mètodes de Math són estàtics. Per a utilitzar la constant pi es fa anar Math.PI i la funció sinus es crida Math.sin(x), on x és l'argument que rebrà el mètode. Les constants tenen la presició d'un nombre real de JavaScript.

- -

Propietats

- -
-
{{jsxref("Math.E")}}
-
La constant de Euler (també coneguda com a nombre E) i la base dels logaritmes naturals, el seu valor aproximat és de 2.718.
-
{{jsxref("Math.LN2")}}
-
El logaritme natural de 2, el seu valor aproximat és de 0.693.
-
{{jsxref("Math.LN10")}}
-
El logaritme natural de 10, el seu valor aproximat és de 2.303.
-
{{jsxref("Math.LOG2E")}}
-
El logaritme de E en base 2, el seu valor aproximat és de 1.443.
-
{{jsxref("Math.LOG10E")}}
-
El logaritme de E en base 10, el seu valor aproximat és de 0.434.
-
{{jsxref("Math.PI")}}
-
La proporció entre la circumferència d'un cercle i el seu diàmetre, el seu valor aproximat és de 3.14159.
-
{{jsxref("Math.SQRT1_2")}}
-
La rel quadrada de un mig (1/2); tanmateix 1 dividit per la rel quadrada de 2, el seu valor aproximat és de 0.707.
-
{{jsxref("Math.SQRT2")}}
-
La rel quadrada de 2, el seu valor aproximat és de 1.414.
-
- -

Mètodes

- -
-

Fixeu-vos que les funcions (sin(), cos(), tan(), asin(), acos(), atan(), atan2()) reben i retornen angles en radians. Per a convertir radians a graus cal dividir per (Math.PI / 180), o bé multiplicar si el que es pretèn es transformar graus a radians.

-
- -
-

Cal destacar que la precisió de moltes de les funcions matemàtiques és depenent de la implementació. Això vol dir que el mateix codi pot donar resultats diferent en diferents navegadors, i fins i tot sota el mateix navegador o motor JS si es prova en diferents sistemes operatius or arquitectures.

-
- -
-
{{jsxref("Global_Objects/Math/abs", "Math.abs(x)")}}
-
Retorna el valor absolut d'un nombre.
-
{{jsxref("Global_Objects/Math/acos", "Math.acos(x)")}}
-
Retorna l'arccosinus d'un nombre.
-
{{jsxref("Global_Objects/Math/acosh", "Math.acosh(x)")}} {{experimental_inline}}
-
Retorna l'arccosinus hiperbòlic d'un nombre.
-
{{jsxref("Global_Objects/Math/asin", "Math.asin(x)")}}
-
Tetorna l'arcsinus d'un nombre.
-
{{jsxref("Global_Objects/Math/asinh", "Math.asinh(x)")}} {{experimental_inline}}
-
Retorna l'arcsinus hiperbòlic d'un nombre.
-
{{jsxref("Global_Objects/Math/atan", "Math.atan(x)")}}
-
Retorna l'arctangent d'un nombre.
-
{{jsxref("Global_Objects/Math/atanh", "Math.atanh(x)")}} {{experimental_inline}}
-
Retorna l'arctangent hiperbòlic d'un nombre.
-
{{jsxref("Global_Objects/Math/atan2", "Math.atan2(y, x)")}}
-
Retorna l'arctangent del cocient dels paràmetres donats.
-
{{jsxref("Global_Objects/Math/cbrt", "Math.cbrt(x)")}} {{experimental_inline}}
-
Retorna la rel cúbica d'un nombre.
-
{{jsxref("Global_Objects/Math/ceil", "Math.ceil(x)")}}
-
Retorna el nombre sencer més petit que és més gran o igual al nombre donat.
-
{{jsxref("Global_Objects/Math/clz32", "Math.clz32(x)")}} {{experimental_inline}}
-
Retorna el nombre de zeros a l'esquerra que el nombre donat tindria si fós emmagatzemat en 32 bits.
-
{{jsxref("Global_Objects/Math/cos", "Math.cos(x)")}}
-
Retorna el cosinus d'un nombre.
-
{{jsxref("Global_Objects/Math/cosh", "Math.cosh(x)")}} {{experimental_inline}}
-
Retorna el cosinus hiperbòlic d'un nombre.
-
{{jsxref("Global_Objects/Math/exp", "Math.exp(x)")}}
-
Retorna Ex, on x és el paràmetre i E és la constant de Euler (2.718 aproximadament).
-
{{jsxref("Global_Objects/Math/expm1", "Math.expm1(x)")}} {{experimental_inline}}
-
Retorna exp(x) - 1.
-
{{jsxref("Global_Objects/Math/floor", "Math.floor(x)")}}
-
Retorna el nombre sencer més gran que és igual o menor que el nombre donat.
-
{{jsxref("Global_Objects/Math/fround", "Math.fround(x)")}} {{experimental_inline}}
-
Retorna el nombre en coma float de precisió simple més proper al nombre donat.
-
{{jsxref("Global_Objects/Math/hypot", "Math.hypot([x[, y[, …]]])")}} {{experimental_inline}}
-
Retorna la rel quadrada del quadrat dels dos paràmetres donats.
-
{{jsxref("Global_Objects/Math/imul", "Math.imul(x, y)")}} {{experimental_inline}}
-
Retorna el resultat de multiplicar els dos paràmetres com a nombres sencers de 32 bits.
-
{{jsxref("Global_Objects/Math/log", "Math.log(x)")}}
-
Retorna el logaritme natural (loge, també ln) d'un nombre.
-
{{jsxref("Global_Objects/Math/log1p", "Math.log1p(x)")}} {{experimental_inline}}
-
Retorna el logaritme natural de 1 + x (loge, també ln) del nombre donat.
-
{{jsxref("Global_Objects/Math/log10", "Math.log10(x)")}} {{experimental_inline}}
-
Retorna el logaritme en base 10 d'un nombre.
-
{{jsxref("Global_Objects/Math/log2", "Math.log2(x)")}} {{experimental_inline}}
-
Retorna el logaritme en base 2 d'un nombre.
-
{{jsxref("Global_Objects/Math/max", "Math.max([x[, y[, …]]])")}}
-
Retorna el major de zero o més nombres donats.
-
{{jsxref("Global_Objects/Math/min", "Math.min([x[, y[, …]]])")}}
-
Retorna el menor de zero o més nombres donats.
-
{{jsxref("Global_Objects/Math/pow", "Math.pow(base, exponent)")}}
-
Retorna la base elevada a l'exponent, és a dir, baseexponent.
-
{{jsxref("Global_Objects/Math/random", "Math.random()")}}
-
Retorna un nombre pseudo aleatori comprés entre 0 i 1.
-
{{jsxref("Global_Objects/Math/round", "Math.round(x)")}}
-
Retorna el nombre sencer més proper al nombre donat.
-
{{jsxref("Global_Objects/Math/sign", "Math.sign(x)")}} {{experimental_inline}}
-
Retorna el signe de x, indicant si x és positiu, negatiu o zero.
-
{{jsxref("Global_Objects/Math/sin", "Math.sin(x)")}}
-
Retorna el sinus d'un nombre.
-
{{jsxref("Global_Objects/Math/sinh", "Math.sinh(x)")}} {{experimental_inline}}
-
Retorna el sinus hiperbòlic d'un nombre.
-
{{jsxref("Global_Objects/Math/sqrt", "Math.sqrt(x)")}}
-
Retorna el resultat positiu de la rel quadrada d'un nombre.
-
{{jsxref("Global_Objects/Math/tan", "Math.tan(x)")}}
-
Retorna la tangent d'un nombre.
-
{{jsxref("Global_Objects/Math/tanh", "Math.tanh(x)")}} {{experimental_inline}}
-
Retorna la tangent hiperbòlica d'un nombre.
-
Math.toSource() {{non-standard_inline}}
-
Retorna la cadena de caràcters "Math".
-
{{jsxref("Global_Objects/Math/trunc", "Math.trunc(x)")}} {{experimental_inline}}
-
Retorna la part sencera del nombre donat.
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementada a JavaScript 1.1.
{{SpecName('ES5.1', '#sec-15.8', 'Math')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math-object', 'Math')}}{{Spec2('ES6')}}Nous mètodes afegits: {{jsxref("Math.log10()", "log10()")}}, {{jsxref("Math.log2()", "log2()")}}, {{jsxref("Math.log1p()", "log1p()")}}, {{jsxref("Math.expm1()", "expm1()")}}, {{jsxref("Math.cosh()", "cosh()")}}, {{jsxref("Math.sinh()", "sinh()")}}, {{jsxref("Math.tanh()", "tanh()")}}, {{jsxref("Math.acosh()", "acosh()")}}, {{jsxref("Math.asinh()", "asinh()")}}, {{jsxref("Math.atanh()", "atanh()")}}, {{jsxref("Math.hypot()", "hypot()")}}, {{jsxref("Math.trunc()", "trunc()")}}, {{jsxref("Math.sign()", "sign()")}}, {{jsxref("Math.imul()", "imul()")}}, {{jsxref("Math.fround()", "fround()")}}, {{jsxref("Math.cbrt()", "cbrt()")}} i {{jsxref("Math.clz32()", "clz32()")}}.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/ln10/index.html b/files/ca/web/javascript/reference/global_objects/math/ln10/index.html deleted file mode 100644 index 49c3f52a1a..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/ln10/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Math.LN10 -slug: Web/JavaScript/Reference/Global_Objects/Math/LN10 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/LN10 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/LN10 ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.LN10 representa el logaritme natural de 10, aproximadament 2.302:

- -

Math.LN10=ln(10)2.302\mathtt{\mi{Math.LN10}} = \ln(10) \approx 2.302

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Degut a que LN10 és una propietat estàtica de Math, aquesta sempre s'accedeix mitjançant el codi Math.LN10, en comptes de com una propietat d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.LN10

- -

La funció següent retorna el logaritme natural de 10:

- -
function getNatLog10() {
-  return Math.LN10;
-}
-
-getNatLog10(); // 2.302585092994046
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.2', 'Math.LN10')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.ln10', 'Math.LN10')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterístiquesChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterístiquesAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/ln2/index.html b/files/ca/web/javascript/reference/global_objects/math/ln2/index.html deleted file mode 100644 index 1bd054bec6..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/ln2/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Math.LN2 -slug: Web/JavaScript/Reference/Global_Objects/Math/LN2 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/LN2 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/LN2 ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.LN2 representa el logaritme natural de 2, aproximadament 0.693:

- -

Math.LN2=ln(2)0.693\mathtt{\mi{Math.LN2}} = \ln(2) \approx 0.693

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Degut a que LN2 és una propietat estàtica de Math, sempre s'accedeix a aquesta mitjançant el codi Math.LN2 en comptes d'accedir a la propietat d'un objecte de Math ja creat (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.LN2

- -

La següent funció retorna el logaritme natural de 2:

- -
function getNatLog2() {
-  return Math.LN2;
-}
-
-getNatLog2(); // 0.6931471805599453
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a 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')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/log/index.html b/files/ca/web/javascript/reference/global_objects/math/log/index.html deleted file mode 100644 index e92c8c05d2..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/log/index.html +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: Math.log() -slug: Web/JavaScript/Reference/Global_Objects/Math/log -translation_of: Web/JavaScript/Reference/Global_Objects/Math/log -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/log ---- -
{{JSRef}}
- -

La funció Math.log() retorna el logaritme natural (base {{jsxref("Math.E", "e")}}) d'un nombre, és a dir

- -

x>0,Math.log(x)=ln(x)=la únicaytal queey=x\forall x > 0, \mathtt{\operatorname{Math.log}(x)} = \ln(x) = \text{the unique} \; y \; \text{such that} \; e^y = x

- -

Sintaxi

- -
Math.log(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Si el valor de x és negatiu, el valor retornat sempre serà {{jsxref("NaN")}}.

- -

Degut a que log() és un mètode estàtic de Math, sempre s'utilitza com a Math.log(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.log()

- -
Math.log(-1); // NaN, fora de rang
-Math.log(0);  // -Infinit
-Math.log(1);  // 0
-Math.log(10); // 2.302585092994046
-
- -

Utilitzar Math.log() amb una base diferent

- -

La funció següent retorna el logaritme de y amb base x (és a dir, logxy\log_x y):

- -
function getBaseLog(x, y) {
-  return Math.log(y) / Math.log(x);
-}
-
- -

Si es crida getBaseLog(10, 1000) retornarà 2.9999999999999996 degut a l'arrodoniment de punt flotant, el qual és molt proper a la resposta real: 3.

- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacionsEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.10', 'Math.log')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.log', 'Math.log')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/log10/index.html b/files/ca/web/javascript/reference/global_objects/math/log10/index.html deleted file mode 100644 index b752401732..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/log10/index.html +++ /dev/null @@ -1,127 +0,0 @@ ---- -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/Objectes_globals/Math/log10 ---- -
{{JSRef}}
- -

La funció Math.log10() retorna el logaritme en base 10 d'un nombre, és a dir

- -

x>0,Math.log10(x)=log10(x)=la únicaytal que10y=x\forall x > 0, \mathtt{\operatorname{Math.log10}(x)} = \log_10(x) = \text{the unique} \; y \; \text{such that} \; 10^y = x

- -

Sintaxi

- -
Math.log10(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Si el valor de x és menor que 0, el valor retornat sempre és {{jsxref("NaN")}}.

- -

Com que log10() és un mètode estàtic de Math, sempre s'utilitza com Math.log10() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.log10()

- -
Math.log10(2);      // 0.3010299956639812
-Math.log10(1);      // 0
-Math.log10(0);      // -Infinit
-Math.log10(-2);     // NaN
-Math.log10(100000); // 5
-
- -

Polyfill

- -

Aquesta funció pot ser emulada mitjançant el següent codi:

- -
Math.log10 = Math.log10 || function(x) {
-  return Math.log(x) / Math.LN10;
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.log10', 'Math.log10')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/log10e/index.html b/files/ca/web/javascript/reference/global_objects/math/log10e/index.html deleted file mode 100644 index 865c5d2748..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/log10e/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Math.LOG10E -slug: Web/JavaScript/Reference/Global_Objects/Math/LOG10E -translation_of: Web/JavaScript/Reference/Global_Objects/Math/LOG10E -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/LOG10E ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.LOG10E representa el logaritme en base 10 de e, el valor del qual és aproximadament 0.434:

- -

Math.LOG10E=log10(e)0.434\mathtt{\mi{Math.LOG10E}} = \log_10(e) \approx 0.434

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Degut a que LOG10E és una propietat estàtica de l'objecte Math, sempre s'obté el seu valor mitjançant Math.LOG10E en comptes d'accedir a la propietat d'un objecte instanciat de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.LOG10E

- -

La funció següent retorna el logaritme en base 10 de e:

- -
function getLog10e() {
-  return Math.LOG10E;
-}
-
-getLog10e(); // 0.4342944819032518
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.5', 'Math.LOG10E')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.log10e', 'Math.LOG10E')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/log1p/index.html b/files/ca/web/javascript/reference/global_objects/math/log1p/index.html deleted file mode 100644 index d2d3694a0c..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/log1p/index.html +++ /dev/null @@ -1,126 +0,0 @@ ---- -title: Math.log1p() -slug: Web/JavaScript/Reference/Global_Objects/Math/log1p -translation_of: Web/JavaScript/Reference/Global_Objects/Math/log1p -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/log1p ---- -
{{JSRef}}
- -

La funció Math.log1p() retorna el logaritme natural (base {{jsxref("Math.E", "e")}}) de 1 + un nombre, és a dir

- -

x>-1,Math.log1p(x)=ln(1+x)\forall x > -1, \mathtt{\operatorname{Math.log1p}(x)} = \ln(1 + x)

- -

Sintaxi

- -
Math.log1p(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Si el valor de x és menor que -1, el valor retornat sempre serà {{jsxref("NaN")}}.

- -

Com que log1p() és un mètode estàtic de Math, sempre s'utilitza com Math.log1p() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.log1p()

- -
Math.log1p(1);  // 0.6931471805599453
-Math.log1p(0);  // 0
-Math.log1p(-1); // -Infinit
-Math.log1p(-2); // NaN
-
- -

Polyfill

- -

Aquesta funció pot ser emulada mitjançant la funció següent:

- -
Math.log1p = Math.log1p || function(x) {
-  return Math.log(1 + x);
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.log1p', 'Math.log1p')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/log2/index.html b/files/ca/web/javascript/reference/global_objects/math/log2/index.html deleted file mode 100644 index 9877f863b8..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/log2/index.html +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Math.log2() -slug: Web/JavaScript/Reference/Global_Objects/Math/log2 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/log2 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/log2 ---- -
{{JSRef}}
- -

La funció Math.log2() retorna el logaritme en base 2 d'un nombre, és a dir

- -

x>0,Math.log2(x)=log2(x)=la únicaytal que2y=x\forall x > 0, \mathtt{\operatorname{Math.log2}(x)} = \log_2(x) = \text{the unique} \; y \; \text{such that} \; 2^y = x

- -

Sintaxi

- -
Math.log2(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Si el valor de x és menor que 0, el valor retornat sempre serà {{jsxref("NaN")}}.

- -

Com que log2() és un mètode estàtic de Math, sempre s'utilitza com Math.log2() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.log2()

- -
Math.log2(3);    // 1.584962500721156
-Math.log2(2);    // 1
-Math.log2(1);    // 0
-Math.log2(0);    // -Infinit
-Math.log2(-2);   // NaN
-Math.log2(1024); // 10
-
- -

Polyfill

- -

Aquest Polyfill emula la funció Math.log2. Cal destacar que retorna valors imprecisos per a algunes entrades (com ara 1 << 29), embolcalleu-la amb {{jsxref("Math.round()")}} si esteu treballant amb màscares de bits.

- -
Math.log2 = Math.log2 || function(x) {
-  return Math.log(x) / Math.LN2;
-};
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.log2', 'Math.log2')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/log2e/index.html b/files/ca/web/javascript/reference/global_objects/math/log2e/index.html deleted file mode 100644 index a8483c97e4..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/log2e/index.html +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: Math.LOG2E -slug: Web/JavaScript/Reference/Global_Objects/Math/LOG2E -translation_of: Web/JavaScript/Reference/Global_Objects/Math/LOG2E -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/LOG2E ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.LOG2E representa el logaritme de e en base 2, el valor del qual és aproximadament 1.442:

- -

Math.LOG2E=log2(e)1.442\mathtt{\mi{Math.LOG2E}} = \log_2(e) \approx 1.442

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Com que LOG2E és una propietat estàtica de Math, sempre s'utilitza mitjançant la forma Math.LOG2E, en comptes d'accedir a la propietat d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.LOG2E

- -

La següent funció retorna el logaritme de e en base 2:

- -
function getLog2e() {
-  return Math.LOG2E;
-}
-
-getLog2e(); // 1.4426950408889634
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.4', 'Math.LOG2E')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.log2e', 'Math.LOG2E')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/max/index.html b/files/ca/web/javascript/reference/global_objects/math/max/index.html deleted file mode 100644 index 1b556be585..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/max/index.html +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Math.max() -slug: Web/JavaScript/Reference/Global_Objects/Math/max -translation_of: Web/JavaScript/Reference/Global_Objects/Math/max -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/max ---- -
{{JSRef}}
- -

La funció Math.max() retorna el nombre més gran de zero o més nombres.

- -

Sintaxi

- -
Math.max([valor1[, valor2[, ...]]])
- -

Paràmetres

- -
-
valor1, valor2, ...
-
Nombres.
-
- -

Descripció

- -

Com que max() és un mètode estàtic de Math, sempre s'utilitza com Math.max() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Si no es proporciona cap argument, el resultat és -{{jsxref("Infinity")}}.

- -

Si al menys un dels arguments no pot convertir-se a un nombre, el resultat és {{jsxref("NaN")}}.

- -

Exemples

- -

Utilitzar Math.max()

- -
Math.max(10, 20);   //  20
-Math.max(-10, -20); // -10
-Math.max(-10, 20);  //  20
-
- -

La següent funció utilitza {{jsxref("Function.prototype.apply()")}} per a trobar l'element màxim d'un array numèric. getMaxOfArray([1, 2, 3]) és equivalent a Math.max(1, 2, 3), però getMaxOfArray() pot emprar-se en arrays de qualsevol mida construits programàticament.

- -
function getMaxOfArray(numArray) {
-  return Math.max.apply(null, numArray);
-}
-
- -

O bé amb el nou {{jsxref("Operators/Spread_operator", "operador spread")}}, obtenir el nombre màxim d'un array és molt més simple.

- -
var arr = [1, 2, 3];
-var max = Math.max(...arr);
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.11', 'Math.max')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.max', 'Math.max')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/min/index.html b/files/ca/web/javascript/reference/global_objects/math/min/index.html deleted file mode 100644 index 68cb1ee2fd..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/min/index.html +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Math.min() -slug: Web/JavaScript/Reference/Global_Objects/Math/min -translation_of: Web/JavaScript/Reference/Global_Objects/Math/min -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/min ---- -
{{JSRef}}
- -

La funció Math.min() retorna el més petit de zero o més nombres.

- -

Sintaxi

- -
Math.min([valor1[, valor2[, ...]]])
- -

Paràmetres

- -
-
valor1, valor2, ...
-
Nombres.
-
- -

Descripció

- -

Degut a que min() és un mètode estàtic de Math, sempre s'utilitza com a Math.min(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Si no es proporciona cap argument, el resultat és {{jsxref("Infinity")}}.

- -

Si al menys un dels arguments no pot ser convertit a nombre, el resultat és {{jsxref("NaN")}}.

- -

Exemples

- -

Utilitzar Math.min()

- -

Aquest codi troba el valor mínim de x i y i l'assigna a z:

- -
var x = 10, y = -20;
-var z = Math.min(x, y);
-
- -

Limitar un nombre amb Math.min()

- -

Sovint s'utilitza Math.min() per a limitar un valor de manera que sempre sigui igual o menor que un límit. Per exemple, aquest codi

- -
var x = f(foo);
-
-if (x > limit) {
-  x = limit;
-}
-
- -

es podria escriure de la següent manera:

- -
var x = Math.min(f(foo), limit);
-
- -

{{jsxref("Math.max()")}} es pot emprar d'una manera similar per a limitar un valor a l'altre límit.

- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.12', 'Math.min')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.min', 'Math.min')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/pi/index.html b/files/ca/web/javascript/reference/global_objects/math/pi/index.html deleted file mode 100644 index 11a95acb94..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/pi/index.html +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: Math.PI -slug: Web/JavaScript/Reference/Global_Objects/Math/PI -translation_of: Web/JavaScript/Reference/Global_Objects/Math/PI -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/PI ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.PI representa el ratio entre la circumferència d'un crecle i el seu diàmetre, el seu valor aproximat és de 3.14159:

- -

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

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Com que PI és una propietat estàtica de Math, sempre s'utilitza amb la forma Math.PI, ren comptes de com una propietat d'un objecte Math ja creat (Math on és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.PI

- -

La funció següent utilitza Math.PI per a calcular la circumferència d'un cercle a partir del radi que rep.

- -
function calculateCircumference(radius) {
-  return 2 * Math.PI * radius;
-}
-
-calculateCircumference(1);  // 6.283185307179586
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a 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')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/pow/index.html b/files/ca/web/javascript/reference/global_objects/math/pow/index.html deleted file mode 100644 index 9f86311dda..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/pow/index.html +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Math.pow() -slug: Web/JavaScript/Reference/Global_Objects/Math/pow -translation_of: Web/JavaScript/Reference/Global_Objects/Math/pow -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/pow ---- -
{{JSRef}}
- -

La funció Math.pow() retorna la base elevada a exponent, és a dir, baseexponent.

- -

Sintaxi

- -
Math.pow(base, exponent)
- -

Paràmetres

- -
-
base
-
El nombre base.
-
exponent
-
L'exponent que s'usarà per a elevar la base.
-
- -

Descripció

- -

Com que pow() és un mètode estàtic de Math, sempre s'utilitza com Math.pow() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.pow()

- -
// simple
-Math.pow(7, 2);    // 49
-Math.pow(7, 3);    // 343
-Math.pow(2, 10);   // 1024
-// exponents fractionals
-Math.pow(4, 0.5);  // 2 (rel quadrada de 4)
-Math.pow(8, 1/3);  // 2 (rel cúbica de 8)
-Math.pow(2, 0.5);  // 1.412135623730951 (rel quadrada de 2)
-Math.pow(2, 1/3);  // 1.2599210498948732 (rel cúbica de 2)
-// exponents amb signe
-Math.pow(7, -2);   // 0.02040816326530612 (1/49)
-Math.pow(8, -1/3); // 0.5
-// bases amb signe
-Math.pow(-7, 2);   // 49 (qualsevol nombre elevat al quadrat és positiu)
-Math.pow(-7, 3);   // -343 (nombres elevats al cub poden ser negatius)
-Math.pow(-7, 0.5); // NaN (els nombres negatius no tenen una rel quadrada real)
-// degut a rels "parells" i "senars" estan aprox l'una de l'altra
-// i a límits en la precisió dels nombres de punt flotant,
-// bases negatives amb exponents fraccionals sempre retornen NaN
-Math.pow(-7, 1/3); // NaN
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.13', 'Math.pow')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.pow', 'Math.pow')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/random/index.html b/files/ca/web/javascript/reference/global_objects/math/random/index.html deleted file mode 100644 index 5018a5c59d..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/random/index.html +++ /dev/null @@ -1,127 +0,0 @@ ---- -title: Math.random() -slug: Web/JavaScript/Reference/Global_Objects/Math/random -translation_of: Web/JavaScript/Reference/Global_Objects/Math/random -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/random ---- -
{{JSRef}}
- -

La funció Math.random() retorna un nombre decimal de punt flotant pseudo-aleatori que roman dins el rang [0, 1), és a dir, des de 0 (inclòs) fins a 1 (exclòs), que després pot ser escalat al rang dessitjat. La implementació selecciona la llavor inicial per a l'algoritme generador de nombres aleatoris; aquesta llavor no pot ser resetejada o escollida per l'usuari.

- -
-

Nota: Math.random() no proporciona nombres aleatoris criptogràficament segurs. No l'utilitzeu per a cap tasca relacionada amb la seguretat. Per a aquest ús utilitzeu la API Web Crypto, i més concretament el mètode {{domxref("RandomSource.getRandomValues()", "window.crypto.getRandomValues()")}}.

-
- -

Sintaxi

- -
Math.random()
- -

Exemples

- -

Utilitzar Math.random()

- -

Cal destacar que com que els nombres a JavaScript són nombres de punt flotant IEEE 754 amb comportament d'arrodoniment al parell més proper, els rangs proclamats per les funcions de sota (a excepció de Math.random()) no són exactes. Si s'escullen límits extremadament grans (253 o majors), és possible en casos extremadament rars, obtindre el límit superior que normalment és exclòs.

- -
// Retorna un nombre aleatori entre 0 (inclòs) i 1 (exclòs)
-function getRandom() {
-  return Math.random();
-}
-
- -
// Retorna un nombre aleatori entre min (inclòs) i max (exclòs)
-function getRandomArbitrary(min, max) {
-  return Math.random() * (max - min) + min;
-}
-
- -
// Retorna un nombre sencer aleatori entre min (inclòs) i max (exclòs)
-// Utilitzar Math.round() proporciona una distribució no uniforme!
-function getRandomInt(min, max) {
-  return Math.floor(Math.random() * (max - min)) + min;
-}
-
- -
// Returns a random integer between min (included) and max (included)
-// Using Math.round() will give you a non-uniform distribution!
-function getRandomIntInclusive(min, max) {
-  return Math.floor(Math.random() * (max - min + 1)) + min;
-}
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. JavaScript 1.0 (Només UNIX) / JavaScript 1.1 (Totes les plataformes).
{{SpecName('ES5.1', '#sec-15.8.2.14', 'Math.random')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.random', 'Math.random')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
diff --git a/files/ca/web/javascript/reference/global_objects/math/round/index.html b/files/ca/web/javascript/reference/global_objects/math/round/index.html deleted file mode 100644 index fcc2d46bf9..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/round/index.html +++ /dev/null @@ -1,208 +0,0 @@ ---- -title: Math.round() -slug: Web/JavaScript/Reference/Global_Objects/Math/round -translation_of: Web/JavaScript/Reference/Global_Objects/Math/round -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/round ---- -
{{JSRef}}
- -

La funció Math.round() retorna el valor d'un nombre arrodonit al nombre sencer més proper.

- -

Sintaxi

- -
Math.round(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Si la porció fraccional del nombre és 0.5 o major, l'argument s'arrodoneix al següent nombre sencer més gran. Si la porció fraccional del nombre és menor de 0.5 l'argument és arrodonit al següent nombre sencer més petit.

- -

Com que round() és un mètode estàtic de Math, sempre s'utilitza com Math.round() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.round()

- -
// Retorna el valor 20
-x = Math.round(20.49);
-
-// Retorna el valor 21
-x = Math.round(20.5);
-
-// Retorna el valor -20
-x = Math.round(-20.5);
-
-// Retorna el valor -21
-x = Math.round(-20.51);
-
-// Retorna el valor 1 (!)
-// Fixeu-vos en l'error d'arrodoniment degut a la poc precisa aritmètica de punt flotant
-// Compareu això amb Math.round10(1.005, -2) de l'exemple de sota
-x = Math.round(1.005*100)/100;
-
- -

Arrodoniment decimal

- -
// Closure
-(function() {
-  /**
-   * Ajustament decimal d'un nombre
-   *
-   * @param {String}  type  El tipus d'ajustament.
-   * @param {Number}  value El nombre.
-   * @param {Integer} exp   L'exponent (el logaritme en base 10 de la base a ajustar).
-   * @returns {Number} El valor ajustat.
-   */
-  function decimalAdjust(type, value, exp) {
-    // Si l'exponent és undefined o zero...
-    if (typeof exp === 'undefined' || +exp === 0) {
-      return Math[type](value);
-    }
-    value = +value;
-    exp = +exp;
-    // Si el valor no és un nombre o l'exponent no és un nombre sencer...
-    if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
-      return NaN;
-    }
-    // Desplaçament
-    value = value.toString().split('e');
-    value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
-    // Desfer el desplaçament
-    value = value.toString().split('e');
-    return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
-  }
-
-  // Arrodoniment decimal
-  if (!Math.round10) {
-    Math.round10 = function(value, exp) {
-      return decimalAdjust('round', value, exp);
-    };
-  }
-  // Floor decimal
-  if (!Math.floor10) {
-    Math.floor10 = function(value, exp) {
-      return decimalAdjust('floor', value, exp);
-    };
-  }
-  // Ceiling decimal
-  if (!Math.ceil10) {
-    Math.ceil10 = function(value, exp) {
-      return decimalAdjust('ceil', value, exp);
-    };
-  }
-})();
-
-// Arrodoniment
-Math.round10(55.55, -1);   // 55.6
-Math.round10(55.549, -1);  // 55.5
-Math.round10(55, 1);       // 60
-Math.round10(54.9, 1);     // 50
-Math.round10(-55.55, -1);  // -55.5
-Math.round10(-55.551, -1); // -55.6
-Math.round10(-55, 1);      // -50
-Math.round10(-55.1, 1);    // -60
-Math.round10(1.005, -2);   // 1.01 -- compareu aquest resultat amb Math.round(1.005*100)/100 de l'exemple de sobre
-// Floor
-Math.floor10(55.59, -1);   // 55.5
-Math.floor10(59, 1);       // 50
-Math.floor10(-55.51, -1);  // -55.6
-Math.floor10(-51, 1);      // -60
-// Ceil
-Math.ceil10(55.51, -1);    // 55.6
-Math.ceil10(51, 1);        // 60
-Math.ceil10(-55.59, -1);   // -55.5
-Math.ceil10(-59, 1);       // -50
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.15', 'Math.round')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.round', 'Math.round')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/sign/index.html b/files/ca/web/javascript/reference/global_objects/math/sign/index.html deleted file mode 100644 index a3a1df277e..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/sign/index.html +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: Math.sign() -slug: Web/JavaScript/Reference/Global_Objects/Math/sign -translation_of: Web/JavaScript/Reference/Global_Objects/Math/sign -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/sign ---- -
{{JSRef}}
- -

La funció Math.sign() retorna el signe d'un nombre, indicant si el nombre donat és positiu, negatiu o zero.

- -

Sintaxi

- -
Math.sign(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que sign() és un mètode estàtic de Math, sempre s'utilitza com Math.sign() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Aquesta funció pot retornar 5 valors diferents, 1, -1, 0, -0, NaN, que representen "nombre positiu", "nombre negatiu", "zero positiu", "zero negatiu" i {{jsxref("NaN")}} respectivament.

- -

L'argument passat a aquesta funció serà convertit al tipus de x implícitament.

- -

Exemples

- -

Utilitzar Math.sign()

- -
Math.sign(3);     //  1
-Math.sign(-3);    // -1
-Math.sign('-3');  // -1
-Math.sign(0);     //  0
-Math.sign(-0);    // -0
-Math.sign(NaN);   // NaN
-Math.sign('foo'); // NaN
-Math.sign();      // NaN
-
- -

Polyfill

- -
Math.sign = Math.sign || function(x) {
-  x = +x; // converteix a un nombre
-  if (x === 0 || isNaN(x)) {
-    return x;
-  }
-  return x > 0 ? 1 : -1;
-}
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.sign', 'Math.sign')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatNo}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/sin/index.html b/files/ca/web/javascript/reference/global_objects/math/sin/index.html deleted file mode 100644 index e880f9ac74..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/sin/index.html +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Math.sin() -slug: Web/JavaScript/Reference/Global_Objects/Math/sin -translation_of: Web/JavaScript/Reference/Global_Objects/Math/sin -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/sin ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.sin() retorna el sinus d'un nombre.

- -

Sintaxi

- -
Math.sin(x)
- -

Paràmetres

- -
-
x
-
Un nombre (donat en radians).
-
- -

Descripció

- -

El mètode Math.sin() retorna un valor numèric entre -1 i 1, que representa el sinus de l'angle donat en radiants.

- -

Degut a que sin() és un mètode estàtic de Math, sempre s'utilitza com a Math.sin(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.sin()

- -
Math.sin(0);           // 0
-Math.sin(1);           // 0.8414709848078965
-
-Math.sin(Math.PI / 2); // 1
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.16', 'Math.sin')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.sin', 'Math.sin')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/sinh/index.html b/files/ca/web/javascript/reference/global_objects/math/sinh/index.html deleted file mode 100644 index 9622b9a00d..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/sinh/index.html +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Math.sinh() -slug: Web/JavaScript/Reference/Global_Objects/Math/sinh -translation_of: Web/JavaScript/Reference/Global_Objects/Math/sinh -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/sinh ---- -
{{JSRef}}
- -

La funció Math.sinh() retorna el sinus hiperbòlic d'un nombre, que es pot expressar utilitzant la {{jsxref("Math.E", "constant e", "", 1)}}:

- -

Math.sinh(x)=ex-e-x2\mathtt{\operatorname{Math.sinh(x)}} = \frac{e^x - e^{-x}}{2}

- -

Sintaxi

- -
Math.sinh(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que que sinh() és un mètode estàtic de Math, sempre s'utilitza com a Math.sinh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.sinh()

- -
Math.sinh(0); // 0
-Math.sinh(1); // 1.1752011936438014
-
- -

Polyfill

- -

Aquest comportament es pot emular amb l'ajut de la funció {{jsxref("Math.exp()")}}:

- -
Math.sinh = Math.sinh || function(x) {
-  return (Math.exp(x) - Math.exp(-x)) / 2;
-}
-
- -

O bé utilitzant només una crida a la funció {{jsxref("Math.exp()")}}:

- -
Math.sinh = Math.sinh || function(x) {
-  var y = Math.exp(x);
-  return (y - 1 / y) / 2;
-}
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.sinh', 'Math.sinh')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/sqrt/index.html b/files/ca/web/javascript/reference/global_objects/math/sqrt/index.html deleted file mode 100644 index a9cdc465a3..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/sqrt/index.html +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Math.sqrt() -slug: Web/JavaScript/Reference/Global_Objects/Math/sqrt -translation_of: Web/JavaScript/Reference/Global_Objects/Math/sqrt -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/sqrt ---- -
{{JSRef}}
- -

La funció Math.sqrt() retorna la rel quadrada d'un nombre, és a dir

- -

x0,Math.sqrt(x)=x=la únicay0tal quey2=x\forall x \geq 0, \mathtt{Math.sqrt(x)} = \sqrt{x} = \text{the unique} \; y \geq 0 \; \text{such that} \; y^2 = x

- -

Sintaxi

- -
Math.sqrt(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Si el valor de x és negatiu, Math.sqrt() retorna {{jsxref("NaN")}}.

- -

Degut a que sqrt() és un mètode estàtic de Math, sempre s'utilitza com a Math.sqrt(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.sqrt()

- -
Math.sqrt(9); // 3
-Math.sqrt(2); // 1.414213562373095
-
-Math.sqrt(1);  // 1
-Math.sqrt(0);  // 0
-Math.sqrt(-1); // NaN
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES1')}}{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.17', 'Math.sqrt')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.sqrt', 'Math.sqrt')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/sqrt1_2/index.html b/files/ca/web/javascript/reference/global_objects/math/sqrt1_2/index.html deleted file mode 100644 index a837b7515d..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/sqrt1_2/index.html +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: Math.SQRT1_2 -slug: Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/SQRT1_2 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/SQRT1_2 ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.SQRT1_2 representa la rel quadrada de 1/2, que equival aproximadament a 0.707:

- -

Math.SQRT1_2=12=120.707\mathtt{\mi{Math.SQRT1_2}} = \sqrt{\frac{1}{2}} = \frac{1}{\sqrt{2}} \approx 0.707

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Degut a que SQRT1_2  éss una propietat estàtica de Math, sempre s'utilitza com a Math.SQRT1_2 en comptes de com a la propietat d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.SQRT1_2

- -

La següent funció retorna 1 dividit per la rel quadrada de 2:

- -
function getRoot1_2() {
-  return Math.SQRT1_2;
-}
-
-getRoot1_2(); // 0.7071067811865476
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat aJavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.7', 'Math.SQRT1_2')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.sqrt1_2', 'Math.SQRT1_2')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/sqrt2/index.html b/files/ca/web/javascript/reference/global_objects/math/sqrt2/index.html deleted file mode 100644 index fa49b09c47..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/sqrt2/index.html +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: Math.SQRT2 -slug: Web/JavaScript/Reference/Global_Objects/Math/SQRT2 -translation_of: Web/JavaScript/Reference/Global_Objects/Math/SQRT2 -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/SQRT2 ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La propietat Math.SQRT2 representa la rel quadrada de 2, que és aproximadament 1.414:

- -

Math.SQRT2=21.414\mathtt{\mi{Math.SQRT2}} = \sqrt{2} \approx 1.414

- -
{{js_property_attributes(0, 0, 0)}}
- -

Descripció

- -

Degut a que SQRT2 és una propietat estàtica de Math, sempre s'utilitza com a Math.SQRT2, en comptes de com la propietat d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.SQRT2

- -

La funció següent retorna la rel quadrada de 2:

- -
function getRoot2() {
-  return Math.SQRT2;
-}
-
-getRoot2(); // 1.4142135623730951
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.StandardDefinició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.1.8', 'Math.SQRT2')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.sqrt2', 'Math.SQRT2')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/tan/index.html b/files/ca/web/javascript/reference/global_objects/math/tan/index.html deleted file mode 100644 index a48a08a947..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/tan/index.html +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: Math.tan() -slug: Web/JavaScript/Reference/Global_Objects/Math/tan -translation_of: Web/JavaScript/Reference/Global_Objects/Math/tan -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/tan ---- -
{{JSRef("Global_Objects", "Math")}}
- -

Resum

- -

La funció Math.tan() retorna la tangent d'un nombre.

- -

Sintaxi

- -
Math.tan(x)
- -

Paràmetres

- -
-
x
-
Un nombre que representa un angle, mesurat en radians.
-
- -

Descripció

- -

El mètode Math.tan() retorna un valor numèric que representa la tangent d'un angle.

- -

Degut a que tan() és un mètode estàtic de Math, sempre s'utilitza com a Math.tan(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Exemple: Utilitzar Math.tan()

- -
Math.tan(1); // 1.5574077246549023
-
- -

Com que la funció Math.tan() accepta radians però sovint és més fàcil treballar amb graus, a funció següent accepta un valor en graus, el converteix a radians i retorna la tangent.

- -
function getTanDeg(deg) {
-  var rad = deg * Math.PI/180;
-  return Math.tan(rad);
-}
-
- -

Especificacions

- - - - - - - - - - - - - - - - - - - - - - - - -
EspecificacióEstatComentaris
ECMAScript 1a Edició.{{Spec2('ES1')}}Definició inicial. Implementat a JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.18', 'Math.tan')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.tan', 'Math.tan')}}{{Spec2('ES6')}} 
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
Característica
-
AndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/tanh/index.html b/files/ca/web/javascript/reference/global_objects/math/tanh/index.html deleted file mode 100644 index 63c08ddf1c..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/tanh/index.html +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: Math.tanh() -slug: Web/JavaScript/Reference/Global_Objects/Math/tanh -translation_of: Web/JavaScript/Reference/Global_Objects/Math/tanh -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/tanh ---- -
{{JSRef}}
- -

La funció Math.tanh() retorna la tangent hiperbòlica d'un nombre, és a dir

- -

tanhx=sinhxcoshx=ex-e-xex+e-x=e2x-1e2x+1\tanh x = \frac{\sinh x}{\cosh x} = \frac {e^x - e^{-x}} {e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x}+1}

- -

Sintaxi

- -
Math.tanh(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Com que que tanh() és un mètode estàtic de Math, sempre s'utilitza com a Math.tanh(), en comptes de com a mètode d'una instància de Math (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.tanh()

- -
Math.tanh(0);        // 0
-Math.tanh(Infinity); // 1
-Math.tanh(1);        // 0.7615941559557649
-
- -

Polyfill

- -

Aquest comportament pot emular-se amb l'ajuda de la funció {{jsxref("Math.exp()")}}:

- -
Math.tanh = Math.tanh || function(x) {
-  if (x === Infinity) {
-    return 1;
-  } else if (x === -Infinity) {
-    return -1;
-  } else {
-    return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));
-  }
-}
-
- -

o bé utilitzant només una crida a {{jsxref("Math.exp()")}}:

- -
Math.tanh = Math.tanh || function(x) {
-  if (x === Infinity) {
-    return 1;
-  } else if (x === -Infinity) {
-    return -1;
-  } else {
-    var y = Math.exp(2 * x);
-    return (y - 1) / (y + 1);
-  }
-}
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.tanh', 'Math.tanh')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

- - diff --git a/files/ca/web/javascript/reference/global_objects/math/trunc/index.html b/files/ca/web/javascript/reference/global_objects/math/trunc/index.html deleted file mode 100644 index 5fb0229700..0000000000 --- a/files/ca/web/javascript/reference/global_objects/math/trunc/index.html +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Math.trunc() -slug: Web/JavaScript/Reference/Global_Objects/Math/trunc -translation_of: Web/JavaScript/Reference/Global_Objects/Math/trunc -original_slug: Web/JavaScript/Referencia/Objectes_globals/Math/trunc ---- -
{{JSRef}}
- -

La funció Math.trunc() retorna la part integral d'un nombre, tot descartant els dígits decimals.

- -

Sintaxi

- -
Math.trunc(x)
- -

Paràmetres

- -
-
x
-
Un nombre.
-
- -

Descripció

- -

Al contrari que altres mètodes de Math : {{jsxref("Math.floor()")}}, {{jsxref("Math.ceil()")}} and {{jsxref("Math.round()")}}, la forma en la que Math.trunc() funciona és molt simple, simplement trunca el punt i els dígits que queden a la dreta, sense importa si l'argument és un nombre positiu o negatiu.

- -

Així que, si l'argument és un nombre positiu, Math.trunc() és equivalent a Math.floor(), en cas contrari, Math.trunc() és equivalent a Math.ceil().

- -

Cal destacar que l'argument passat a aquest mètode serà convertit a un nombre de forma implícita.

- -

Com que trunc() és un mètode estàtic de Math, sempre s'utilitza com Math.trunc() en comptes de com un mètode d'un objecte Math creat (Math no és un constructor).

- -

Exemples

- -

Utilitzar Math.trunc()

- -
Math.trunc(13.37);    // 13
-Math.trunc(42.84);    // 42
-Math.trunc(0.123);    //  0
-Math.trunc(-0.123);   // -0
-Math.trunc('-1.123'); // -1
-Math.trunc(NaN);      // NaN
-Math.trunc('foo');    // NaN
-Math.trunc();         // NaN
-
- -

Polyfill

- -
Math.trunc = Math.trunc || function(x) {
-  return x < 0 ? Math.ceil(x) : Math.floor(x);
-}
-
- -

Especificacions

- - - - - - - - - - - - - - -
EspecificacióEstatComentaris
{{SpecName('ES6', '#sec-math.trunc', 'Math.trunc')}}{{Spec2('ES6')}}Definició inicial.
- -

Compatibilitat amb navegadors

- -
{{CompatibilityTable}}
- -
- - - - - - - - - - - - - - - - - - - -
CaracterísticaChromeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatChrome("38")}}{{CompatGeckoDesktop("25")}}{{CompatNo}}{{CompatOpera("25")}}{{CompatSafari("7.1")}}
-
- -
- - - - - - - - - - - - - - - - - - - - - -
CaracterísticaAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile("25")}}{{CompatNo}}{{CompatNo}}8
-
- -

Vegeu també

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