@fitchmultz/pi-calculator 4.1.1 → 4.1.2
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.
- package/CHANGELOG.md +5 -0
- package/README.md +32 -46
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.1.2 - 2026-10-31
|
|
4
|
+
|
|
5
|
+
- Refresh installation and reference documentation while preserving unpinned npm and Git sources and migration guidance.
|
|
6
|
+
- Refresh the development lockfile and compatibility workflow references.
|
|
7
|
+
|
|
3
8
|
## 4.1.1 - 2026-10-04
|
|
4
9
|
|
|
5
10
|
- 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
|
-
|
|
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
|
-
|
|
5
|
+

|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
Git remains supported as a fallback:
|
|
16
|
+
Enter this prompt in the new Pi session:
|
|
16
17
|
|
|
17
|
-
```
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
+
Pi extensions run with full system access. Review the source before you install the package.
|
|
26
27
|
|
|
27
28
|
## Expressions
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
Try these expressions:
|
|
30
31
|
|
|
31
32
|
```text
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
+
Trig uses radians. Use `radians()` to convert degrees to radians. Use `degrees()` to convert radians to degrees.
|
|
43
44
|
|
|
44
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
55
|
+
Keep expressions within 4,096 characters. See [limits](docs/reference.md#limits) for nesting, output size and work budgets.
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
See [result format](docs/reference.md#result-format) to use the calculator tool from another extension.
|
|
63
58
|
|
|
64
|
-
|
|
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
|
-
|
|
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
|
-
|
|
65
|
+
## License
|
|
80
66
|
|
|
81
|
-
|
|
67
|
+
[MIT](LICENSE) © Mitchell Fultz.
|