jessealama / decimal128

JavaScript userland partial implementation of IEEE 754 Decimal128 decimal floating-point arithmetic
BSD 2-Clause "Simplified" License
19 stars 8 forks source link

Permit underscores in digit strings #8

Closed jessealama closed 1 year ago

jessealama commented 1 year ago

Underscores are sometimes used in numeric literals for improved comprehensibility. This should be supported since the intention of this package is to make it possible to work with human-readable numbers.

Support strings like the following:

A string should neither start with nor end with an underscore. There should never be consecutive underscores.

Do not emit the underscores when emitting a digit string representation of a Decimal128 value.