Overview

Arbitrary-precision integers (or “bignums”) are a great compromise between correctness and performance. Moreover, they really suffer without built-in syntax. This strawman proposes adding a new primitive type of arbitrary-precision integers, along with syntactic support for bignums with new behavior added to the primitive operations.

Bignums

This strawman adds a new kind of primitive type (i.e., a numeric type which is not an object) representing arbitrary integers.

Literals

Bignum literals can be represented as integer literals with the suffix i.

TODO: bikeshed the suffix character

Operations

typeof

The result of typeof applied to a bignum is “integer”.

Arithmetic

TODO: determine promotion rules for intermixing bignums and numbers.

Relational

The result of === and == on bignums is the result of comparing their integer values (not, for example, comparing pointer equality).

TODO: determine promotion rules for intermixing binums and numbers.

ToString

TODO: spec

ToNumber

TODO: spec

Pragma

The pragma

use bignums;

indicates that within the block or script in which the pragma appears, all integer literals are to be interpreted as bignum literals rather than number literals.

 
strawman/bignums.txt · Last modified: 2010/09/27 22:02 by dherman
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki