1.0.2 • Published 3 years ago

@dmmdjs/dmath v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Dmath

Table of Contents

About

Dmath is a tool that maximizes precisions in calculating number-like values.

  • Zero Dependencies
  • Detailed JsDoc
  • Easy to Use
  • Near Optimized

Installation

Ensure you have the correct version of Node.js and npm installed:

Recommended:

  • Node: v16.4.0
  • npm: v7.18.1

Minimum:

  • Node: v14.17.1
  • npm: v7.18.1

Open a terminal with Node.js installed

npm i @dmmdjs/dmath@latest --save

Usage

Importing:

const dmath = require("@dmmdjs/dmath");

Basic Usage:

console.log(dmath.add(5, "10")); // "15"

console.log(dmath.minus(5, "10")); // "-5"

console.log(dmath.abs(-5)); // "5"

console.log(dmath.neg("5")); // "-5"

Full Examples:

function addFive(number) {
    return parseFloat(dmath.add(number, 5));
};

console.log(addFive(6)); // 11
let userBalance = 222.2;

function payCheck(amount) {
    console.log(userBalance + amount); // 324.79999999999995
    console.log(dmath.add(userBalance, amount)); // "324.8"
    userBalance = dmath.add(userBalance, amount);
};

payCheck(102.6);
console.log(1 / 123456); // 0.000008100051840331778
console.log(dmath.divide(1, 123456)); // "0.0000081000518403"
console.log(dmath.divide(1, 123456, 10000)); // "0.0000081000...4375324002"

Alternative Options

Credits & Contact

Credits:

  • iiPython
    • Bug finding & supporting

Contact Information

Notice

  • README Format: @dmmdjs README v3
  • License: MIT

Last Updated: Sep 18, 2021