super-mathjs
v1.0.8
Published
A library that brings recycled or new more understandable functions, understandable variables and much more!
Downloads
1
Readme
super-mathjs
A library to simply math
Installation:
yarn add super-mathjs :: npm i super-mathjs ...
Usage examples
Table
const { Table } = require('super-mathjs')
// If you want add:
new Table(numbers[]).add()
// Example:
new Table(15, 123, 43).add() // ==> 181
// If you want divide:
new Table(a:number, b:number).divide()
// Example:
new Table(83, 3).divide() // ==> 27.666666666666668
// If you want subtract:
new Table(a:number, b:number).subtract()
// Example:
new Table(83, 3).subtract() // ==> -5431
// If you want multiply:
new Table(numbers[]).multiply()
// Example:
new Table(2, 623, 91, 3).multiply() // ==> 340158
Functions
const app = require('super-mathjs')
// This will serve to find the radius of a circle
app.circleradio(radio:number)
// Example:
app.circleradio(12) // ==> 452.3893421169302
const app = require('super-mathjs')
// This function is used to compare two numbers, if they are equal they will return true, otherwise they will return false.
app.compare(a:number, b:number)
// Example:
app.compare(12, 12) // ==> true
app.compare(213, 212+1) // ==> true
app.compare(213, 132) // ==> false
app.compare(211+2, 212+1) // ==> true
const app = require('super-mathjs')
// This function is used to raise a number (base) with another number (exponent)
app.elevate(base:number, exponent:number)
// Example:
app.elevate(5, 2) // ==> 25
app.elevate(523, 223) // ==> Infinity
app.elevate(-523, 223) // ==> -Infinity
app.elevate(-2, +4) // ==> 16
const app = require('super-mathjs')
// With this function you can get the highest number.
app.max(numbers[])
// Example:
app.max(5, 2, 10, 14, 65, 13012, 1, 0) // ==> 13012
app.max(0, 0, 0, 0) // ==> 0
app.max(-16, -15, -14, -13) // ==> -13
const app = require('super-mathjs')
// With this function you can get the lowest number.
app.min(numbers[])
// Example:
app.min(5, 2, 10, 14, 65, 13012, 1, 0) // ==> 0
app.min(0, 0, 0, 0) // ==> 0
app.min(-16, -15, -14, -13) // ==> -16
const app = require('super-mathjs')
// With this function you can get the percentage of a number.
app.percentage(a: number, b: number)
// Example:
app.percentage(100, 30) // ==> 30
app.percentage(30, 100) // ==> 30
const app = require('super-mathjs')
// With this function you can get a random number with two bases, a minimum and a maximum.
app.random(a: number, b: number)
// Example:
app.random(1, 2) // ==> 2/1
app.random(2, 1) // ==> 2/1
const app = require('super-mathjs')
// With this function you will be able to evaluate numbers more professionally.
app.review(numbers[])
// Example:
app.review('12.7 cm to inch') // ==> 5 inch
app.review('sin(45 deg) ^ 2') // ==> 0.5
const app = require('super-mathjs')
// With this function you will be able to know the square root of a number.
app.root2(a:number)
// Example:
app.root2(64) // ==> 8
app.root2(-64) // ==> NaN
const app = require('super-mathjs')
// With this function you will be able to know the cube root of a number.
app.root3(a:number)
// Example:
app.root3(64) // ==> 4
app.root3(-64) // ==> -4
const app = require('super-mathjs')
// With this function you can round a number to the nearest next.
app.round(value:number)
// Example:
app.round(123.99) // ==> 124
const app = require('super-mathjs')
// With this function you can verify if a value is a number or not, if it is it will return true, if it is not it will return false
app.verify(value:number));
// Example:
app.verify(-1.1); // ==> true
app.verify('2a1'); // ==> true
app.verify('-1.1'); // ==> true
app.verify(parseInt('08')); // ==> true
app.verify(parseFloat('08')); // ==> true
app.verify([0, 1, 2]); // ==> true
app.verify(null); // ==> false
app.verify(''); // ==> false
app.verify('hi'); // ==> false
app.verify(['ax', 'bn', 'cd']); // ==> false
app.verify(function () {}); // ==> false
const app = require('super-mathjs')
// With this function you can return only the integer part of a given number.
app.whole(a: number)
// Example:
app.whole(123.99999999999) // ==> 123
app.whole(-1.5) // ==> -1
const app = require('super-mathjs')
// With this function you can round a given number up to the previous whole number.
app.wholea(a: number)
// Example:
app.wholea(123.99999999999) // ==> 123
app.wholea(-1.3) // ==> -2
const app = require('super-mathjs')
// With this function you can round a given number up to the next whole number.
app.wholes(a: number)
// Example:
app.wholes(0.1) // ==> 1
app.wholes(-1.5) // ==> -1
app.wholes(-0.9) // ==> -0
Variables
const app = require('super-mathjs')
app.root2x // ==> 1.4142135623730951 - √2.
app.euler // ==> 2.718281828459045 - The Euler rule.
app.pi // ==> 3.141592653589793 - It is the ratio of the length of the circumference of a circle to its diameter.
app.pinf // ==> Infinity - Represents positive infinity.
app.ninf // ==> -Infinity - Represents negative infinity.
app.maxnum // ==> 1.7976931348623157e+308 - Returns as many JavaScript as possible.
app.minnum // ==> 5e-324 - Returns the smallest possible number in JavaScript.
Changelog
v1.0.0
- Release.
v1.0.1
- poo function.