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 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsbignumber

v1.3.0

Published

Computing numbers with strings for javascript.

Downloads

36

Readme

Github

A JavaScript library for High Precision Computation.

Build Status codecov

install

$ npm install jsbignumber -S

Node.js

const jsbignumber = require('jsbignumber').default
console.log(jsbignumber(0.1, 0.2))

ES6 Module:

import jsbignumber from "jsbignumber"
console.log(jsbignumber.add(0.1, 0.2))

Browser

<script src="./jsbignumber.min.js"></script>
<script>
  console.log(jsbignumber(0.2, 0.1))
</script>

4 simple API

| api | definition | | ---------- | --- | | add | (num1: string | number, num2: string | number): string | | divide, div | (num1: string | number, num2: string | number, len: number = 50) : string | | multply, mul | (num1: string | number, num2: string | number): string | | substact, sub | (num1: string | number, num2: string | number): string | | toFixed | (nums: string | number, decimal: string | number): string |

Test

npm run test

Example

import jsbignumber from "jsbignumber"
const { add, substact, divide, multply, toFixed } = jsbignumber

// add 
const addValue = add('0.00000000000297623885327264628872813944566975202437690710653591748231030925179641495339618475769115114527914606543143194147848430495597', '120677689870942459137299176289089761143754326820862009921425274349213001568104474801947554427316998849125038885919')
console.log(addValue) // '120677689870942459137299176289089761143754326820862009921425274349213001568104474801947554427316998849125038885919.00000000000297623885327264628872813944566975202437690710653591748231030925179641495339618475769115114527914606543143194147848430495597'

// multply
const multplyValue = multply('-0.070884', '0.0000000000000000002106611401')
console.log(multplyValue) // -0.0000000000000000000149325042548484

// substact
const substactValue = substact('-2471514788.354942554630483008', '-0.0000000055765369280717362958649740')
console.log(substactValue) // '-2471514788.354942549053946079928263704135026'

// toFixed
const substactValue = toFixed('-2471514788.354942554630483008', '5')
console.log(substactValue) // '-2471514788.35494'

// divide
const divideValue = divide('50', '2.901')
console.log(divideValue) // 17.23543605653223026542571527059634608755601516718373

const divideValue2 = divide('50', '2.901', 20)
console.log(divideValue2) // 17.235436056532230265425715270596

const divideValue3 = divide('50', '2.901', 100)
console.log(divideValue3) // 17.2354360565322302654257152705963460875560151671837297483626335746294381247845570492933471216821785591

const divideValue4 = divide(10, 4)
console.log(divideValue4) // 2.5