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

calculate-asmd

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calculate-asmd

calculate/arithmetic

  • 2.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

calculate-asmd

JavaScript Arithmetic

Production

0.2 + 0.4 = 0.6 ?

Usage

Install

yarn add calculate-asmd

or

npm install calculate-asmd --save

Demo
  import { add, sub, mul, div } from 'calculate-asmd'

  const addNum = add(0.2, 0.4);
  console.log("add(0.2, 0.4): ", addNum); //add(0.2, 0.4):  0.6
  const addNegative = add(0.2, -0.4);
  console.log("add(0.2, -0.4): ", addNegative); //add(0.2, -0.4):  -0.2

  const subNum = sub(0.2, 0.4);
  console.log("sub(0.2, 0.4): ", subNum);  //sub(0.2, 0.4):  -0.2
  const subNegative = sub(0.2, -0.4);
  console.log("sub(0.2, -0.4): ", subNegative); //sub(0.2, -0.4):  0.6

  const mulNum = mul(0.57, 100);
  console.log("mul(0.57, 100): ", mulNum); //mul(0.57, 100):  57
  const mulNegativ = mul(-0.57, 100);
  console.log("mul(-0.57, 100): ", mulNegativ); //mul(-0.57, 100):  -57

  const divNum = div(0.57, 100);
  console.log("div(0.57, 100): ", divNum); //div(0.57, 100):  0.0057
  const divNegative = div(-0.57, 100);
  console.log("div(-0.57, 100): ", divNegative);  //div(-0.57, 100):  -0.0057

Expand
  import { scaleNum } from 'calculate-asmd'

  scaleNum(0.57, 2)   // 57
  scaleNum(0.57, -2) // 0.0057
  scaleNum(0.57, 0) // 0.57

asmd(arg1,arg2)

arg1: Default 0, type number/string

arg2: Default 0, type number/string

Tips: If arg is NaN, it will return NaN directly. If arg is null/undefined/"", arg will be treated as 0

div(arg1,arg2)

arg2: If arg2 is 0, it will return Infinity.

Test

Test Document

Keywords

FAQs

Package last updated on 17 Aug 2019

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