Socket
Socket
Sign inDemoInstall

@types/big.js

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/big.js

TypeScript definitions for big.js


Version published
Weekly downloads
788K
decreased by-7%
Maintainers
1
Weekly downloads
 
Created

What is @types/big.js?

@types/big.js provides TypeScript type definitions for the big.js library, which is used for arbitrary-precision decimal arithmetic in JavaScript.

What are @types/big.js's main functionalities?

Basic Arithmetic Operations

This feature allows you to perform basic arithmetic operations such as addition, subtraction, multiplication, and division with arbitrary precision.

const Big = require('big.js');
const a = new Big(0.1);
const b = new Big(0.2);
const sum = a.plus(b); // 0.3
const difference = a.minus(b); // -0.1
const product = a.times(b); // 0.02
const quotient = a.div(b); // 0.5

Comparison Operations

This feature allows you to compare two Big numbers using methods like eq (equal), gt (greater than), and lt (less than).

const Big = require('big.js');
const a = new Big(0.1);
const b = new Big(0.2);
const isEqual = a.eq(b); // false
const isGreaterThan = a.gt(b); // false
const isLessThan = a.lt(b); // true

Rounding

This feature allows you to round a Big number to a specified number of decimal places.

const Big = require('big.js');
const a = new Big(1.2345);
const rounded = a.round(2); // 1.23

Conversion to String

This feature allows you to convert a Big number to a string representation.

const Big = require('big.js');
const a = new Big(1.2345);
const str = a.toString(); // '1.2345'

Other packages similar to @types/big.js

FAQs

Package last updated on 02 Sep 2021

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