JSPM

  • Created
  • Published
  • Downloads 310
  • Score
    100M100P100Q79049F
  • License MIT

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

Package Exports

  • extra-number

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (extra-number) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.

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.
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


nodef

Browserified, minified version of this package is extra-number.min.