arbitrary-numbers 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +21 -3
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -10,7 +10,15 @@
10
10
  [![Zero dependencies](https://img.shields.io/badge/dependencies-zero-6366f1?labelColor=0c0c0e)](package.json)
11
11
  </div>
12
12
 
13
- `arbitrary-numbers` is a TypeScript library for numbers beyond `Number.MAX_SAFE_INTEGER`. Exact arithmetic at any scale, with fused operations and formula pipelines built for idle game loops and simulations.
13
+ `arbitrary-numbers` fills a specific gap: JavaScript's `Number` type silently loses precision above `Number.MAX_SAFE_INTEGER`, and `BigInt` can't represent decimals, so working with extremely large or small magnitudes often requires manual scaling into very large integers.
14
+
15
+ Numbers are stored as a normalized `coefficient × 10^exponent` pair. That makes arithmetic across wildly different scales fast and predictable — exactly what idle games and simulations need when values span from `1` to `10^300` in the same loop.
16
+
17
+ - **Immutable by default** — every operation returns a new instance, no surprise mutations
18
+ - **Fused operations** (`mulAdd`, `subMul`, ...) — reduce allocations in hot loops
19
+ - **Formula pipelines** — define an expression once, apply it to any number of values
20
+ - **Pluggable display** — swap between scientific, unit (K/M/B/T), and letter notation without touching game logic
21
+ - **Zero dependencies** — nothing to audit, nothing to break
14
22
 
15
23
  ## Install
16
24
 
@@ -54,17 +62,27 @@ an(1.5, 9).toString(unitNotation) // "1.50 B"
54
62
 
55
63
  ## Table of contents
56
64
 
65
+ - [Install](#install)
66
+ - [Quick start](#quick-start)
67
+ - [Table of contents](#table-of-contents)
57
68
  - [Creating numbers](#creating-numbers)
58
69
  - [Arithmetic](#arithmetic)
59
70
  - [Fused operations](#fused-operations)
60
- - [Fluent builder - chain()](#fluent-builder---chain)
61
- - [Reusable formulas - formula()](#reusable-formulas---formula)
71
+ - [Fluent builder - `chain()`](#fluent-builder---chain)
72
+ - [Reusable formulas - `formula()`](#reusable-formulas---formula)
73
+ - [chain() vs formula()](#chain-vs-formula)
62
74
  - [Comparison and predicates](#comparison-and-predicates)
63
75
  - [Rounding and math](#rounding-and-math)
64
76
  - [Display and formatting](#display-and-formatting)
77
+ - [scientificNotation (default)](#scientificnotation-default)
78
+ - [unitNotation - K, M, B, T...](#unitnotation---k-m-b-t)
79
+ - [AlphabetNotation - a, b, c... aa, ab...](#alphabetnotation---a-b-c-aa-ab)
65
80
  - [Precision control](#precision-control)
66
81
  - [Errors](#errors)
67
82
  - [Utilities](#utilities)
83
+ - [ArbitraryNumberOps - mixed `number | ArbitraryNumber` input](#arbitrarynumberops---mixed-number--arbitrarynumber-input)
84
+ - [ArbitraryNumberGuard - type guards](#arbitrarynumberguard---type-guards)
85
+ - [ArbitraryNumberHelpers - game and simulation patterns](#arbitrarynumberhelpers---game-and-simulation-patterns)
68
86
  - [Writing a custom plugin](#writing-a-custom-plugin)
69
87
  - [Idle game example](#idle-game-example)
70
88
  - [Performance](#performance)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arbitrary-numbers",
3
- "version": "1.0.0",
4
- "description": "Immutable arbitrary-magnitude numbers for idle games, simulations, and scientific computing. Stored as coefficient × 10^exponent with pluggable display formatting.",
3
+ "version": "1.0.1",
4
+ "description": "Arbitrary-magnitude arithmetic for idle games and simulations, with fused operations, formula pipelines, and pluggable number formatting.",
5
5
  "author": "Chris",
6
6
  "license": "MIT",
7
7
  "repository": {