Exponentiation and modulo in the calculator (closes #3)
check / check (push) Successful in 1m7s
check / check (push) Successful in 1m7s
The calculator now takes `^` (or `**`) for powers and `%` for modulo. Powers bind tighter than a sign on their left and group to the right, so `-2^2` is `-4` and `2^3^2` is `512`; `%` sits with `*` and `/` and takes the sign of the divisor. A small parser of our own replaces `go/parser`, which cannot express `^`; `go/constant` still computes. A whole-number exponent is exact; a fractional one is computed in float64. Every number is held as a fraction under 4096 bits, and a float64 result must be a normal double, so one message cannot stall the bot; anything else gets "That needs a number too large or too small for me." Disclosure: tiny values below about 2.2e-308, which `next` answered, are now refused. Model: opus-5-5
This commit was merged in pull request #11.
This commit is contained in:
@@ -27,6 +27,9 @@ with no deprecation warning.
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-09-28 Powers (`^`, also written `**`) and remainders (`%`) in
|
||||
`internal/calc`, which now reads expressions with a parser of its own
|
||||
in place of `go/parser`
|
||||
- 2026-09-28 Moved the command tree and the `run` and `version` commands
|
||||
from `cmd/simplexcalc/` into `internal/cli`; `cmd/simplexcalc/main.go`
|
||||
is now a single call to `cli.Main`
|
||||
|
||||
Reference in New Issue
Block a user