Baseline Widely available
Math.pow()
ã¯éçã¡ã½ããã§ãåºæ°ãã¹ãä¹ããå¤ãè¿ãã¾ãã
console.log(Math.pow(7, 3));
// Expected output: 343
console.log(Math.pow(4, 0.5));
// Expected output: 2
console.log(Math.pow(7, -2));
// Expected output: 0.02040816326530612
// (1/49)
console.log(Math.pow(-7, 0.5));
// Expected output: NaN
æ§æ 弿°
base
åºã¨ãªãæ°ã§ãã
exponent
base
ãç´¯ä¹ããææ°ã§ãã
base
ãè¡¨ãæ°å¤ã exponent
ä¹ããå¤ã以ä¸ã®ããããã®å ´åã¯ã NaN
ãè¿ãã¾ãã
exponent
ã NaN
ã§ãããbase
ã NaN
ã§ãexponent
ã 0
以å¤ã§ãããbase
ã ±1 ã§ã exponent
ã ±Infinity
ã§ãããbase < 0
ã§ã exponent
ãæ´æ°ã§ã¯ãªããMath.pow()
㯠**
æ¼ç®åã¨åçã§ããã Math.pow()
ã¯æ°å¤ã®ã¿ãåãå
¥ããã¨ããç¹ãç°ãªãã¾ãã
Math.pow(NaN, 0)
ï¼ããã³åçã® NaN ** 0
ï¼ã¯ã NaN
ãæ°å¦æ¼ç®ã§ä¼æããªãå¯ä¸ã®ã±ã¼ã¹ã§ããããã¯ããªãã©ã³ãã NaN
ã§ããã«ãããããã 1
ãè¿ãã¾ããããã«ã base
ã 1 ã§ exponent
ãç¡é大ï¼Â±Infinity ã¾ã㯠NaN
ï¼ã§ããå ´åã®åä½ã¯ãçµæã 1 ã¨ãªããã¨ãè¦å®ãã¦ãã IEEE 754 ã¨ã¯ç°ãªãã JavaScript ã§ã¯å
ã®åä½ã¨ã®å¾æ¹äºææ§ãç¶æããããã« NaN
ãè¿ãã¾ãã
pow()
㯠Math
ã®éçã¡ã½ãããªã®ã§ã常㫠Math.pow()
ã¨ãã¦ä½¿ç¨ããèªåã§ Math
ãªãã¸ã§ã¯ããçæãã¦ãã®ã¡ã½ããã¨ãã¦ä½¿ç¨ããªãã§ãã ããã (Math
ã«ã¯ã³ã³ã¹ãã©ã¯ã¿ã¼ãããã¾ãã)ã
// åç´
Math.pow(7, 2); // 49
Math.pow(7, 3); // 343
Math.pow(2, 10); // 1024
// å°æ°ã®ã¹ãä¹
Math.pow(4, 0.5); // 2 (4 ã®å¹³æ¹æ ¹)
Math.pow(8, 1 / 3); // 2 (8 ã®ç«æ¹æ ¹)
Math.pow(2, 0.5); // 1.4142135623730951 (2 ã®å¹³æ¹æ ¹)
Math.pow(2, 1 / 3); // 1.2599210498948732 (2 ã®ç«æ¹æ ¹)
// è² ã®æ°ã®ã¹ãä¹
Math.pow(7, -2); // 0.02040816326530612 (1/49)
Math.pow(8, -1 / 3); // 0.5
// è² ã®æ°ã®åº
Math.pow(-7, 2); // 49 (2 ä¹ã¯æ£ã®æ°)
Math.pow(-7, 3); // -343 (3 ä¹ã¯è² ã®æ°)
Math.pow(-7, 0.5); // NaN (è² ã®æ°ã«ã¯å®æ°ã®å¹³æ¹æ ¹ããªã)
// Due to "even" and "odd" roots laying close to each other,
// and limits in the floating number precision,
// negative bases with fractional exponents always return NaN,
// even when the mathematical result is real
Math.pow(-7, 1 / 3); // NaN
// Zero and infinity
Math.pow(0, 0); // 1 (ä»»æã®æ° ** ±0 is 1)
Math.pow(Infinity, 0.1); // Infinity (æ£ã®ææ°)
Math.pow(Infinity, -1); // 0 (è² ã®ææ°)
Math.pow(-Infinity, 1); // -Infinity (æ£ã®å¥æ°ã®æ´æ°ã®ææ°)
Math.pow(-Infinity, 1.5); // Infinity (æ£ã®ææ°)
Math.pow(-Infinity, -1); // -0 (è² ã®å¥æ°ã®æ´æ°ã®ææ°)
Math.pow(-Infinity, -1.5); // 0 (è² ã®ææ°)
Math.pow(0, 1); // 0 (æ£ã®ææ°)
Math.pow(0, -1); // Infinity (è² ã®ææ°)
Math.pow(-0, 1); // -0 (æ£ã®å¥æ°ã®æ´æ°ã®ææ°)
Math.pow(-0, 1.5); // 0 (æ£ã®ææ°)
Math.pow(-0, -1); // -Infinity (è² ã®å¥æ°ã®æ´æ°ã®ææ°)
Math.pow(-0, -1.5); // Infinity (è² ã®ææ°)
Math.pow(0.9, Infinity); // 0
Math.pow(1, Infinity); // NaN
Math.pow(1.1, Infinity); // Infinity
Math.pow(0.9, -Infinity); // Infinity
Math.pow(1, -Infinity); // NaN
Math.pow(1.1, -Infinity); // 0
// NaN: only Math.pow(NaN, 0) does not result in NaN
Math.pow(NaN, 0); // 1
Math.pow(NaN, 1); // NaN
Math.pow(1, NaN); // NaN
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ
å ±
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4