extra-number.min

A number is a mathematical object used to count, measure, and label.

Usage no npm install needed!

<script type="module">
  import extraNumberMin from 'https://cdn.skypack.dev/extra-number.min';
</script>

README

A number is a mathematical object used to count, measure, and label.

Number type is double-precision 64-bit binary format IEEE 754 value. Includes notation conversion functions, as well as utilities.

This is browserified, minified version of extra-number.
It is exported as global variable number.
CDN: unpkg, jsDelivr.

const number = require('extra-number');

number.isPrime(53);
// true

number.properDivisors(6);
// [1, 2, 3]

number.round(9.1357, 0.05);
// 9.15

number.significantDigits(0.0034);
// 2

number.fromRoman('DCXLIX');
// 649

number.toScientific(695700000);
// '6.957×10⁸' (radius of Sun in m)

reference

Method Action
is Checks if value is a number.
isPrime Checks if a number is prime.
compare Compares 2 numbers.
round Rounds number to specific precision.
ceil Rounds up number to specific precision.
floor Rounds down number to specific precision.
lerp Gives a number based on weight, within given range.
clamp Limits a number within given range.
map Converts a number from one range to another.
aliquotSum Gives sum of all proper divisors of n.
properDivisors Gives a list of numbers that n is divisible by, except itself.
significantDigits Counts the number of significant digits of a number.
fromWords Converts number in words to number.
fromRoman Converts roman numerals to number.
toRoman Converts number to roman numerals.
fromScientific Converts scientific notation to number.
toScientific Converts number to scientific notation.

help needed

  • fromWords with plural
  • fromRoman with decimal
  • toWords(opt=ordinal/cardinal)
  • toOrdinal
  • number.compare(pre)
  • math.log(n,base)
  • math.factorial(n)
  • math.perm(n, k)
  • math.dist()
  • math.degrees()
  • math.radians()
  • math.tau
  • math: separate statistics?


nodef