Skip to content

hazae41/fixed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fixed

Fixed-point numbers for the web

npm install @hazae41/fixed

📦 NPM

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies

Usage

const x0 = new Fixed(123n, 0)   // [123n;0]
const x18 = x0.move(18)         // [123000000000000000000n;18]

const y18 = new Fixed(1n, 18)   // [000000000000000000001n;18]
const z18 = x18.add(y18)        // [123000000000000000001n;18]

const str = z18.toString()      // "123.000000000000000001"
const num = Number(str)         // 123
const int = BigInt(num)         // 123n

About

Fixed-point numbers for the web

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Sponsor this project

Packages

 
 
 

Contributors