Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rc-component/mini-decimal

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rc-component/mini-decimal

Lite lib to only support decimal add calculation

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
769K
decreased by-15.53%
Maintainers
4
Weekly downloads
 
Created

What is @rc-component/mini-decimal?

@rc-component/mini-decimal is a lightweight JavaScript library designed to handle decimal calculations with high precision. It is particularly useful for financial applications or any other use case where precise decimal arithmetic is required.

What are @rc-component/mini-decimal's main functionalities?

Basic Arithmetic Operations

This feature allows you to perform basic arithmetic operations like addition, subtraction, multiplication, and division with high precision.

const MiniDecimal = require('@rc-component/mini-decimal');

const a = new MiniDecimal('0.1');
const b = new MiniDecimal('0.2');
const sum = a.add(b);
console.log(sum.toString()); // '0.3'

Comparison Operations

This feature allows you to compare two decimal numbers to check if one is less than, greater than, or equal to the other.

const MiniDecimal = require('@rc-component/mini-decimal');

const a = new MiniDecimal('0.1');
const b = new MiniDecimal('0.2');
console.log(a.lessThan(b)); // true
console.log(a.equals(b)); // false

Rounding

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

const MiniDecimal = require('@rc-component/mini-decimal');

const a = new MiniDecimal('0.12345');
const rounded = a.round(2);
console.log(rounded.toString()); // '0.12'

Other packages similar to @rc-component/mini-decimal

Keywords

FAQs

Package last updated on 01 Dec 2022

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