file stringlengths 16 94 | text stringlengths 32 24.4k | vector list |
|---|---|---|
javascript/reference/global_objects/math/exp/index.md | JavaScript - Global Objects - Math - exp - Syntax:
Example:
Math.exp(x) | [
-0.6635847091674805,
0.029070556163787842,
-0.9519408345222473,
-0.6485662460327148,
-1.148667573928833,
-1.461161732673645,
0.4842909872531891,
1.2680349349975586,
0.5003948211669922,
-0.6070247888565063,
-0.16061893105506897,
1.0525435209274292,
-0.2980012893676758,
-0.11310069262981415,... |
javascript/reference/global_objects/math/exp/index.md | JavaScript - Global Objects - Math - exp - Syntax - Parameters:
- `x`: A number. | [
-0.3097909390926361,
-0.459267258644104,
-1.4852851629257202,
-0.977752149105072,
-0.9388782382011414,
-1.2847436666488647,
0.569277822971344,
0.9221739172935486,
0.6304168105125427,
-0.7324439287185669,
-0.785792887210846,
0.543444812297821,
-0.30274781584739685,
0.20400390028953552,
0.... |
javascript/reference/global_objects/math/exp/index.md | JavaScript - Global Objects - Math - exp - Syntax - Return value:
A nonnegative number representing ex, where e is the base of the natural logarithm. | [
-0.4778914153575897,
-0.3679967522621155,
-1.0888042449951172,
-0.3803037106990814,
-0.9949591755867004,
-0.8904462456703186,
0.33533963561058044,
0.5447108745574951,
0.03982803225517273,
0.09259974211454391,
-0.5849600434303284,
1.1319432258605957,
-0.5627389550209045,
0.8068698644638062,... |
javascript/reference/global_objects/math/exp/index.md | JavaScript - Global Objects - Math - exp - Description:
Because `exp()` is a static method of `Math`, you always use it as `Math.exp()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
Beware that `e` to the power of a number very close to 0 will be very close to 1 and suffer fro... | [
-1.3999361991882324,
-0.018999407067894936,
-0.5172858834266663,
0.24594594538211823,
0.08859702199697495,
-2.4999520778656006,
0.6898584961891174,
0.9172889590263367,
0.08911964297294617,
0.6264611482620239,
-0.7580749988555908,
1.1477235555648804,
0.03216628357768059,
-0.5388814210891724... |
javascript/reference/global_objects/math/exp/index.md | JavaScript - Global Objects - Math - exp - Examples - Using Math.exp():
Example:
Math.exp(-Infinity); // 0
Math.exp(-1); // 0.36787944117144233
Math.exp(0); // 1
Math.exp(1); // 2.718281828459045
Math.exp(Infinity); // Infinity | [
-1.9306174516677856,
0.28412213921546936,
-0.25545063614845276,
-0.0737423375248909,
-0.5044563412666321,
-1.056251049041748,
0.4637812376022339,
-0.07781951874494553,
0.2315954566001892,
-0.5382908582687378,
-0.4129987061023712,
0.4263327419757843,
0.20941759645938873,
-0.7169976234436035... |
javascript/reference/global_objects/math/ln2/index.md | JavaScript - Global Objects - Math - LN2:
The `Math.LN2` static data property represents the natural logarithm of 2, approximately 0.693:
Example:
function getNatLog2() {
return Math.LN2;
}
console.log(getNatLog2());
// Expected output: 0.6931471805599453 | [
-1.7081791162490845,
0.22397607564926147,
-0.6117600798606873,
0.027867233380675316,
-0.8519907593727112,
-1.048720359802246,
-1.2809900045394897,
0.1033911481499672,
-0.37488946318626404,
0.006672814954072237,
-0.5592028498649597,
0.5479699969291687,
-0.3053548038005829,
-0.08818741887807... |
javascript/reference/global_objects/math/ln2/index.md | JavaScript - Global Objects - Math - LN2 - Description:
Because `LN2` is a static property of `Math`, you always use it as `Math.LN2`, rather than as a property of a `Math` object you created (`Math` is not a constructor). | [
-1.67709481716156,
0.1783825308084488,
-0.3340092897415161,
0.14215552806854248,
-0.40503326058387756,
-1.9087151288986206,
-0.40974706411361694,
1.2532172203063965,
-0.12166737765073776,
-0.03638841584324837,
-0.8191161751747131,
0.7551851272583008,
-0.12925942242145538,
-0.10398314148187... |
javascript/reference/global_objects/math/ln2/index.md | JavaScript - Global Objects - Math - LN2 - Examples - Using Math.LN2:
The following function returns the natural log of 2:
Example:
function getNatLog2() {
return Math.LN2;
}
getNatLog2(); // 0.6931471805599453 | [
-1.4154783487319946,
0.9105005264282227,
-0.7006616592407227,
-0.2669772505760193,
-1.3578611612319946,
-0.7288132309913635,
-0.39516547322273254,
0.05000326409935951,
-1.1367934942245483,
-0.408958375453949,
-0.41664955019950867,
0.691308319568634,
-0.5927601456642151,
0.3279670774936676,... |
javascript/reference/global_objects/math/expm1/index.md | JavaScript - Global Objects - Math - expm1:
The `Math.expm1()` static method returns e raised to the power of a number, subtracted by 1. That is
Example:
console.log(Math.expm1(0));
// Expected output: 0
console.log(Math.expm1(1));
// Expected output: 1.718281828459045
console.log(Math.expm1(-1));
// Expected outp... | [
-1.5799036026000977,
-0.16624604165554047,
-0.8740289211273193,
-0.6225555539131165,
0.13023284077644348,
-1.9306740760803223,
0.1263497918844223,
0.7825727462768555,
0.15096616744995117,
0.20853637158870697,
-0.7243694067001343,
0.7392606139183044,
-0.5108685493469238,
-0.4743150472640991... |
javascript/reference/global_objects/math/expm1/index.md | JavaScript - Global Objects - Math - expm1 - Syntax:
Example:
Math.expm1(x) | [
-0.6173768043518066,
0.40930086374282837,
-0.9628067016601562,
-1.0628025531768799,
-1.0968979597091675,
-1.8323078155517578,
0.07150834053754807,
1.13640558719635,
0.7873479127883911,
-0.7144009470939636,
-0.6192594170570374,
0.7386924028396606,
-0.40521398186683655,
-0.4408337473869324,
... |
javascript/reference/global_objects/math/expm1/index.md | JavaScript - Global Objects - Math - expm1 - Syntax - Parameters:
- `x`: A number. | [
-0.36204051971435547,
-0.6065452694892883,
-1.5139079093933105,
-1.2354507446289062,
-0.9747303128242493,
-1.7368749380111694,
0.26737335324287415,
0.7881454229354858,
0.8268372416496277,
-0.8747839331626892,
-1.134229302406311,
0.5656169056892395,
-0.3894316554069519,
0.06275278329849243,... |
javascript/reference/global_objects/math/expm1/index.md | JavaScript - Global Objects - Math - expm1 - Syntax - Return value:
A number representing ex - 1, where e is the base of the natural logarithm. | [
-0.47521430253982544,
-0.2055409550666809,
-1.3811326026916504,
-0.6356130242347717,
-0.7459033131599426,
-1.5248804092407227,
-0.15870194137096405,
0.7600402235984802,
0.3415411412715912,
-0.19288210570812225,
-0.9347225427627563,
1.396785020828247,
-0.8224760890007019,
0.8941333293914795... |
javascript/reference/global_objects/math/expm1/index.md | JavaScript - Global Objects - Math - expm1 - Description:
For very small values of x, adding 1 can reduce or eliminate precision. The double floats used in JS give you about 15 digits of precision. 1 + 1e-15 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because dig... | [
-1.3694206476211548,
-0.5297991037368774,
-1.4426578283309937,
0.15990905463695526,
0.11283493787050247,
-1.4860179424285889,
0.7735724449157715,
0.273237019777298,
-0.14599493145942688,
0.24461260437965393,
-1.0800118446350098,
1.3414894342422485,
-1.3798930644989014,
0.06463252753019333,... |
javascript/reference/global_objects/math/expm1/index.md | JavaScript - Global Objects - Math - expm1 - Examples - Using Math.expm1():
Example:
Math.expm1(-Infinity); // -1
Math.expm1(-1); // -0.6321205588285577
Math.expm1(-0); // -0
Math.expm1(0); // 0
Math.expm1(1); // 1.718281828459045
Math.expm1(Infinity); // Infinity | [
-1.8280799388885498,
0.14187456667423248,
-0.2537524700164795,
-0.29553771018981934,
-0.3738560676574707,
-1.8910194635391235,
0.013310126028954983,
-0.19250555336475372,
0.45576244592666626,
-0.6354662179946899,
-0.9468161463737488,
0.4697362184524536,
-0.03426197171211243,
-0.61509442329... |
javascript/reference/global_objects/math/log10/index.md | JavaScript - Global Objects - Math - log10:
The `Math.log10()` static method returns the base 10 logarithm of a number. That is
Example:
console.log(Math.log10(100000));
// Expected output: 5
console.log(Math.log10(2));
// Expected output: 0.3010299956639812
console.log(Math.log10(1));
// Expected output: 0
conso... | [
-0.15100930631160736,
-0.17573761940002441,
-1.8158515691757202,
-0.061619047075510025,
0.06314031779766083,
-1.821179986000061,
-0.2521646022796631,
0.5381554961204529,
-0.1624050885438919,
0.09147030860185623,
-0.627819836139679,
0.670932948589325,
0.17298683524131775,
0.1697439402341842... |
javascript/reference/global_objects/math/log10/index.md | JavaScript - Global Objects - Math - log10 - Syntax:
Example:
Math.log10(x) | [
0.29367971420288086,
0.47099563479423523,
-1.487112045288086,
-0.8047106266021729,
-0.9434311389923096,
-1.888883113861084,
0.227249875664711,
0.8618806004524231,
-0.23029515147209167,
-0.9544999003410339,
-0.32128629088401794,
0.5403178930282593,
-0.14998574554920197,
0.19758792221546173,... |
javascript/reference/global_objects/math/log10/index.md | JavaScript - Global Objects - Math - log10 - Syntax - Parameters:
- `x`: A number greater than or equal to 0. | [
-0.14238806068897247,
-0.3996124267578125,
-1.248659610748291,
-0.6493005752563477,
-0.8599703311920166,
-1.5487029552459717,
0.37091225385665894,
0.8235164284706116,
0.2990964949131012,
-0.9903102517127991,
-1.1141701936721802,
0.08464392274618149,
-0.4215240180492401,
0.14071689546108246... |
javascript/reference/global_objects/math/log10/index.md | JavaScript - Global Objects - Math - log10 - Syntax - Return value:
The base 10 logarithm of `x`. If `x < 0`, returns `NaN`. | [
0.045037444680929184,
0.2950677275657654,
-1.2953394651412964,
-0.599741518497467,
-0.5569669008255005,
-1.043839454650879,
0.7598097324371338,
0.4007922112941742,
-0.6769527792930603,
-0.13534106314182281,
-0.9445943236351013,
0.7692688703536987,
-0.5824988484382629,
0.6015734076499939,
... |
javascript/reference/global_objects/math/log10/index.md | JavaScript - Global Objects - Math - log10 - Description:
Because `log10()` is a static method of `Math`, you always use it as `Math.log10()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
This function is the equivalent of `Math.log(x) / Math.log(10)`. For `log10(e)`, use the ... | [
-0.20149248838424683,
0.09066584706306458,
-1.2981019020080566,
-0.1763395518064499,
-0.0851651281118393,
-2.2899062633514404,
-0.21204014122486115,
1.272524356842041,
-0.45329034328460693,
0.3575729429721832,
-0.7541893124580383,
0.5352644324302673,
0.26746341586112976,
-0.133928433060646... |
javascript/reference/global_objects/math/log10/index.md | JavaScript - Global Objects - Math - log10 - Examples - Using Math.log10():
Example:
Math.log10(-2); // NaN
Math.log10(-0); // -Infinity
Math.log10(0); // -Infinity
Math.log10(1); // 0
Math.log10(2); // 0.3010299956639812
Math.log10(100000); // 5
Math.log10(Infinity); // Infinity | [
-0.6201373338699341,
0.2160322219133377,
-0.7806195616722107,
-0.2617540657520294,
-0.3415537178516388,
-1.6052016019821167,
0.3405260741710663,
0.003827687120065093,
-0.48318251967430115,
-0.6307404041290283,
-0.7596627473831177,
0.2067311704158783,
0.1303292214870453,
-0.3188146352767944... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random:
The `Math.random()` static method returns a floating-point, pseudo-random number that's greater than or equal to 0 and less than 1, with approximately uniform distribution over that range — which you can then scale to your desired range. The implementation selects the initi... | [
-1.1547797918319702,
0.030438940972089767,
-1.2968745231628418,
-0.2408885657787323,
0.17972896993160248,
-0.4889673888683319,
0.23901624977588654,
1.1336984634399414,
-0.8243920803070068,
0.7166974544525146,
-1.3842849731445312,
1.4284526109695435,
-0.32960647344589233,
-0.369162708520889... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Syntax:
Example:
Math.random() | [
-0.3736599087715149,
0.3037593364715576,
-0.165018692612648,
-0.7338966131210327,
-0.7365096211433411,
-1.2909133434295654,
0.39080971479415894,
1.1481746435165405,
-0.5220565795898438,
-0.7365715503692627,
-1.0637435913085938,
0.8339322209358215,
-0.24447736144065857,
-0.09289760142564774... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Syntax - Parameters:
None. | [
-0.41280579566955566,
0.4544101655483246,
-0.6907691359519958,
-1.133101463317871,
-0.5612848997116089,
-0.8532077670097351,
0.7853453755378723,
1.2064542770385742,
-0.24976253509521484,
-0.6550648808479309,
-1.4260355234146118,
0.11371287703514099,
-0.00105375109706074,
0.1777772158384323... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Syntax - Return value:
A floating-point, pseudo-random number between 0 (inclusive) and 1 (exclusive). | [
-0.9162293076515198,
-0.18046893179416656,
-0.4269844889640808,
-0.6212078928947449,
-0.23080848157405853,
-0.7759978771209717,
0.12198327481746674,
1.0403053760528564,
-0.1863621473312378,
-0.09806588292121887,
-1.344240427017212,
1.653775930404663,
-0.32704758644104004,
0.133464932441711... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Examples:
Note that as numbers in JavaScript are IEEE 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for `Math.random()` itself) aren't exact. Usually, the claimed upper bound is not attainable,... | [
-1.518489122390747,
0.8166519999504089,
-0.5505595803260803,
-0.40087375044822693,
-0.18487036228179932,
-1.2611242532730103,
0.03961329162120819,
0.624565601348877,
-1.659147024154663,
0.0404479019343853,
-0.9297528266906738,
1.3482526540756226,
-0.9588147401809692,
0.08717264235019684,
... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Examples - Getting a random number between 0 (inclusive) and 1 (exclusive):
Example:
function getRandom() {
return Math.random();
} | [
-1.266512393951416,
0.31287771463394165,
-0.5949382185935974,
-0.6834659576416016,
-0.5264109373092651,
-1.1709994077682495,
0.05540354177355766,
0.29718926548957825,
-0.6054374575614929,
-0.36338937282562256,
-0.9814712405204773,
0.8296091556549072,
-0.5287972688674927,
-0.382079064846038... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Examples - Getting a random number between two values:
This example returns a random number between the specified values. The returned value is no lower than (and may possibly equal) `min`, and is less than (and not equal) `max`.
Example:
function getRandomArbitrary(min,... | [
-0.9591774344444275,
-0.26683512330055237,
-0.7725818753242493,
-0.2517004907131195,
-0.8624518513679504,
-0.2711431384086609,
0.5102359056472778,
0.6822147369384766,
-0.4178403317928314,
-0.4663994312286377,
-1.2488155364990234,
0.8129566311836243,
-0.7689532041549683,
0.19391454756259918... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Examples - Getting a random integer between two values:
This example returns a random integer between the specified values. The value is no lower than `min` (or the next integer greater than `min` if `min` isn't an integer), and is less than (but not equal to) `max`.
Exam... | [
-0.9039016962051392,
0.4958638846874237,
-0.3151415288448334,
0.8069398403167725,
0.355388879776001,
-0.39826416969299316,
0.42336201667785645,
0.44794121384620667,
-0.6212237477302551,
0.6206663250923157,
-1.0941720008850098,
0.3341532051563263,
-0.8393310904502869,
0.05893837660551071,
... |
javascript/reference/global_objects/math/random/index.md | JavaScript - Global Objects - Math - random - Examples - Getting a random integer between two values, inclusive:
While the `getRandomInt()` function above is inclusive at the minimum, it's exclusive at the maximum. What if you need the results to be inclusive at both the minimum and the maximum? The `getRandomIntInclu... | [
-1.1005685329437256,
0.3760504424571991,
-0.4413668215274811,
0.7906370162963867,
0.3370879292488098,
-0.07375828176736832,
0.37738654017448425,
0.11610404402017593,
-0.5106242895126343,
-0.15181316435337067,
-0.44188252091407776,
0.6662077307701111,
-0.7033172249794006,
-0.056836389005184... |
javascript/reference/global_objects/math/atan/index.md | JavaScript - Global Objects - Math - atan:
The `Math.atan()` static method returns the inverse tangent (in radians) of a number, that is
Example:
// Calculates angle of a right-angle triangle in radians
function calcAngle(opposite, adjacent) {
return Math.atan(opposite / adjacent);
}
console.log(calcAngle(8, 10))... | [
-0.2328747808933258,
0.21967831254005432,
-1.6828341484069824,
-0.3478219509124756,
-0.21379856765270233,
-0.710109531879425,
0.5489650964736938,
0.6718944311141968,
-0.7427046298980713,
0.6499656438827515,
-0.7294428944587708,
0.93045574426651,
-0.16049253940582275,
0.2515121400356293,
... |
javascript/reference/global_objects/math/atan/index.md | JavaScript - Global Objects - Math - atan - Syntax:
Example:
Math.atan(x) | [
0.5139408111572266,
0.3894073963165283,
-1.2983934879302979,
-0.5434616208076477,
-1.3200892210006714,
-1.1488769054412842,
0.6359272599220276,
0.8987502455711365,
-0.4730881154537201,
-0.6964616775512695,
-0.5009254813194275,
0.39423900842666626,
-0.9774962663650513,
0.16138856112957,
0... |
javascript/reference/global_objects/math/atan/index.md | JavaScript - Global Objects - Math - atan - Syntax - Parameters:
- `x`: A number. | [
0.44431737065315247,
-0.47431549429893494,
-1.7457860708236694,
-1.0853509902954102,
-1.0938466787338257,
-1.2314910888671875,
0.6571424603462219,
0.7410525679588318,
0.047373078763484955,
-0.5121915936470032,
-1.0860636234283447,
0.06024143472313881,
-0.7270938754081726,
0.333101272583007... |
javascript/reference/global_objects/math/atan/index.md | JavaScript - Global Objects - Math - atan - Syntax - Return value:
The inverse tangent (angle in radians between -π2-\frac{\pi}{2} and π2\frac{\pi}{2}, inclusive) of `x`. If `x` is `Infinity`, it returns π2\frac{\pi}{2}. If `x` is `-Infinity`, it returns -π2-\frac{\pi}{2}. | [
-2.054093599319458,
0.4347609281539917,
-0.4996436536312103,
0.2312587946653366,
-0.7271435260772705,
-0.4783267378807068,
0.8989959359169006,
0.48241665959358215,
-0.12941300868988037,
0.4728449583053589,
-0.6117556691169739,
0.9978989362716675,
0.10450047999620438,
0.528809130191803,
0... |
javascript/reference/global_objects/math/atan/index.md | JavaScript - Global Objects - Math - atan - Description:
Because `atan()` is a static method of `Math`, you always use it as `Math.atan()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
0.04026228189468384,
-0.3333260118961334,
-1.0381850004196167,
0.114596888422966,
-0.5969018936157227,
-2.109051465988159,
0.1570752114057541,
1.0401043891906738,
-0.3346351683139801,
0.24462467432022095,
-0.7364824414253235,
0.5281981825828552,
-0.13136564195156097,
-0.02950935624539852,
... |
javascript/reference/global_objects/math/atan/index.md | JavaScript - Global Objects - Math - atan - Examples - Using Math.atan():
Example:
Math.atan(-Infinity); // -1.5707963267948966 (-π/2)
Math.atan(-0); // -0
Math.atan(0); // 0
Math.atan(1); // 0.7853981633974483 (π/4)
Math.atan(Infinity); // 1.5707963267948966 (π/2)
// The angle that the line (0,0) -- (x,y) forms w... | [
-0.4310718774795532,
0.5054557919502258,
-1.477140188217163,
-0.048894576728343964,
0.005296746734529734,
-0.4640876054763794,
-0.21076427400112152,
0.5868387222290039,
-0.22745580971240997,
0.24106794595718384,
-0.4976625144481659,
0.14210788905620575,
0.06666278839111328,
-0.055940944701... |
javascript/reference/global_objects/math/sqrt1_2/index.md | JavaScript - Global Objects - Math - SQRT1_2:
The `Math.SQRT1_2` static data property represents the square root of 1/2, which is approximately 0.707.
Example:
function getRoot1Over2() {
return Math.SQRT1_2;
}
console.log(getRoot1Over2());
// Expected output: 0.7071067811865476 | [
-1.9872130155563354,
0.5248708724975586,
-1.1146544218063354,
-0.1597774773836136,
-0.36455807089805603,
-1.8194471597671509,
-0.523563802242279,
0.3224030137062073,
0.110434889793396,
-0.4406488537788391,
-0.45552295446395874,
0.9113284945487976,
-0.25583502650260925,
-0.46431764960289,
... |
javascript/reference/global_objects/math/sqrt1_2/index.md | JavaScript - Global Objects - Math - SQRT1_2 - Description:
`Math.SQRT1_2` is a constant and a more performant equivalent to `Math.sqrt(0.5)`.
Because `SQRT1_2` is a static property of `Math`, you always use it as `Math.SQRT1_2`, rather than as a property of a `Math` object you created (`Math` is not a constructor). | [
-1.490971326828003,
0.32188665866851807,
-0.6507174372673035,
-0.08655790239572525,
0.01953423023223877,
-1.9549334049224854,
-0.3603886663913727,
0.9209005236625671,
0.6729651689529419,
0.3154882788658142,
-1.278141736984253,
0.37722498178482056,
0.17334581911563873,
-0.32261404395103455,... |
javascript/reference/global_objects/math/sqrt1_2/index.md | JavaScript - Global Objects - Math - SQRT1_2 - Examples - Using Math.SQRT1_2:
The following function calculates the side length of a square given its diagonal length:
Example:
function getSquareSideLength(diagonalLength) {
return diagonalLength * Math.SQRT1_2;
} | [
-1.6678541898727417,
1.2011984586715698,
-1.5322550535202026,
-1.1413737535476685,
-0.8284953832626343,
0.011973398737609386,
0.30891314148902893,
0.000580105057451874,
-0.10580108314752579,
-0.2833282947540283,
-1.0156193971633911,
0.7690548896789551,
-0.6602542400360107,
0.05139975622296... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor:
The `Math.floor()` static method always rounds down and returns the largest integer less than or equal to a given number.
Example:
console.log(Math.floor(5.95));
// Expected output: 5
console.log(Math.floor(5.05));
// Expected output: 5
console.log(Math.floor(5));
// Exp... | [
-1.2694368362426758,
0.11503302305936813,
-1.529499888420105,
0.29035910964012146,
0.1355951577425003,
-0.7547881007194519,
-0.2485620230436325,
0.572985827922821,
-0.7399283647537231,
0.42400088906288147,
-0.2731427550315857,
1.5391086339950562,
-0.39626193046569824,
0.4022868275642395,
... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor - Syntax:
Example:
Math.floor(x) | [
-0.44334542751312256,
0.6469234824180603,
-1.4246071577072144,
-0.3769542872905731,
-0.7286533713340759,
-1.3627419471740723,
0.32309412956237793,
1.0903364419937134,
-0.25524747371673584,
-0.7274863123893738,
-0.21889044344425201,
1.2563185691833496,
-0.18552663922309875,
0.26269453763961... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor - Syntax - Parameters:
- `x`: A number. | [
-0.30904650688171387,
-0.002177221467718482,
-1.806570053100586,
-1.0713019371032715,
-0.7364014387130737,
-1.3163013458251953,
0.5326440930366516,
0.652692437171936,
0.11023278534412384,
-0.7016189694404602,
-0.8620496988296509,
0.7553145885467529,
-0.13556300103664398,
0.3900837302207947... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor - Syntax - Return value:
The largest integer smaller than or equal to `x`. It's the same value as `-Math.ceil(-x)`. | [
-1.2218151092529297,
0.28075188398361206,
-1.3526195287704468,
-0.6087967753410339,
-0.974535346031189,
-0.7215718626976013,
0.7973377108573914,
0.4290638267993927,
-0.5056064128875732,
-0.11672955006361008,
0.06952045112848282,
1.2731493711471558,
-0.21852116286754608,
0.5134763717651367,... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor - Description:
Because `floor()` is a static method of `Math`, you always use it as `Math.floor()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.8327162265777588,
0.18471278250217438,
-1.118341326713562,
0.2481490671634674,
0.02041488140821457,
-2.1554930210113525,
0.027308089658617973,
1.1598299741744995,
-0.2944837510585785,
0.17467795312404633,
-0.41355058550834656,
0.9892894625663757,
0.4941178560256958,
0.043069057166576385... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor - Examples - Using Math.floor():
Example:
Math.floor(-Infinity); // -Infinity
Math.floor(-45.95); // -46
Math.floor(-45.05); // -46
Math.floor(-0); // -0
Math.floor(0); // 0
Math.floor(4); // 4
Math.floor(45.05); // 45
Math.floor(45.95); // 45
Math.floor(Infinity); // Infini... | [
-1.3966445922851562,
0.7463411688804626,
-0.7322962284088135,
0.03351225703954697,
-0.5375968217849731,
-0.8571404814720154,
0.24955351650714874,
-0.011310869827866554,
-0.21880052983760834,
-0.5750474333763123,
-0.2598896324634552,
0.8612081408500671,
0.32531121373176575,
-0.2444934248924... |
javascript/reference/global_objects/math/floor/index.md | JavaScript - Global Objects - Math - floor - Examples - Decimal adjustment:
In this example, we implement a method called `decimalAdjust()` that is an enhancement method of `Math.floor()`, `Math.ceil()`, and `Math.round()`. While the three `Math` functions always adjust the input to the units digit, `decimalAdjust` ac... | [
-0.5705311298370361,
0.20193709433078766,
-0.5888806581497192,
-0.01967480219900608,
0.35053110122680664,
-0.8711633682250977,
0.6563120484352112,
0.40257543325424194,
-0.461049884557724,
0.18469874560832977,
-0.3073274493217468,
0.7289629578590393,
-1.3339461088180542,
0.3012091815471649,... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log:
The `Math.log()` static method returns the natural logarithm (base e) of a number. That is
Example:
function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
}
// 2 x 2 x 2 = 8
console.log(getBaseLog(2, 8));
// Expected output: 3
// 5 x 5 x 5 x 5 = 625
console.log(ge... | [
0.13560082018375397,
-0.14615391194820404,
-1.844581127166748,
0.1810673326253891,
0.10691359639167786,
-1.3983047008514404,
-0.42563900351524353,
0.5678552389144897,
-0.2589423358440399,
0.0007993102772161365,
-0.7978079319000244,
0.7927568554878235,
-0.18014688789844513,
0.14528836309909... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log - Syntax:
Example:
Math.log(x) | [
0.06010511890053749,
0.17777960002422333,
-1.3961313962936401,
-0.52205491065979,
-0.9176005125045776,
-1.5178807973861694,
0.1228376179933548,
1.083604335784912,
-0.07059802114963531,
-1.3094613552093506,
-0.15312394499778748,
0.5268128514289856,
0.09167249500751495,
-0.01319883018732071,... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log - Syntax - Parameters:
- `x`: A number greater than or equal to 0. | [
-0.14844374358654022,
-0.46484702825546265,
-1.2573931217193604,
-0.6181685924530029,
-0.9227557182312012,
-1.4106959104537964,
0.38629353046417236,
0.8350618481636047,
0.2894587814807892,
-1.1299670934677124,
-0.9744622111320496,
0.07142988592386246,
-0.35848942399024963,
0.12878288328647... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log - Syntax - Return value:
The natural logarithm (base e) of `x`. If `x` is ±0, returns `-Infinity`. If `x < 0`, returns `NaN`. | [
-0.616800844669342,
0.3699505925178528,
-0.9669179916381836,
0.014336848631501198,
-0.8063836693763733,
-1.4487888813018799,
0.6468992233276367,
0.03474302962422371,
-0.27527308464050293,
0.16098247468471527,
-0.8007628917694092,
0.6476048231124878,
-0.3151102066040039,
0.28117793798446655... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log - Description:
Because `log()` is a static method of `Math`, you always use it as `Math.log()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
If you need the natural log of 2 or 10, use the constants `Math.LN2` or `Math.LN10`. If you nee... | [
-0.11110123246908188,
0.5463948249816895,
-1.850468635559082,
-0.1175425723195076,
0.01044627744704485,
-1.770804762840271,
-0.3815615773200989,
0.2729448676109314,
0.042974937707185745,
-0.020215140655636787,
-0.8415454626083374,
0.5097287893295288,
-0.14153145253658295,
-0.21305915713310... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log - Examples - Using Math.log():
Example:
Math.log(-1); // NaN
Math.log(-0); // -Infinity
Math.log(0); // -Infinity
Math.log(1); // 0
Math.log(10); // 2.302585092994046
Math.log(Infinity); // Infinity | [
-0.9847468137741089,
0.30458760261535645,
-0.4526927173137665,
0.061466969549655914,
-0.4442935585975647,
-1.3377736806869507,
0.422359824180603,
0.08174796402454376,
-0.6168873906135559,
-0.738512396812439,
-0.3681759834289551,
0.18797142803668976,
0.2773543894290924,
-0.6633864641189575,... |
javascript/reference/global_objects/math/log/index.md | JavaScript - Global Objects - Math - log - Examples - Using Math.log() with a different base:
The following function returns the logarithm of `y` with base `x` (i.e., logxy\log_x y):
Example:
function getBaseLog(x, y) {
return Math.log(y) / Math.log(x);
}
If you run `getBaseLog(10, 1000)`, it returns `2.999999999... | [
0.3460262715816498,
0.7768908739089966,
-1.6715216636657715,
0.03674070164561272,
-0.36536577343940735,
-0.7436923384666443,
-0.2946462631225586,
-0.19755393266677856,
-0.29117026925086975,
-0.8021706342697144,
-0.21097710728645325,
1.4099406003952026,
-0.11394167691469193,
0.4446721374988... |
javascript/reference/global_objects/math/sqrt2/index.md | JavaScript - Global Objects - Math - SQRT2:
The `Math.SQRT2` static data property represents the square root of 2, approximately 1.414.
Example:
function getRoot2() {
return Math.SQRT2;
}
console.log(getRoot2());
// Expected output: 1.4142135623730951 | [
-1.8807916641235352,
0.3022617995738983,
-1.0136109590530396,
-0.18917998671531677,
-0.7299275994300842,
-1.7353888750076294,
-0.5628798604011536,
-0.03528609126806259,
0.05129034444689751,
-0.20874929428100586,
-0.3597639501094818,
0.9635366201400757,
0.2562275826931,
-0.46738454699516296... |
javascript/reference/global_objects/math/sqrt2/index.md | JavaScript - Global Objects - Math - SQRT2 - Description:
`Math.SQRT2` is a constant and a more performant equivalent to `Math.sqrt(2)`.
Because `SQRT2` is a static property of `Math`, you always use it as `Math.SQRT2`, rather than as a property of a `Math` object you created (`Math` is not a constructor). | [
-1.6180537939071655,
0.3123314380645752,
-0.752265214920044,
-0.13239891827106476,
-0.22635389864444733,
-1.9221216440200806,
-0.17336782813072205,
0.798307478427887,
0.7087942361831665,
0.6495192646980286,
-0.9576637744903564,
0.9077798128128052,
0.33538269996643066,
0.02752472087740898,
... |
javascript/reference/global_objects/math/sqrt2/index.md | JavaScript - Global Objects - Math - SQRT2 - Examples - Using Math.SQRT2:
The following function returns the square root of 2:
Example:
function getRoot2() {
return Math.SQRT2;
}
getRoot2(); // 1.4142135623730951 | [
-1.753071904182434,
1.1658787727355957,
-0.7949528098106384,
-0.41702643036842346,
-1.1109867095947266,
-1.2088127136230469,
0.14764443039894104,
-0.3858465254306793,
-0.6333231925964355,
-0.616438627243042,
-0.43804365396499634,
1.0393052101135254,
-0.49976032972335815,
0.0323874205350875... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs:
The `Math.abs()` static method returns the absolute value of a number.
Example:
function difference(a, b) {
return Math.abs(a - b);
}
console.log(difference(3, 5));
// Expected output: 2
console.log(difference(5, 3));
// Expected output: 2
console.log(difference(1.23456... | [
-0.0382615365087986,
-0.5540560483932495,
-1.4331367015838623,
-0.2182614952325821,
-0.06657871603965759,
-1.3223482370376587,
0.5637640953063965,
0.9560800194740295,
0.41334637999534607,
0.17462706565856934,
-0.645657479763031,
0.617766797542572,
0.27955156564712524,
0.4320646822452545,
... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs - Syntax:
Example:
Math.abs(x) | [
0.3399026393890381,
0.1481596827507019,
-1.1789743900299072,
-0.5736503005027771,
-0.8494426608085632,
-1.2409687042236328,
0.7510173320770264,
0.9584805965423584,
0.3791695833206177,
-0.40515461564064026,
-0.7904008626937866,
0.6344162225723267,
0.012901595793664455,
0.17702272534370422,
... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs - Syntax - Parameters:
- `x`: A number. | [
0.49503445625305176,
-0.4173656404018402,
-1.7790873050689697,
-0.9795952439308167,
-0.8924338221549988,
-1.2013983726501465,
0.8176670074462891,
0.6262219548225403,
0.5772625207901001,
-0.4871245324611664,
-1.4025942087173462,
0.2579864263534546,
0.12463981658220291,
0.32123157382011414,
... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs - Syntax - Return value:
The absolute value of `x`. If `x` is negative or `-0`, returns its opposite number `-x` (which is non-negative). Otherwise, returns `x` itself. The result is therefore always a positive number or `0`. | [
-0.5850116610527039,
0.22074294090270996,
-1.0520440340042114,
0.21959535777568817,
-0.6185272932052612,
-1.4112675189971924,
1.5763431787490845,
0.6478394269943237,
0.3636484444141388,
0.4472312927246094,
-0.8674764633178711,
0.4818097651004791,
-0.15776629745960236,
0.6666058301925659,
... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs - Description:
Because `abs()` is a static method of `Math`, you always use it as `Math.abs()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.012742442078888416,
-0.4678370952606201,
-0.8855792284011841,
0.33752405643463135,
-0.024356551468372345,
-2.1514570713043213,
0.34275317192077637,
0.8660486340522766,
0.33690905570983887,
0.612526535987854,
-0.9902278780937195,
0.6162521243095398,
0.7646320462226868,
-0.068801313638687... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs - Examples - Using Math.abs():
Example:
Math.abs(-Infinity); // Infinity
Math.abs(-1); // 1
Math.abs(-0); // 0
Math.abs(0); // 0
Math.abs(1); // 1
Math.abs(Infinity); // Infinity | [
-0.3621710240840912,
0.3916266858577728,
-0.6028928160667419,
0.2264377474784851,
-0.41959381103515625,
-1.3465855121612549,
0.9785115718841553,
0.20335416495800018,
0.31383800506591797,
-0.23145292699337006,
-0.818939745426178,
0.09003155678510666,
0.6642615795135498,
-0.35088595747947693... |
javascript/reference/global_objects/math/abs/index.md | JavaScript - Global Objects - Math - abs - Examples - Coercion of parameter:
`Math.abs()` coerces its parameter to a number. Non-coercible values will become `NaN`, making `Math.abs()` also return `NaN`.
Example:
Math.abs("-1"); // 1
Math.abs(-2); // 2
Math.abs(null); // 0
Math.abs(""); // 0
Math.abs([]); // 0
Math.... | [
-0.12236299365758896,
0.42184212803840637,
-0.6030431389808655,
-0.07110479474067688,
-0.11035525798797607,
-0.6508004069328308,
0.9142330288887024,
0.3315354883670807,
-0.4149678945541382,
0.7453621625900269,
-1.181566834449768,
0.0837097018957138,
0.026934724301099777,
-0.575613617897033... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2:
The `Math.atan2()` static method returns the angle in the plane (in radians) between the positive x-axis and the ray from (0, 0) to the point (x, y), for `Math.atan2(y, x)`.
Example:
function calcAngleDegrees(x, y) {
return (Math.atan2(y, x) * 180) / Math.PI;
}
console.... | [
-0.3581940233707428,
-0.17759540677070618,
-1.4799320697784424,
-0.7671568989753723,
-0.21148991584777832,
-0.45448657870292664,
0.07641313970088959,
0.3468138575553894,
0.20741014182567596,
0.27198243141174316,
-0.22373166680335999,
0.5064605474472046,
-0.07091005146503448,
0.374363034963... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2 - Syntax:
Example:
Math.atan2(y, x) | [
0.19565658271312714,
0.6635823249816895,
-0.876815915107727,
-0.4174816608428955,
-1.1265863180160522,
-1.3280267715454102,
-0.14754946529865265,
0.844621479511261,
-0.1334216594696045,
-0.9360105395317078,
-0.5231407284736633,
0.2439221441745758,
-0.6713847517967224,
0.10062766075134277,
... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2 - Syntax - Parameters:
- `y`: The y coordinate of the point.
- `x`: The x coordinate of the point. | [
0.6249479055404663,
-0.023359039798378944,
-1.2218445539474487,
-0.9179290533065796,
-0.4535175859928131,
-1.3709462881088257,
0.00747407041490078,
0.5422961115837097,
0.7399600148200989,
-0.5726963877677917,
-0.9373690485954285,
0.4039638042449951,
-0.296482115983963,
0.5422736406326294,
... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2 - Syntax - Return value:
The angle in radians (between -π and π, inclusive) between the positive x-axis and the ray from (0, 0) to the point (x, y). | [
-0.6801531910896301,
0.24100233614444733,
-0.9262957572937012,
-0.7761961221694946,
-0.600861132144928,
-0.2517673373222351,
0.23969802260398865,
0.489676833152771,
0.4572656750679016,
0.07922805845737457,
-0.43408510088920593,
0.6055083870887756,
-0.02326826937496662,
0.524958074092865,
... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2 - Description:
The `Math.atan2()` method measures the counterclockwise angle θ, in radians, between the positive x-axis and the point `(x, y)`. Note that the arguments to this function pass the y-coordinate first and the x-coordinate second.
`Math.atan2()` is passed separate... | [
-0.4378237724304199,
0.526622474193573,
-0.5120192766189575,
1.0361783504486084,
0.5930868983268738,
-0.2916196286678314,
0.057959556579589844,
0.6178669333457947,
0.18157218396663666,
0.664621114730835,
-0.822759211063385,
0.07442198693752289,
0.35118773579597473,
-0.06822258979082108,
... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2 - Examples - Using Math.atan2():
Example:
Math.atan2(90, 15); // 1.4056476493802699
Math.atan2(15, 90); // 0.16514867741462683 | [
-0.32948288321495056,
0.17100948095321655,
-0.6874449849128723,
-0.2540755867958069,
-1.09784734249115,
-1.1871466636657715,
0.09658138453960419,
-0.3191787004470825,
-0.7752004265785217,
-0.7133740186691284,
-0.7064524292945862,
0.3242892920970917,
-0.934662938117981,
-0.12086554616689682... |
javascript/reference/global_objects/math/atan2/index.md | JavaScript - Global Objects - Math - atan2 - Examples - Difference between Math.atan2(y, x) and Math.atan(y / x):
The following script prints all inputs that produce a difference between `Math.atan2(y, x)` and `Math.atan(y / x)`.
Example:
const formattedNumbers = new Map([
[-Math.PI, "-π"],
[(-3 * Math.PI) / 4, ... | [
-1.1625242233276367,
0.018578898161649704,
-1.1991581916809082,
-0.08235269039869308,
-0.787119448184967,
-1.4003326892852783,
-0.6705390214920044,
0.9013345241546631,
0.5760117769241333,
0.10617008060216904,
-0.7559782862663269,
-0.010174620896577835,
-0.48969438672065735,
-0.005452449899... |
javascript/reference/global_objects/math/tanh/index.md | JavaScript - Global Objects - Math - tanh:
The `Math.tanh()` static method returns the hyperbolic tangent of a number. That is,
Example:
console.log(Math.tanh(-1));
// Expected output: -0.7615941559557649
console.log(Math.tanh(0));
// Expected output: 0
console.log(Math.tanh(Infinity));
// Expected output: 1
cons... | [
-0.7989911437034607,
-0.5038382411003113,
-0.9221066832542419,
0.028523683547973633,
-0.21671076118946075,
-1.2939176559448242,
0.2802976965904236,
0.5658606290817261,
-0.858070433139801,
0.7210227251052856,
-0.8135189414024353,
0.5766433477401733,
0.2565535008907318,
0.5201591849327087,
... |
javascript/reference/global_objects/math/tanh/index.md | JavaScript - Global Objects - Math - tanh - Syntax:
Example:
Math.tanh(x) | [
0.023468485102057457,
0.1596984714269638,
-0.8779707551002502,
-0.8677429556846619,
-1.3549270629882812,
-1.3702216148376465,
0.8554562926292419,
1.2775492668151855,
-0.6840320229530334,
-0.10312896966934204,
-0.6682612895965576,
0.6056418418884277,
-0.47210437059402466,
0.5794163942337036... |
javascript/reference/global_objects/math/tanh/index.md | JavaScript - Global Objects - Math - tanh - Syntax - Parameters:
- `x`: A number. | [
0.18495747447013855,
-0.6014096736907959,
-1.4681085348129272,
-1.0960031747817993,
-1.1394927501678467,
-1.3545750379562378,
0.8403697609901428,
0.8039456605911255,
-0.1203838512301445,
-0.3637322187423706,
-1.5255123376846313,
0.06464730203151703,
-0.4599291682243347,
0.5518909692764282,... |
javascript/reference/global_objects/math/tanh/index.md | JavaScript - Global Objects - Math - tanh - Syntax - Return value:
The hyperbolic tangent of `x`. | [
-0.30866727232933044,
0.13622184097766876,
-0.8030758500099182,
-0.19263404607772827,
-1.2563061714172363,
-1.0674071311950684,
1.0268176794052124,
0.5450097918510437,
-0.49404019117355347,
-0.005970579572021961,
-1.2703073024749756,
0.37397581338882446,
-0.11414673924446106,
1.07486450672... |
javascript/reference/global_objects/math/tanh/index.md | JavaScript - Global Objects - Math - tanh - Description:
Because `tanh()` is a static method of `Math`, you always use it as `Math.tanh()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.4021058976650238,
-0.434297651052475,
-0.587715208530426,
-0.07206293940544128,
-0.42194047570228577,
-2.2529735565185547,
0.4281277358531952,
1.2552218437194824,
-0.572448194026947,
0.8820891976356506,
-0.9280734062194824,
0.5298992395401001,
0.30299699306488037,
0.20006383955478668,
... |
javascript/reference/global_objects/math/tanh/index.md | JavaScript - Global Objects - Math - tanh - Examples - Using Math.tanh():
Example:
Math.tanh(-Infinity); // -1
Math.tanh(-0); // -0
Math.tanh(0); // 0
Math.tanh(1); // 0.7615941559557649
Math.tanh(Infinity); // 1 | [
-1.1002320051193237,
0.14132241904735565,
-0.3405446708202362,
0.016330918297171593,
-0.5319983959197998,
-1.6791976690292358,
0.82975172996521,
0.27690884470939636,
-0.7197310328483582,
-0.02936917543411255,
-0.8076906800270081,
0.13019557297229767,
0.08812035620212555,
0.2289976924657821... |
javascript/reference/global_objects/math/pi/index.md | JavaScript - Global Objects - Math - PI:
The `Math.PI` static data property represents the ratio of the circumference of a circle to its diameter, approximately 3.14159.
Example:
function calculateCircumference(radius) {
return 2 * Math.PI * radius;
}
console.log(Math.PI);
// Expected output: 3.141592653589793
c... | [
-2.2593185901641846,
0.24305786192417145,
-0.7955570816993713,
-0.049146439880132675,
-0.5063931345939636,
-0.7631372809410095,
-0.7698328495025635,
0.16201259195804596,
0.7170165181159973,
0.7167981863021851,
-1.0960773229599,
0.4787829518318176,
0.3535371422767639,
-0.10667788237333298,
... |
javascript/reference/global_objects/math/pi/index.md | JavaScript - Global Objects - Math - PI - Description:
Because `PI` is a static property of `Math`, you always use it as `Math.PI`, rather than as a property of a `Math` object you created (`Math` is not a constructor). | [
-1.3463914394378662,
-0.3247641623020172,
-0.800915539264679,
0.6884360313415527,
-0.2758522629737854,
-2.6159794330596924,
-0.2626686990261078,
1.028219223022461,
0.6384179592132568,
0.5396013855934143,
-1.3743457794189453,
0.4226379990577698,
0.7761603593826294,
0.03753078728914261,
0.... |
javascript/reference/global_objects/math/pi/index.md | JavaScript - Global Objects - Math - PI - Examples - Using Math.PI:
The following function uses `Math.PI` to calculate the circumference of a circle with a passed radius.
Example:
function calculateCircumference(radius) {
return Math.PI * (radius + radius);
}
calculateCircumference(1); // 6.283185307179586 | [
-1.825487732887268,
1.3887832164764404,
-0.7638758420944214,
0.13873536884784698,
-0.5688212513923645,
-0.7371744513511658,
-0.24493791162967682,
-0.569689929485321,
0.44793179631233215,
0.42604511976242065,
-1.025987148284912,
0.15548855066299438,
-0.02569536305963993,
0.18645095825195312... |
javascript/reference/global_objects/math/sqrt/index.md | JavaScript - Global Objects - Math - sqrt:
The `Math.sqrt()` static method returns the square root of a number. That is
Example:
function calcHypotenuse(a, b) {
return Math.sqrt(a * a + b * b);
}
console.log(calcHypotenuse(3, 4));
// Expected output: 5
console.log(calcHypotenuse(5, 12));
// Expected output: 13
... | [
-0.5804107189178467,
0.18769654631614685,
-1.4006199836730957,
-0.5443165302276611,
0.19488568603992462,
-1.3962187767028809,
0.5508611798286438,
0.5115630030632019,
0.27713698148727417,
0.5313683748245239,
-0.4098304510116577,
1.2329740524291992,
0.3941839933395386,
-0.386736661195755,
... |
javascript/reference/global_objects/math/sqrt/index.md | JavaScript - Global Objects - Math - sqrt - Syntax:
Example:
Math.sqrt(x) | [
-0.21913263201713562,
0.5437244176864624,
-1.1576123237609863,
-1.0439833402633667,
-1.0724244117736816,
-1.3108229637145996,
0.30334019660949707,
0.1730823516845703,
0.18724045157432556,
-0.7416074275970459,
-0.5961923003196716,
0.8890600204467773,
-0.23545120656490326,
-0.259369820356369... |
javascript/reference/global_objects/math/sqrt/index.md | JavaScript - Global Objects - Math - sqrt - Syntax - Parameters:
- `x`: A number greater than or equal to 0. | [
-0.630058228969574,
-0.34498777985572815,
-1.1766444444656372,
-0.8419883251190186,
-0.9358477592468262,
-1.3093889951705933,
0.37865105271339417,
0.1419254094362259,
0.5082973837852478,
-0.7928385138511658,
-1.1964385509490967,
0.4236754775047302,
-0.6636838912963867,
-0.05158182233572006... |
javascript/reference/global_objects/math/sqrt/index.md | JavaScript - Global Objects - Math - sqrt - Syntax - Return value:
The square root of `x`, a nonnegative number. If `x < 0`, returns `NaN`. | [
-1.1835895776748657,
0.04213227331638336,
-0.8326519727706909,
-0.8341141939163208,
-0.87339848279953,
-0.9935189485549927,
1.354473352432251,
-0.008274383842945099,
-0.5293332934379578,
0.0034525180235505104,
-1.0112390518188477,
0.9455968737602234,
-0.5669575929641724,
-0.079270295798778... |
javascript/reference/global_objects/math/sqrt/index.md | JavaScript - Global Objects - Math - sqrt - Description:
Because `sqrt()` is a static method of `Math`, you always use it as `Math.sqrt()`, rather than as a method of a `Math` object you created (`Math` is not a constructor). | [
-0.7735975384712219,
-0.23734357953071594,
-0.7628527879714966,
-0.2605346739292145,
-0.027565917000174522,
-1.908746361732483,
-0.036615971475839615,
0.2622743844985962,
0.2592390477657318,
0.39951321482658386,
-0.7619466781616211,
0.9122966527938843,
0.6768925786018372,
-0.38251933455467... |
javascript/reference/global_objects/math/sqrt/index.md | JavaScript - Global Objects - Math - sqrt - Examples - Using Math.sqrt():
Example:
Math.sqrt(-1); // NaN
Math.sqrt(-0); // -0
Math.sqrt(0); // 0
Math.sqrt(1); // 1
Math.sqrt(2); // 1.414213562373095
Math.sqrt(9); // 3
Math.sqrt(Infinity); // Infinity | [
-0.8519591689109802,
0.5116922855377197,
-0.40801098942756653,
-0.7459524273872375,
-0.3966107666492462,
-0.8929216265678406,
0.5822384357452393,
-0.5846682190895081,
-0.39857399463653564,
-0.20745901763439178,
-0.9103710651397705,
0.5972133874893188,
-0.3522450923919678,
-0.65989875793457... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max:
The `Math.max()` static method returns the largest of the numbers given as input parameters, or -`Infinity` if there are no parameters.
Example:
console.log(Math.max(1, 3, 2));
// Expected output: 3
console.log(Math.max(-1, -3, -2));
// Expected output: -1
const array = [1... | [
-0.542774498462677,
-0.4569826126098633,
-1.6310350894927979,
0.003473184537142515,
-0.23107416927814484,
-0.6390330195426941,
0.2982809543609619,
0.5164012312889099,
-0.09695127606391907,
-0.13308611512184143,
-0.3328564167022705,
1.0333055257797241,
0.8407089114189148,
-0.490081727504730... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max - Syntax:
Example:
Math.max()
Math.max(value1)
Math.max(value1, value2)
Math.max(value1, value2, /* …, */ valueN) | [
0.21669207513332367,
0.2874823808670044,
-0.5918960571289062,
-0.26007506251335144,
-0.9329383969306946,
-0.9977132678031921,
0.0461614727973938,
1.3853932619094849,
0.11790313571691513,
-0.8746863007545471,
-0.3824504315853119,
0.8402732014656067,
0.04008905962109566,
-0.39793941378593445... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max - Syntax - Parameters:
- `value1`, …, `valueN`: Zero or more numbers among which the largest value will be selected and returned. | [
0.20403455197811127,
0.11597947031259537,
-0.9159241914749146,
-0.11159498244524002,
-0.7525941133499146,
-0.44834643602371216,
0.467589795589447,
0.5948907136917114,
-0.41227975487709045,
-0.49045467376708984,
-0.8629329800605774,
0.7925639152526855,
-0.18431304395198822,
0.00513455644249... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max - Syntax - Return value:
The largest of the given numbers. Returns `NaN` if any of the parameters is or is converted into `NaN`. Returns -`Infinity` if no parameters are provided. | [
-0.4926249086856842,
0.09556807577610016,
-0.7046673893928528,
-0.19053280353546143,
-1.3195443153381348,
-0.40990886092185974,
0.9750585556030273,
-0.17796294391155243,
-0.40878385305404663,
0.15730269253253937,
-0.9749817848205566,
1.1919546127319336,
0.12755735218524933,
0.3251273036003... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max - Description:
Because `max()` is a static method of `Math`, you always use it as `Math.max()`, rather than as a method of a `Math` object you created (`Math` is not a constructor).
`Math.max.length` is 2, which weakly signals that it's designed to handle at least two paramete... | [
-0.6291921734809875,
-0.5924111604690552,
-1.1249438524246216,
0.11013507843017578,
-0.328112930059433,
-1.6115987300872803,
-0.18797293305397034,
1.1252471208572388,
-0.2567484378814697,
-0.003314819186925888,
-1.028853416442871,
1.0766665935516357,
0.5647839903831482,
-0.5405452251434326... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max - Examples - Using Math.max():
Example:
Math.max(10, 20); // 20
Math.max(-10, -20); // -10
Math.max(-10, 20); // 20 | [
-0.28089842200279236,
0.21746370196342468,
-1.2453759908676147,
-0.2273779660463333,
-0.8672326803207397,
-1.0982348918914795,
0.5693821310997009,
0.48834413290023804,
-0.0833822563290596,
-0.6251375675201416,
-0.5808333158493042,
1.3232985734939575,
-0.38841038942337036,
-0.77544689178466... |
javascript/reference/global_objects/math/max/index.md | JavaScript - Global Objects - Math - max - Examples - Getting the maximum element of an array:
`Array.prototype.reduce()` can be used to find the maximum element in a numeric array, by comparing each value:
Example:
const arr = [1, 2, 3];
const max = arr.reduce((a, b) => Math.max(a, b), -Infinity);
The following fu... | [
-0.5298135876655579,
0.390176922082901,
-0.8189502358436584,
0.7789345979690552,
0.3770776689052582,
-0.13518287241458893,
0.7447673678398132,
1.0411005020141602,
-0.25905677676200867,
0.44955727458000183,
-0.6458560824394226,
0.9225717782974243,
-0.07194308191537857,
0.33482643961906433,
... |
javascript/reference/global_objects/math/imul/index.md | JavaScript - Global Objects - Math - imul:
The `Math.imul()` static method returns the result of the C-like 32-bit multiplication of the two parameters.
Example:
console.log(Math.imul(3, 4));
// Expected output: 12
console.log(Math.imul(-5, 12));
// Expected output: -60
console.log(Math.imul(0xffffffff, 5));
// Ex... | [
-1.0348820686340332,
-0.4518907368183136,
-1.4153283834457397,
-0.25835898518562317,
-0.14749076962471008,
-0.6089528203010559,
0.09055458009243011,
1.3058960437774658,
0.04832470417022705,
0.20689430832862854,
-0.5473021864891052,
1.2679897546768188,
0.7419258952140808,
-0.218575105071067... |
javascript/reference/global_objects/math/imul/index.md | JavaScript - Global Objects - Math - imul - Syntax:
Example:
Math.imul(a, b) | [
-0.29550060629844666,
0.43202924728393555,
-0.6314749717712402,
-1.032706618309021,
-0.9730963110923767,
-1.5361900329589844,
-0.030495669692754745,
1.2336459159851074,
0.19036220014095306,
-0.5809777975082397,
-0.6789124011993408,
0.9444752931594849,
0.2047090232372284,
-0.141304597258567... |
javascript/reference/global_objects/math/imul/index.md | JavaScript - Global Objects - Math - imul - Syntax - Parameters:
- `a`: First number.
- `b`: Second number. | [
-0.05979405343532562,
-0.02492537349462509,
-0.7125469446182251,
-1.1741201877593994,
-0.8026538491249084,
-1.1007788181304932,
0.5944593548774719,
0.6824343204498291,
0.19913065433502197,
-0.2887061536312103,
-1.6504101753234863,
0.30199602246284485,
0.2644912898540497,
-0.136649534106254... |
javascript/reference/global_objects/math/imul/index.md | JavaScript - Global Objects - Math - imul - Syntax - Return value:
The result of the C-like 32-bit multiplication of the given arguments. | [
-0.5677022933959961,
0.03032105788588524,
-0.4852888286113739,
-0.22009721398353577,
-0.7028233408927917,
-0.9283989071846008,
0.5191982388496399,
1.0968875885009766,
0.03228875249624252,
-0.319180965423584,
-0.8882836699485779,
1.3509215116500854,
0.09293262660503387,
0.7040285468101501,
... |
javascript/reference/global_objects/math/imul/index.md | JavaScript - Global Objects - Math - imul - Description:
`Math.imul()` allows for 32-bit integer multiplication with C-like semantics. This feature is useful for projects like Emscripten.
Because `imul()` is a static method of `Math`, you always use it as `Math.imul()`, rather than as a method of a `Math` object you ... | [
-1.0496783256530762,
-0.15881109237670898,
-0.02801249362528324,
-0.05661725997924805,
0.01676359586417675,
-1.0174686908721924,
0.4632773697376251,
0.713081419467926,
-0.3270818591117859,
0.504217267036438,
-1.3699593544006348,
1.200395941734314,
0.007041851058602333,
-0.1441931128501892,... |
javascript/reference/global_objects/math/imul/index.md | JavaScript - Global Objects - Math - imul - Examples - Using Math.imul():
Example:
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 | [
-0.8789360523223877,
0.27809274196624756,
-0.766063392162323,
-0.4229108691215515,
-0.16205310821533203,
-1.3742852210998535,
0.39321255683898926,
0.5498892068862915,
-0.407500296831131,
-0.37982574105262756,
-1.1011755466461182,
0.8385113477706909,
-0.21184134483337402,
-0.547027528285980... |
javascript/reference/global_objects/math/fround/index.md | JavaScript - Global Objects - Math - fround:
The `Math.fround()` static method returns the nearest 32-bit single precision float representation of a number.
Example:
console.log(Math.fround(5.5));
// Expected output: 5.5
console.log(Math.fround(5.05));
// Expected output: 5.050000190734863
console.log(Math.fround(... | [
-1.0809131860733032,
-0.698634147644043,
-1.2184278964996338,
-0.32976430654525757,
-0.13617654144763947,
-0.9578413963317871,
-0.41928815841674805,
0.271593302488327,
0.040377870202064514,
0.41498863697052,
-1.1754056215286255,
1.041435718536377,
0.1683979481458664,
0.14352943003177643,
... |
javascript/reference/global_objects/math/fround/index.md | JavaScript - Global Objects - Math - fround - Syntax:
Example:
Math.fround(doubleFloat) | [
-1.0831968784332275,
0.4051918685436249,
-1.0918657779693604,
-0.844190239906311,
-0.8657604455947876,
-1.0926549434661865,
0.37301814556121826,
0.6855325102806091,
-0.41681423783302307,
-0.5941590070724487,
-0.7101723551750183,
0.7137149572372437,
-0.41375014185905457,
-0.1229633912444114... |
javascript/reference/global_objects/math/fround/index.md | JavaScript - Global Objects - Math - fround - Syntax - Parameters:
- `doubleFloat`: A number. | [
-1.141645073890686,
-0.2587030827999115,
-1.466899037361145,
-1.2433960437774658,
-0.5880484580993652,
-1.0665737390518188,
0.7201814651489258,
0.31090906262397766,
-0.5260682702064514,
-0.5403065085411072,
-1.2617303133010864,
0.08715428411960602,
-0.4192560315132141,
0.1445329487323761,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.