@fitchmultz/pi-calculator 4.1.1 → 4.1.3

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 (3) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +32 -46
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.3 - 2026-10-31
4
+
5
+ <!-- npm-release:unreleased:start -->
6
+ <!-- npm-release:unreleased:end -->
7
+
8
+ - Enable reviewed automatic npm releases (#42) ([f7ce653](https://github.com/fitchmultz/pi-calculator/commit/f7ce6539ac13a509750e4960c4ef5182c5530b40))
9
+
10
+ ### What's Changed
11
+ * Enable reviewed automatic npm releases by @fitchmultz in https://github.com/fitchmultz/pi-calculator/pull/42
12
+
13
+
14
+ **Full Changelog**: https://github.com/fitchmultz/pi-calculator/compare/v4.1.2...v4.1.3
15
+
16
+ ## 4.1.2 - 2026-10-31
17
+
18
+ - Refresh installation and reference documentation while preserving unpinned npm and Git sources and migration guidance.
19
+ - Refresh the development lockfile and compatibility workflow references.
20
+
3
21
  ## 4.1.1 - 2026-10-04
4
22
 
5
23
  - Publish the existing calculator as the public scoped package `@fitchmultz/pi-calculator`, continuing the 4.1.x version line. The unrelated unscoped npm package is not this project.
package/README.md CHANGED
@@ -1,81 +1,67 @@
1
1
  # pi-calculator
2
2
 
3
- A deterministic calculator tool for [Pi](https://github.com/earendil-works/pi) with 40-significant-digit decimal precision. Input literals and arithmetic are rounded using half-up rounding; results are decimal strings, not lossless symbolic answers.
3
+ pi-calculator adds a calculator tool to [Pi](https://github.com/earendil-works/pi), with 40 significant digits of decimal precision. Use it to check totals or evaluate scientific expressions.
4
4
 
5
- Requires Node.js 24 or later and Pi 1.0.0 or later. Release qualification selects the latest stable official Pi and the [fitchmultz/pi fork](https://github.com/fitchmultz/pi) main once per run, freezing their version and commit throughout the checks. Each host is qualified separately; a matching version string is not a compatibility result.
5
+ ![Pi sends an expression to the calculator, which returns a decimal result or rejects an invalid expression.](.github/readme/calculator-flow.png)
6
6
 
7
- ## Install
7
+ ## Install and try it
8
+
9
+ Use Node.js and a supported Pi release. See the [compatibility requirements](https://github.com/fitchmultz/pi-calculator/blob/main/docs/reference.md#installation-options).
8
10
 
9
11
  ```sh
10
12
  pi install npm:@fitchmultz/pi-calculator
13
+ pi
11
14
  ```
12
15
 
13
- **The unscoped `pi-calculator` npm package is NOT this project.** This repository publishes only `@fitchmultz/pi-calculator`.
14
-
15
- Git remains supported as a fallback:
16
+ Enter this prompt in the new Pi session:
16
17
 
17
- ```sh
18
- pi install git:github.com/fitchmultz/pi-calculator
19
- # Existing versioned tags remain installable:
20
- pi install git:github.com/fitchmultz/pi-calculator@v4.1.0
18
+ ```text
19
+ Use the calculator to evaluate [0.1 + 0.2, 2^64].
21
20
  ```
22
21
 
23
- When switching from Git to npm, remove the exact Git source shown by `pi list` before installing the scoped package to avoid loading the calculator twice. Existing Git installs can stay on Git.
22
+ The calculator tool returns `["0.3","18446744073709551616"]`.
23
+
24
+ See [installation options](docs/reference.md#installation-options) for Git installs or a change from Git to npm.
24
25
 
25
- The package adds one `calculator` tool with one required `expression` string. Pi supplies the schema and terminal UI libraries; the calculator uses `decimal.js` and `expr-eval-fork` for evaluation.
26
+ Pi extensions run with full system access. Review the source before you install the package.
26
27
 
27
28
  ## Expressions
28
29
 
29
- Use the calculator for non-trivial calculations; simple arithmetic does not need a tool call. Independent results can share one flat array:
30
+ Try these expressions:
30
31
 
31
32
  ```text
32
- (12.5 * 1.0825) ^ 3
33
- sin(radians(90))
34
- percent(15, 200)
35
- mean([2,4,6,8])
36
- [stdev([2,4,4,4,5,5,7,9]), stdevs([2,4,4,4,5,5,7,9])]
37
- [0.1 + 0.2, 2^64]
33
+ percent(15, 200) → 30
34
+ roundTo(-1.25, 1) → -1.3
35
+ mean([2,4,6,8]) → 5
36
+ sin(radians(90)) → 1
37
+ sum([1e40,1,-1e40]) → 1
38
+ (12.5 * 1.0825) ^ 3 → 2477.500518798828125
38
39
  ```
39
40
 
40
- Operators include `+`, `-`, `*`, `/`, `%`, `^` and `**`; constants are `PI` and `E`. Arrays support zero-based indexing, such as `[1,2,3][2]`.
41
+ Arithmetic supports `+`, `-`, `*`, `/`, `%`, `^` and `**`, with `PI` and `E` as constants. Put independent calculations in one flat array, as in the first example.
41
42
 
42
- Supported functions include:
43
+ Trig uses radians. Use `radians()` to convert degrees to radians. Use `degrees()` to convert radians to degrees.
43
44
 
44
- - `sin`, `cos`, `tan`, their inverse/hyperbolic variants, and `atan2`. Trig uses radians. `radians(degrees)` and `degrees(radians)` convert angles.
45
- - `sqrt`, `cbrt`, `abs`, `pow`, `exp`, `expm1`, `ln`/`log`, `log1p`, `log2`, `log10`/`lg`. `ln` and `log` are natural logarithms. For small inputs, use `expm1(x)` for `exp(x)-1` and `log1p(x)` for `ln(1+x)` to preserve precision.
46
- - `ceil`, `floor`, `round`, `roundTo`, `trunc`, `sign`. `roundTo(value, places)` rounds halves away from zero; negative places round to tens, hundreds, and so on.
47
- - `percent(rate, amount)` gives `rate%` of `amount`: `percent(15, 200)` is `30`.
48
- - `sum`, `mean`, `median`, `stdev`, `stdevs` take numeric arrays. `stdev` is population standard deviation; `stdevs` is sample standard deviation and requires at least two elements.
49
- - `min`, `max`, `hypot`/`pyt` take either an array or individual arguments.
50
- - `n!` and `fac(n)` compute factorials for integers from 0 through 1000.
45
+ `roundTo(value, places)` rounds half values away from zero. Use negative places to round to tens, hundreds or larger units.
51
46
 
52
- Aggregates require finite numeric elements. Sums preserve cancellation remainders before rounding; means and even medians round after division.
47
+ See the [expression reference](docs/reference.md#expressions) for all functions and array indexing.
53
48
 
54
49
  ## Results and limits
55
50
 
56
- The tool returns a finite scalar or flat array of finite scalars, represented as decimal strings. A nested array, nonnumeric result, or nonfinite member fails the whole expression. Large finite values use scientific notation.
51
+ Results are decimal strings, or a flat array of decimal strings. Input numbers and arithmetic use half-up rounding. Large finite results use scientific notation.
57
52
 
58
- Model-facing content contains only the value, such as `0.3`, or a JSON array of strings, such as `["0.3","18446744073709551616"]`. Structured details retain `{ expression, value }`, where `expression` is trimmed and `value` is a string or string array. The same stable outcome is exposed as native `structuredContent` with an `outputSchema`, so nested/codemode callers receive decimal strings without reparsing display text. Evaluation failures still throw and become native error results; schema and policy checks remain Pi-owned. Pi's tool card displays the safely escaped expression above the result.
53
+ The calculator tool rejects invalid expressions, nonfinite results and nested result arrays. If one result in an array is invalid, the calculator tool rejects the whole expression.
59
54
 
60
- Expressions are limited to 4,096 characters and 128 nesting levels. Serialized expression/value details must fit within 50 KiB; oversized results are rejected rather than truncated. The tool requests native strict JSON-schema sampling where the provider supports it and uses Pi's normal fallback elsewhere.
55
+ Keep expressions within 4,096 characters. See [limits](docs/reference.md#limits) for nesting, output size and work budgets.
61
56
 
62
- Each expression has a shared 1,000-step factorial budget. `sin`/`cos`/`tan` reject absolute inputs above `1e100`, hyperbolic functions reject absolute inputs above 10,000, and `%` rejects operand exponent gaps above 10,000. Expensive operations share a 10,000-unit work budget. Circular trig calls cost 100 units each, allowing at most 100 per expression.
57
+ See [result format](docs/reference.md#result-format) to use the calculator tool from another extension.
63
58
 
64
- ### Upgrading from v2
65
-
66
- Version 3 removes the old angle-conversion names: replace `deg(x)` with `radians(x)` and `rad(x)` with `degrees(x)`. There are no compatibility aliases. Tool content no longer includes `expression =`; consumers should read the expression from details and handle both string and string-array values.
59
+ Read the [migration notes](https://github.com/fitchmultz/pi-calculator/blob/main/docs/reference.md#migration) before upgrading.
67
60
 
68
61
  ## Verification
69
62
 
70
- ```sh
71
- npm ci --ignore-scripts
72
- npm run verify
73
- ```
74
-
75
- Verification includes numerical and work-limit checks, schema and structured result contracts, actual extension loading, native nested validation/policy/evaluation errors, and native tool-card rendering. The exact development cohort uses TypeBox 1.3.27; no evaluator or grammar compatibility layer is needed.
76
-
77
- Update the development TypeBox pin alongside the qualified Pi host, using the version that host ships. Independent TypeBox updates are disabled in Renovate because they install duplicate host schema libraries and slow development startup. Each compatibility lane still selects its host's TypeBox version.
63
+ See the [development guide](docs/development.md) for local checks and Pi compatibility tests. See the [changelog](CHANGELOG.md) for release history.
78
64
 
79
- The locked development cohort is reproducible local tooling, not a release-qualification target. CI runs the full verification against both frozen latest hosts, including fresh Git and packed npm consumers. Intentional version bumps with versioned changelog notes publish from the main-only repository pipeline when `NPM_RELEASE_ENABLED` is `true`; the release caller reuses the same frozen host inputs for qualification and publishing.
65
+ ## License
80
66
 
81
- Pi extensions execute with full system access. Review the source before installing.
67
+ [MIT](LICENSE) © Mitchell Fultz.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitchmultz/pi-calculator",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },