15.0.0 • Published 5 days ago

decimal128 v15.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 days ago

decimal128.js—A userland approximation to IEEE 754 Decimal128 in JavaScript

This library is a prototype for the decimal proposal. There should be no observable difference between what this library does and what the proposal is supposed to do. If you find a mismatch, please file an issue in this repo.

Operations

  • absolute value (abs)
  • addition (add)
  • subtraction (subtract)
  • multiplication (multiply)
  • division (divide)
  • remainder (remainder)
  • rounding (round)
  • toString emitting both decimal and exponential syntax (default is decimal)

Comparisons

  • equality (equals) to compare for mathematical equality
  • less than (lessThan) to compare mathematical order
  • compare for comparing Decimals as digit strings (not mathematical order; e.g. 1.2 < 1.20)

Implementation

This package is written in TypeScript. Unit tests are in Jest. There are no other external dependencies.

Data model

This package aims to reproduce the IEEE 754 Decimal128 128-bit decimal floating-point numbers in JavaScript. See the decimal proposal. These decimal (not binary!) numbers take up 128 bits per number. This format allows for an exact representation of decimal numbers with 34 (decimal) significant digits and an exponent between -6143 and 6144. That's a vast amount of range and precision!

14.1.0

5 days ago

15.0.0

5 days ago

13.0.0

18 days ago

12.3.0

26 days ago

12.2.0

27 days ago

12.0.0

1 month ago

12.1.0

1 month ago

11.2.0

1 month ago

11.0.0

2 months ago

10.2.1

2 months ago

10.2.0

2 months ago

10.1.0

3 months ago

10.0.0

3 months ago

9.1.0

4 months ago

9.0.0

4 months ago

8.0.0

4 months ago

7.1.0

5 months ago

7.0.0

5 months ago

7.0.1

5 months ago

6.2.0

5 months ago

6.1.0

5 months ago

6.0.0

5 months ago

5.3.0

7 months ago

5.1.0

7 months ago

5.0.0

8 months ago

4.2.2

10 months ago

4.1.0

10 months ago

4.3.0

10 months ago

4.2.1

10 months ago

4.2.0

10 months ago

4.0.0

10 months ago

3.0.0

11 months ago

2.0.2

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.9.0

12 months ago

1.8.0

12 months ago

1.7.0

12 months ago

1.6.0

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago