npm.io
3.0.51 • Published 5 years ago

@talk2rajeev/simple-calculator

Licence
MIT
Version
3.0.51
Deps
0
Size
4 kB
Vulns
0
Weekly
0

simple-calculator

GitHub issues

install

npm i @talk2rajeev/simple-calculator

How to Use

addition
import module from '@talk2rajeev/simple-calculator'
addition

addition takes multiple argument, all argument will be added together.

const { add, substract, multiply, divide } = module;

add(1,2) //Output: 3
add(1,2,3,4) //Output: 10
substract

substract takes multiple argument, all argument (except 1st) will be substrated from 1st one

substract(4,2) //output: 2

substract(10,2,1) //output: 7
Explanation: 10 -2 -1 = 7
Multiplication

multiply takes multiple argument, all argument will be multiplied together.

multiply(3,2) //output: 6

multiply(10,2,5) //output: 100
Explanation: 10 * 2 * 5 = 100
Division

division takes only 2 arguments

divide(8,2) //output: 4
divide(10,2) //output: 100
Power
power(2)(3) //output: 8
power(3)(4) //output: 81
Square Root
squareRoot(2); //Output: 1.4142135623730951
squareRoot(4); //Output: 2
squareRoot(9); //Output: 3
Cube Root
cubeRoot(3); //Output: 1.4422495703074083
cubeRoot(8); //Output: 2
cubeRoot(27); //Output: 3

Keywords