(ES6) ES6 (2016)

BigInt (BG00)

Feature Floating-Point (Number) BigInt
Precision Limited Arbitrary (unlimited)
Type Number BigInt
Range Wide, includes fractions and special values Integers only
Decimal Issues Potential rounding errors due to binary representation No decimal issues
Usage General number representation Large integers, precise integer arithmetic
Advantage
Large integer arithmetic Limited by Number.MAX_SAFE_INTEGER Handles very large integers without precision loss
Decimal arithmetic Handles decimals and fractions No rounding errors (but only for integers)
Compatibility with math functions Works seamlessly with math functions Not compatible with many math functions
Memory usage Smaller memory footprint for smaller values Larger memory footprint



   1:  console.log('Number.MAX_SAFE_INTEGER:', Number.MAX_SAFE_INTEGER); // 9007199254740991
   2:  console.log('Number.MIN_SAFE_INTEGER:', Number.MIN_SAFE_INTEGER); // -9007199254740991
   3:  console.log('Number.MAX_VALUE:', Number.MAX_VALUE); // 1.7976931348623157e+308
   4:  console.log('Number.MIN_VALUE:', Number.MIN_VALUE); // 5e-324



Number type:

Number.MAX_SAFE_INTEGER: 9007199254740991
Number.MIN_SAFE_INTEGER: -9007199254740991
Number.MAX_VALUE: 1.7976931348623157e+308
Number.MIN_VALUE: 5e-324





BigInt context:






ES6 context:



Comments ( )
Link to this page: http://www.vb-net.com/JavascriptES6/BG00.htm
< THANKS ME>