Skip to content

quentinadam/deno-decimal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

decimal

JSR CI

A library for working with arbitrary precision decimal numbers. Decimal numbers are represented by a mantissa (bigint) and an exponent (number). Instances of the Decimal class are immutable; calling functions (like abs, add, ceil, ...) on an instance will return a new Decimal instance with the result. Division may fail if the resulting number cannot be represented with a fixed number of decimals (like 1/3). Please check the documentation of the div function for more details.

Usage

import Decimal from '@quentinadam/decimal';

const a = Decimal.from('1.11111111111111111111');

const b = a.mul(2);

console.log(b.toString()); // prints 2.22222222222222222222

const c = a.add(b);

console.log(c.toString()); // prints 3.33333333333333333333

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published