Skip to content
This repository was archived by the owner on Oct 10, 2019. It is now read-only.
This repository was archived by the owner on Oct 10, 2019. It is now read-only.

Axel Rauschmayer's alternative deserves serious consideration #36

@allenwb

Description

@allenwb

Axel Rauschmayer has an alternative proposal for integrating arbitrary precision integers into ES. It provides similar functionality to the present Integers proposal, makes different trade-off, and in someways it is a simpler and less intrusive extension to the current language. It seems like a plausible alternative to the current proposal.

Some details of Axel's proposal have been discussed under issue #30. But I don't see a comprehensive evaluation/analysis of Axel's proposal as an alternative to the current proposal. I believe that such an analysis/caparison is something that the Integer champions should undertake for presentation to TC39.


A Further Simplification

Axel's basic premise is that "Number is a supertype of Int and Double: Number = Int ∪ Double". Instead of introducing new Number subtypes into the language, an further simplification would be to eliminate the supertype/subtype concept and simply expand the value domain of the ECMAScript number type.

Instead of defining number as "The Number type has exactly 18437736874454810627 (that is, 264-253+3) values, representing the double-precision 64-bit format IEEE 754-2008 values..." we could define it something like:

  • The Number type consists of all integer values and the 18437736874454810627 IEEE-754-2008 double-precision 64-bit values. The integer values are called "precise numbers" and the IEEE-754 values are called "imprecise numbers". Note that a precise number such as 1024 and its IEEE equivalent 1024.0 are distinct values within the single Number type.

This simplified definition, can then be mapped on Axel's proposal with "precise number" replacing the Int subtype and "imprecise number" replacing the Double subtype. Other then terminology and perhaps some API simplification, Axel's proposal could be largely unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions