Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alisowski/decimal128

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alisowski/decimal128

Partial implementation of IEEE 754 Decimal128 decimal floating-point numbers

  • 16.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
0
Weekly downloads
 
Created
Source

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!

Keywords

FAQs

Package last updated on 14 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc