{"id":21831371,"url":"https://github.com/nodef/extra-number","last_synced_at":"2025-07-20T15:34:15.629Z","repository":{"id":40005247,"uuid":"133202640","full_name":"nodef/extra-number","owner":"nodef","description":"A number is a mathematical object used to count, measure, and label.","archived":false,"fork":false,"pushed_at":"2025-04-08T16:40:56.000Z","size":567,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T23:40:03.364Z","etag":null,"topics":["aliquot-sum","arithmetic-mean","binomial","ceil","ceil-div","compare","constrain","cubic-mean","degrees","extra","factorial","floor","floor-div","from-roman-numerals","gcd","geometric-mean","harmonic-mean","is","is-pow","number"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/extra-number","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-13T03:33:03.000Z","updated_at":"2025-04-08T16:40:56.000Z","dependencies_parsed_at":"2024-06-21T19:06:42.548Z","dependency_job_id":"2c80f032-0bae-41c9-a09c-84ac284b449c","html_url":"https://github.com/nodef/extra-number","commit_stats":{"total_commits":142,"total_committers":1,"mean_commits":142.0,"dds":0.0,"last_synced_commit":"b5a868c19454d7f6418b443e82ee92c1e5d97a9d"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodef%2Fextra-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodef","download_url":"https://codeload.github.com/nodef/extra-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647254,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliquot-sum","arithmetic-mean","binomial","ceil","ceil-div","compare","constrain","cubic-mean","degrees","extra","factorial","floor","floor-div","from-roman-numerals","gcd","geometric-mean","harmonic-mean","is","is-pow","number"],"created_at":"2024-11-27T19:10:02.576Z","updated_at":"2025-04-14T07:07:34.480Z","avatar_url":"https://github.com/nodef.png","language":"TypeScript","readme":"A **number** is a mathematical object used to count, measure, and label.\u003cbr\u003e\n📦 [Node.js](https://www.npmjs.com/package/extra-number),\n🌐 [Web](https://www.npmjs.com/package/extra-number.web),\n📜 [Files](https://unpkg.com/extra-number/),\n📰 [Docs](https://nodef.github.io/extra-number/).\n📘 [Wiki](https://github.com/nodef/extra-number/wiki/).\n\nIn JavaScript, [Number] type is double-precision 64-bit binary format IEEE 754\nvalue. This package includes common number functions related to querying\n**about** numbers, **comparing** numbers, **rounding** numbers, performing\n**rounded division**, performing **modulo** operations, **controlling range** of\nnumbers, performing **arithmetic** operations, obtaining **divisors** of a\nnumber (and related operations), getting the number of possible **arrangements**\nof a set of objects, performing **geometry**-related calculations, performing\nbasic **statistical** analysis, and finding various **statistical means**.\n\nThis package is available in *Node.js* and *Web* formats. To use it on the web,\nsimply use the `extra_number` global variable after loading with a `\u003cscript\u003e`\ntag from the [jsDelivr CDN].\n\n\u003e Stability: [Experimental](https://www.youtube.com/watch?v=L1j93RnIxEo).\n\n[Number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number\n[jsDelivr CDN]: https://cdn.jsdelivr.net/npm/extra-number.web/index.js\n\n\u003cbr\u003e\n\n```javascript\nconst xnumber = require('extra-number');\n// import * as xnumber from \"extra-number\";\n// import * as xnumber from \"https://unpkg.com/extra-number/index.mjs\"; (deno)\n\nxnumber.isPrime(53);\n// → true\n\nxnumber.properDivisors(6);\n// → [1, 2, 3]\n\nxnumber.round(9.1357, 0.05);\n// → 9.15\n\nxnumber.significantDigits(0.0034);\n// → 2\n\n// TOFIX:\n// xnumber.fromRoman('DCXLIX');\n// → 649\n\n// xnumber.toScientific(695700000);\n// → '6.957×10⁸' (radius of Sun in m)\n```\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## Index\n\n| Property | Description |\n|  ----  |  ----  |\n| [is] | Check if value is a number. |\n| [significantDigits] | Count the number of significant digits in a number. |\n|  |  |\n| [compare] | Compare two numbers. |\n|  |  |\n| [floor] | Round down a number to specific precision. |\n| [ceil] | Round up a number to specific precision. |\n| [round] | Round a number to specific precision. |\n|  |  |\n| [floorDiv] | Perform floor-divison of two numbers. |\n| [ceilDiv] | Perform ceiling-divison of two numbers. |\n| [roundDiv] | Perform rounded-divison of two numbers. |\n|  |  |\n| [rem] | Find the remainder of x/y with sign of x (truncated division). |\n| [mod] | Find the remainder of x/y with sign of y (floored division). |\n| [modp] | Find the remainder of x/y with +ve sign (euclidean division). |\n|  |  |\n| [constrain] | Constrain a number within a minimum and a maximum value. |\n| [normalize] | Normalize a number from its current range into a value between 0 and 1. |\n| [remap] | Re-map a number from one range to another. |\n| [lerp] | Linearly interpolate a number between two numbers. |\n|  |  |\n| [isPow] | Check if a number is a power-of-n. |\n| [prevPow] | Find largest power-of-n less than or equal to given number. |\n| [nextPow] | Find smallest power-of-n greater than or equal to given number. |\n|  |  |\n| [root] | Find the nth root of a number (ⁿ√). |\n| [log] | Find the logarithm of a number with a given base. |\n|  |  |\n| [properDivisors] | List all divisors of a number, except itself. |\n| [aliquotSum] | Sum all proper divisors of a number. |\n| [minPrimeFactor] | Find the least prime number which divides a number. |\n| [maxPrimeFactor] | Find the greatest prime number which divides a number. |\n| [primeFactors] | Find the prime factors of a number. |\n| [primeExponentials] | Find the prime factors and respective exponents of a number. |\n| [isPrime] | Check if number is prime. |\n| [gcd] | Find the greatest common divisor of numbers. |\n| [lcm] | Find the least common multiple of numbers. |\n|  |  |\n| [factorial] | Find the factorial of a number. |\n| [binomial] | Find the number of ways to choose k elements from a set of n elements. |\n| [multinomial] | Find the number of ways to put n objects in m bins (n=sum(kᵢ)). |\n|  |  |\n| [degrees] | Convert radians to degrees. |\n| [radians] | Convert degrees to radians. |\n|  |  |\n| [sum] | Find the sum of numbers (Σ). |\n| [product] | Find the product of numbers (∏). |\n| [median] | Find the value separating the higher and lower halves of numbers. |\n| [modes] | Find the values that appear most often. |\n| [range] | Find the smallest and largest values. |\n| [variance] | Find the mean of squared deviation of numbers from its mean. |\n|  |  |\n| [arithmeticMean] | Find the average of numbers. |\n| [geometricMean] | Find the geometric mean of numbers. |\n| [harmonicMean] | Find the harmonic mean of numbers. |\n| [quadriaticMean] | Find the quadriatic mean of numbers. |\n| [cubicMean] | Find the cubic mean of numbers. |\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n## References\n\n- [Javascript reference: MDN Web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/)\n- [Processing reference](https://processing.org/reference/constrain_.html)\n- [Fastest way to compute the greatest common divisor](https://lemire.me/blog/2013/12/26/fastest-way-to-compute-the-greatest-common-divisor/)\n- [Calculating median - javascript](https://stackoverflow.com/questions/45309447/calculating-median-javascript)\n- [What is the fastest way to count the number of significant digits of a number?](https://stackoverflow.com/questions/22884720/what-is-the-fastest-way-to-count-the-number-of-significant-digits-of-a-number)\n- [alawatthe/MathLib](https://github.com/alawatthe/MathLib/blob/master/src/Functn/functions/)\n- [float package by Michael Storgaard](https://www.npmjs.com/package/float)\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n[![](https://img.youtube.com/vi/r0aKV3HqDzA/maxresdefault.jpg)](https://www.youtube.com/watch?v=r0aKV3HqDzA)\u003cbr\u003e\n[![ORG](https://img.shields.io/badge/org-nodef-green?logo=Org)](https://nodef.github.io)\n[![DOI](https://zenodo.org/badge/133202640.svg)](https://zenodo.org/badge/latestdoi/133202640)\n[![Coverage Status](https://coveralls.io/repos/github/nodef/extra-number/badge.svg?branch=master)](https://coveralls.io/github/nodef/extra-number?branch=master)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/4acd74bb853361d9903f/test_coverage)](https://codeclimate.com/github/nodef/extra-number/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/4acd74bb853361d9903f/maintainability)](https://codeclimate.com/github/nodef/extra-number/maintainability)\n![](https://ga-beacon.deno.dev/G-RC63DPBH3P:SH3Eq-NoQ9mwgYeHWxu7cw/github.com/nodef/extra-number)\n\n\n[is]: https://github.com/nodef/extra-number/wiki/is\n[significantDigits]: https://github.com/nodef/extra-number/wiki/significantDigits\n[compare]: https://github.com/nodef/extra-number/wiki/compare\n[floor]: https://github.com/nodef/extra-number/wiki/floor\n[ceil]: https://github.com/nodef/extra-number/wiki/ceil\n[round]: https://github.com/nodef/extra-number/wiki/round\n[floorDiv]: https://github.com/nodef/extra-number/wiki/floorDiv\n[ceilDiv]: https://github.com/nodef/extra-number/wiki/ceilDiv\n[roundDiv]: https://github.com/nodef/extra-number/wiki/roundDiv\n[rem]: https://github.com/nodef/extra-number/wiki/rem\n[mod]: https://github.com/nodef/extra-number/wiki/mod\n[modp]: https://github.com/nodef/extra-number/wiki/modp\n[constrain]: https://github.com/nodef/extra-number/wiki/constrain\n[normalize]: https://github.com/nodef/extra-number/wiki/normalize\n[remap]: https://github.com/nodef/extra-number/wiki/remap\n[lerp]: https://github.com/nodef/extra-number/wiki/lerp\n[isPow]: https://github.com/nodef/extra-number/wiki/isPow\n[prevPow]: https://github.com/nodef/extra-number/wiki/prevPow\n[nextPow]: https://github.com/nodef/extra-number/wiki/nextPow\n[root]: https://github.com/nodef/extra-number/wiki/root\n[log]: https://github.com/nodef/extra-number/wiki/log\n[properDivisors]: https://github.com/nodef/extra-number/wiki/properDivisors\n[aliquotSum]: https://github.com/nodef/extra-number/wiki/aliquotSum\n[minPrimeFactor]: https://github.com/nodef/extra-number/wiki/minPrimeFactor\n[maxPrimeFactor]: https://github.com/nodef/extra-number/wiki/maxPrimeFactor\n[primeFactors]: https://github.com/nodef/extra-number/wiki/primeFactors\n[primeExponentials]: https://github.com/nodef/extra-number/wiki/primeExponentials\n[isPrime]: https://github.com/nodef/extra-number/wiki/isPrime\n[gcd]: https://github.com/nodef/extra-number/wiki/gcd\n[lcm]: https://github.com/nodef/extra-number/wiki/lcm\n[factorial]: https://github.com/nodef/extra-number/wiki/factorial\n[binomial]: https://github.com/nodef/extra-number/wiki/binomial\n[multinomial]: https://github.com/nodef/extra-number/wiki/multinomial\n[degrees]: https://github.com/nodef/extra-number/wiki/degrees\n[radians]: https://github.com/nodef/extra-number/wiki/radians\n[sum]: https://github.com/nodef/extra-number/wiki/sum\n[product]: https://github.com/nodef/extra-number/wiki/product\n[median]: https://github.com/nodef/extra-number/wiki/median\n[modes]: https://github.com/nodef/extra-number/wiki/modes\n[range]: https://github.com/nodef/extra-number/wiki/range\n[variance]: https://github.com/nodef/extra-number/wiki/variance\n[arithmeticMean]: https://github.com/nodef/extra-number/wiki/arithmeticMean\n[geometricMean]: https://github.com/nodef/extra-number/wiki/geometricMean\n[harmonicMean]: https://github.com/nodef/extra-number/wiki/harmonicMean\n[quadriaticMean]: https://github.com/nodef/extra-number/wiki/quadriaticMean\n[cubicMean]: https://github.com/nodef/extra-number/wiki/cubicMean\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodef%2Fextra-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodef%2Fextra-number/lists"}