1.2.3 • Published 2 years ago

operations-with-fractional-numbers v1.2.3

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

Operations with fractional numbers

Function operationsWithFractionalNumbers for JavaScript.

operator - '*' | '-' | '+' | '/';
exp - number, Exponent (decimal logarithm of the base of the adjustment);
type - 'round' | 'floor' | 'ceil';
...args - number[];
operationsWithFractionalNumbers(operator, exp, type, ...args)

Installation

npm i operations-with-fractional-numbers

Usage

import operationsWithFractionalNumbers from 'operations-with-fractional-numbers';

console.log(operationsWithFractionalNumbers('-', -2, 'floor', 0.03, 0.01));
// 0.02

console.log(operationsWithFractionalNumbers('+', -2, 'floor', 0.09, 0.01));
// 0.1

console.log(operationsWithFractionalNumbers('*', -2, 'floor', 0.2, 3));
// 0.6

console.log(operationsWithFractionalNumbers('/', -2, 'floor', 3.4, 3));
// 1.13