Baseline Widely available
BigInt.asIntN
ã¯éçã¡ã½ããã§ã BigInt å¤ã符å·ä»ãæ´æ°å¤ã«ä¸¸ãããã®å¤ãè¿ãã¾ãã
const I64_CEIL = 2n ** 63n;
console.log(BigInt.asIntN(64, I64_CEIL - 1n));
// 9223372036854775807n (2n ** 64n - 1n, the maximum non-wrapping value)
console.log(BigInt.asIntN(64, I64_CEIL));
// -9223372036854775808n (wraps to min value)
console.log(BigInt.asIntN(64, I64_CEIL + 1n));
// -9223372036854775807n (min value + 1n)
console.log(BigInt.asIntN(64, I64_CEIL * 2n));
// 0n (wrapped around to zero)
console.log(BigInt.asIntN(64, -I64_CEIL * -42n));
// 0n (also wraps on negative multiples)
æ§æ
BigInt.asIntN(bits, bigint);
弿°
bits
æ´æ°ã®å¤§ããã®ããã«å©ç¨ã§ãããããã®æ°ã§ãã
bigint
æå®ããããããæ°ã«ä¸¸ãã BigInt å¤ã§ãã
bigint
ã 2^bits
ã§å²ã£ãå°ä½ã®å¤ã®ç¬¦å·ä»ãæ´æ°ã§ãã
BigInt.asIntN()
ã¡ã½ããã¯ã 64 ãããã®æ°å¤ã®ç¯å²ã«åããã®ã«ä¾¿å©ã§ãã
const max = 2n ** (64n - 1n) - 1n;
BigInt.asIntN(64, max);
// ⪠9223372036854775807n
BigInt.asIntN(64, max + 1n);
// ⪠-9223372036854775808n
// ãªã¼ãã¼ããã¼ããã®ã§è² æ°ã«ãªã
仿§æ¸ ãã©ã¦ã¶ã¼ã®äºææ§ é¢é£æ
å ±
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