{"id":"notiku/qnum","name":"qnum","scope":"notiku","platform":"roblox","description":"Big-number library designed for incremental games.","version":"0.2.1","latest":"0.2.1","versions":["0.1.0","0.1.1","0.1.2","0.2.0","0.2.1"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"78b0b8e19f94dadae795c4beb6455bfe20aa4426a75b7c53ecace3c80f886278","likes":0,"downloads":0,"install":"forest install notiku/qnum","url":"https://forest.dev/p/roblox/notiku/qnum","files":"https://api.forest.dev/ai/package/roblox/notiku/qnum/files","readme":"# QNum\n\nA big-number library for Roblox incremental games. Stores values as a normalized mantissa/exponent pair so calculations stay accurate well beyond what a regular `number` can represent.\n\n## Installation\n\nAdd to your `wally.toml`:\n\n```toml\n[dependencies]\nQNum = \"notiku/qnum@0.2.1\"\n```\n\nThen run:\n\n```bash\nwally install\n```\n\n## Usage\n\n```lua\nlocal QNum = require(Path.To.QNum)\n\nlocal gold = QNum.fromNumber(1500)\nlocal reward = QNum.fromString(\"2.5e9\")\n\nlocal total = gold + reward\nprint(total)              --> 2.50B\nprint(total:Format())     --> 2.50B\nprint(QNum.toScientific(total)) --> 2.50e9\n```\n\n## API\n\n### Constructors\n\n| Function                         | Description                                                      |\n| -------------------------------- | ---------------------------------------------------------------- |\n| `QNum.new(mantissa?, exponent?)` | Builds a QNum from a mantissa and exponent.                      |\n| `QNum.fromNumber(n)`             | Builds a QNum from a regular Roblox number.                      |\n| `QNum.fromString(s)`             | Parses plain, scientific (`1.5e9`), or suffix (`2.5B`) notation. |\n\n### Arithmetic\n\n`add`, `sub`, `mul`, `div`, `pow` are available as static functions (`QNum.add(a, b)`), as instance methods (`a:Add(b)`), and via metamethods (`a + b`, `a - b`, `a * b`, `a / b`, `a ^ 2`).\n\n### Comparison\n\n`eq`, `gt`, `lt`, `gte`, `lte` — also wired up to `==`, `<`, `<=`.\n\n### Formatting\n\n| Function                              | Example                       |\n| ------------------------------------- | ----------------------------- |\n| `QNum.format(value, decimals?)`       | `1.25M`                       |\n| `QNum.toScientific(value, decimals?)` | `1.25e6`                      |\n| `QNum.withSuffix(value, decimals?)`   | `1.25M`                       |\n| `QNum.getSuffix(index)`               | `\"k\"`, `\"M\"`, `\"B\"`, `\"T\"`, … |\n| `QNum.getSuffixIndex(suffix)`         | Inverse of `getSuffix`.       |\n\n`tostring(value)` is equivalent to `QNum.format(value)`.\n\n### Utility\n\n- `QNum.clone(value)`\n- `QNum.normalize(value)`\n- `QNum.toNumber(value)` — converts back to a regular number (may overflow for huge values)\n- `QNum.zero`, `QNum.one`\n\n## License\n\nSee [LICENSE](./LICENSE).\n","readmeTruncated":false}