npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bigfixed

v0.0.2

Published

big fixed point number base on BigInt

Downloads

3

Readme

BigFixed

A pure javascript big fixed point number library base on BigInt.

Install

npm install bigfixed

Description

BigFixed range: ( -Inf, -(2**(-64)) ] & 0 & [ 2**(-64), +Inf )

BigFixed struct: signed BigInt <N bits integer part . 64 bits fraction part>

NOTE: this lib is calculate by binary but not decimal number,

BigFixed(0.1).add(0.2).toString() === "0.30000000000000004"

Compare

Compare of big number lib
test number: 3838.261003615915, 
test count: 100000

Execution time in nano seconds(1e-9s):
Operate   BigFixed  BigNumber Big       Decimal   
new       580       750       410       690       
add       90        210       240       270       
sub       120       300       490       500       
mul       210       420       1220      710       
div       800       3760      6720      3360      
pow       380       1360      3950      2330      
str       530       220       410       250        

Usage

  • BigFixed own prototype names
[
  'constructor', 'clone',     'isZero',
  'isNegative',  'isInteger', 'eq',
  'lt',          'lte',       'gt',
  'gte',         'neg',       'abs',
  'add',         'sub',       'mul',
  'div',         'mod',       'pow',
  'not',         'and',       'or',
  'xor',         'lShift',    'rShift',
  'toInteger',   'toNumber',  'toJSON',
  'toString'
]
  • Create
const BigFixed = require('bigfixed');

console.log(BigFixed(-3.14));
// BigFixed { fixed: -57922776391447994368n }

console.log(new BigFixed(-3.14));
// BigFixed { fixed: -57922776391447994368n }

console.log(BigFixed(-3.14).toString());
// -3.14000000000000012

console.log(BigFixed(-3.14).toNumber());
// -3.14

console.log(BigFixed(-3.14).toString(2));
// -11.001000111101011100001010001111010111000010100011111

console.log(BigFixed(-3.14).toString(8));
// -3.10753412172702437

console.log(BigFixed(-3.14).toString(16));
// -3.23d70a3d70a3e

console.log(BigFixed(' -3.14 ').toString());
// -3.14

console.log(BigFixed('0b0111').toString());
// 7

console.log(BigFixed('0xff').toString());
// 255

console.log(BigFixed(true).toString());
// 1

console.log(BigFixed(false).toString());
// 0
  • Arithmetic
console.log(BigFixed(125.25).add(100).toString());
// 225.25
console.log(BigFixed(Number.MAX_SAFE_INTEGER).add(Number.MAX_SAFE_INTEGER).toString());
// 18014398509481982

console.log(BigFixed(125.25).sub(0.125).toString());
// 125.125
console.log(BigFixed(Number.MAX_SAFE_INTEGER).sub(Number.MAX_SAFE_INTEGER).toString());
// 0

console.log(BigFixed(125.25).mul(100).toString());
// 12525
console.log(BigFixed(Number.MAX_SAFE_INTEGER).mul(Number.MAX_SAFE_INTEGER).toString());
// 81129638414606663681390495662081

console.log(BigFixed(125.25).div(8).toString());
// 15.65625
console.log(BigFixed(2).div(3).toString());
// 0.6666666666666666

console.log(BigFixed(8).mod(3).toString());
// 2
console.log(BigFixed(0.8).mod(0.3).toString());
// 0.20000000000000007

console.log(BigFixed(5).pow(2).toString());
// 25
console.log(BigFixed(3.14).pow(100).toString());
// 49313384166056347098523752010452971971940876154701.029803568081556285
  • Logical
console.log('Logical');

console.log(BigFixed(0x0f).not().toString(16));
// -f.0000000000000001

console.log(BigFixed(0x0f).not().not().toString(16));
// f

console.log(BigFixed(0x0f).and(0xf0).toString(16));
// 0

console.log(BigFixed(0x0f).or(0xf0).toString(16));
// ff

console.log(BigFixed(0x0f).xor(0xf0).toString(16));
// ff

console.log(BigFixed(0x0f).lShift(1).toString(16));
// 1e

console.log(BigFixed(0x0f).rShift(1).toString(16));
// 7.8
  • To integer

same as Math.round, Math.ceil, Math.floor, default BigFixed.ROUND

console.log(BigFixed(3.51).toInteger(BigFixed.CEIL).toString());
// 4
console.log(BigFixed(3.51).toInteger().toString());
// 4
console.log(BigFixed(3.51).toInteger(BigFixed.FLOOR).toString());
// 3

console.log(BigFixed(3.49).toInteger(BigFixed.CEIL).toString());
// 4
console.log(BigFixed(3.49).toInteger().toString());
// 3
console.log(BigFixed(3.49).toInteger(BigFixed.FLOOR).toString());
// 3

Test

jest