| Age | Commit message (Collapse) | Author |
|
Delete internal/rpn/boolean_ops.go which defines BooleanOperations
struct with GT/LT/GTE/LTE/EQ/NEQ methods using raw float64
comparisons (no metric awareness). NewBooleanOperations() was never
called by any live code path.
The authoritative metric-aware comparison operators live on the
Operations struct in operations_compare.go via compareValues().
boolean_test.go tests via ParseAndEvaluate which uses the live
Operations implementation.
Removes 167 lines of dead code.
|
|
StringNum and Symbol implemented Number but their Float64(),
Compare(), Bool(), IsZero(), IsNegative(), and SetMetric() methods
always returned errors. Any code accepting Number had to defensively
check IsString()/IsSymbol() before arithmetic, defeating the interface.
Split Number into two interfaces:
- StackValue: base interface for anything on the stack
(String, IsBool, IsString, IsSymbol, Metric)
- NumericValue: embeds StackValue + arithmetic contract
(Float64, IsZero, IsNegative, Compare, Bool, SetMetric)
Float and Rat implement both; StringNum and Symbol implement
StackValue only. Keep Number as a type alias for backward compat.
Updated Stack, popStack/popTwo/popAll, toFloat64, resolveMetric,
convertToBase, GetCurrentStack/SetCurrentStack, and all callers
to use the correct interface level.
|
|
- Changed Number interface methods to return errors instead of panicking
- Float64() now returns (float64, error)
- Add, Sub, Mul, Pow, Compare, Bool() now return (Number, error) or (int, error)
- StringNum and Symbol now return errors for unsupported operations
- Added IsString() and IsSymbol() to Number interface
- Removed unused arithmetic.go file
- Updated operations.go, boolean_ops.go, hyper.go to handle errors
- Added constants registry (internal/rpn/constants.go) with built-in math constants
- Added constants_test.go with comprehensive unit tests
- Updated README.md with constants documentation
|
|
- Fixed Ln operation to handle Value conversion before math.Log using Float64() which handles boolean conversion (true → 1, false → 0)
- Added TestLnWithBoolean and TestLnEdgeCases tests for comprehensive coverage
- Refactored operations.go into separate files (arithmetic.go, boolean_ops.go, hyper.go, stack.go, variable.go)
- Removed unused toNumber function from number.go
- Added Float64() method to Value struct for boolean conversion
|