npm.io
1.1.0 • Published 3 years ago

math-basics

Licence
ISC
Version
1.1.0
Deps
1
Size
14 kB
Vulns
0
Weekly
0

MathBasics v1.0.9

MathBasics is a package of math that has functions like add, substract, multiplication, etc.

Install

npm install math-basics@latest
yarn add math-basics@latest
pnpm add math-basics@latest

Examples

CJS Example:
const math = require('math-basics');
console.log(math.add(3, 2)); // Output: 5
console.log(math.sub(6, 3)); // Output: 3
console.log(math.mult(7, 6)) // Output: 42
console.log(math.div(27, 9)) // Output: 3
console.log(math.pow(3, 2)) // Output: 9
console.log(math.root(4, 256)) // Output: 4
console.log(math.randomArray([ 'one', 'two', 'three' ])) // Output: 'one'
console.log(math.round(3.5)) // Output: 4
console.log(math.fround(10.3)) // Output: 10.300000190734863
console.log(math.factorial(3)) // Ouput: 6
console.log(math.randomNumber()) // Output: 47
console.log(math.average(9.1, 10, 27, 8.9, 90.5, 3.4)) // Output: 24.81666666...
ESM Example:
import math from 'math-basics';
console.log(math.add(3, 2)); // Output: 5
console.log(math.sub(6, 3)); // Output: 3
console.log(math.mult(7, 6)) // Output: 42
console.log(math.div(27, 9)) // Output: 3
console.log(math.pow(3, 2)) // Output: 9
console.log(math.root(4, 256)) // Output: 4
console.log(math.randomArray([ 'one', 'two', 'three' ])) // Output: 'one'
console.log(math.round(3.5)) // Output: 4
console.log(math.fround(10.3)) // Output: 10.300000190734863
console.log(math.factorial(3)) // Ouput: 6
console.log(math.randomNumber()) // Output: 47
console.log(math.average(9.1, 10, 27, 8.9, 90.5, 3.4)) // Output: 24.81666666...

Keywords