Skip to content

Commit 5e5866b

Browse files
committed
added calculator
1 parent 5eb1826 commit 5e5866b

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

docs/Math/math.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ This page documents all user-facing math functions in Pythonic, using a clear ta
1212

1313
Many arithmetic and aggregation functions accept an optional `policy` parameter of type `Overflow`, which controls how overflows are handled:
1414

15-
| Policy | Enum Value | Description |
16-
| ------------------------ | ---------- | ------------------------------------------------------------------------------- |
17-
| `Overflow::Throw` | 0 | **Default for functions and operators.** Throw an exception on overflow (safe, Python-like). |
18-
| `Overflow::Promote` | 1 | Promote to a larger type on overflow (never throws, but may use bigger type). |
19-
| `Overflow::Wrap` | 2 | Wrap around on overflow (C++-like, may lose data, never throws). |
20-
| `Overflow::None_of_them` | 3 | Raw C++ arithmetic (no checks, maximum performance). |
15+
| Policy | Enum Value | Description |
16+
| ------------------------ | ---------- | -------------------------------------------------------------------------------------------- |
17+
| `Overflow::Throw` | 0 | **Default for functions and operators.** Throw an exception on overflow (safe, Python-like). |
18+
| `Overflow::Promote` | 1 | Promote to a larger type on overflow (never throws, but may use bigger type). |
19+
| `Overflow::Wrap` | 2 | Wrap around on overflow (C++-like, may lose data, never throws). |
20+
| `Overflow::None_of_them` | 3 | Raw C++ arithmetic (no checks, maximum performance). |
2121

2222
**Policy Selection Guide:**
2323

@@ -231,6 +231,14 @@ var result = div(x, y, Overflow::Promote); // Returns float (2.5)
231231
| `fill_randomf_set(count, min, max)` | Set of random floats | `fill_randomf_set(5, 0, 1)` |
232232
| `fill_randomn_set(count, mean, stddev)` | Set of normal floats | `fill_randomn_set(5, 0, 1)` |
233233

234+
## Calculator API
235+
236+
| Function | Description | Example |
237+
| --------------- | -------------------------------------- | ---------------------------------------- |
238+
| `calculator()` | Starts interactive CLI calculator | `pythonic::calculator::calculator();` |
239+
| `Calculator` | Calculator class for programmatic use | `pythonic::calculator::Calculator calc;` |
240+
| `process(line)` | Process a line (expression/assignment) | `calc.process("var a=10. a+5");` |
241+
234242
---
235243

236244
## Notes

0 commit comments

Comments
 (0)