Commit Graph
24 Commits
Author SHA1 Message Date
Zach Kelling 21b7243e9f refactor: remove local replace, use published big v0.1.0 v1.2.2 safe/v0.0.1 v1.2.1 2026-01-05 01:38:02 -08:00
Zach Kelling 356605c2c1 chore: update go.mod/sum big/v0.1.0 2026-01-04 19:29:50 -08:00
Zach Kelling 8edeed68cd safe: add DEX math functions for DRY consolidation
Added functions from node/vms/dexvm/math:
- Div64: safe division with error on zero
- MulBig: multiply uint64s returning big.Int
- MulDiv64: (a * b) / c without overflow
- MulDivRoundUp64: ceiling division variant
- BigMulDiv: big.Int multiplication+division
- BigMulDivRoundUp: big.Int ceiling variant
- Clamp: generic ordered type clamping

Also added common big.Int values (bigZero, bigOne, maxUint64Big)
for performance in division operations.
2026-01-03 18:53:26 -08:00
Zach Kelling fd27f2ecb0 Reorganize math package into subpackages
- Create math/big for big.Int utilities (HexOrDecimal256, U256, parsing)
- Create math/safe for overflow-safe arithmetic (SafeAdd, SafeMul, etc.)
- Move averager files to root package level
- Add re-exports in root package for backwards compatibility
- Update README with new package structure documentation
- Remove old math/meter directory (consolidated elsewhere)
- Remove redundant math/ subdirectory structure
2026-01-03 18:22:33 -08:00
Zach Kelling 7870d52f6f Remove units/ - use luxfi/const for denominations 2026-01-03 17:39:26 -08:00
Zach Kelling 45e2df82ae Add big.Int and integer utilities from geth/common/math
- big.go: BigPow, ParseBig256, U256, U256Bytes, PaddedBigBytes, etc.
- integer.go: HexOrDecimal64, ParseUint64, SafeAdd/Sub/Mul

Consolidating math utilities into luxfi/math to eliminate
geth/common/math dependency.
2026-01-03 17:36:34 -08:00
Zach Kelling 517b493821 Add bit and units subpackages, remove safemath wrapper
- Add math/bit: XOR, AND, compress operations (from bitutil)
- Add math/units: Lux denomination constants (NanoLux, MicroLux, etc.)
- Remove safemath/: was just re-exporting geth/common/math
- Use github.com/luxfi/geth/common/math directly for safe math ops
2026-01-03 15:52:15 -08:00
Zach Kelling 8e13df0a8b chore: update go.mod 2025-12-31 22:21:37 -08:00
Zach Kelling 107c43637e feat: add heap, linked, sorting, zero - remove utils dependency
- Add Zero[T any]() generic function for zero values
- Add IsSortedBytes for byte slice sorting checks
- Add heap/queue.go with priority Queue[T] implementation
- Add heap/map.go with indexed Map[K,V] for heap operations
- Add linked/list.go with doubly-linked List[T]
- Add linked/hashmap.go with ordered HashMap[K,V]
- Update sampleable_set.go to use local luxmath.Zero[T]()
- Update averager_heap.go to use github.com/luxfi/math/heap
- Update safe_math.go to use luxmath.Zero[T]()
- Remove github.com/luxfi/utils dependency entirely
v1.2.0
2025-12-24 15:06:41 -08:00
Zach Kelling 086468c3ca refactor: remove node dependency, use extracted packages
- Replace github.com/luxfi/node/utils with github.com/luxfi/utils
- Replace github.com/luxfi/node/utils/sampler with github.com/luxfi/sampler
- Replace github.com/luxfi/node/utils/wrappers with github.com/luxfi/utils/wrappers
- Replace github.com/luxfi/node/utils/json with github.com/luxfi/utils/json
v1.0.5
2025-12-24 14:12:00 -08:00
Zach Kelling 5675cd73a6 deps: upgrade crypto to v1.17.25 v1.1.1 2025-12-21 11:11:46 -08:00
Zach Kelling 83bf9799d5 Add generic safe math operations
Provides overflow/underflow protected Add, Sub, Mul operations
with generic constraints for all unsigned integer types.
v1.1.0
2025-12-19 08:45:58 -08:00
Zach Kelling 8015ec9f82 Update dependencies to latest versions v1.0.2 2025-12-13 10:42:20 +00:00
Zach Kelling 9cf2d96eec Remove local replace, update to latest luxfi versions
- Remove local replace directive for luxfi/utils
- Use published github.com/luxfi/utils v1.0.0
- Update github.com/luxfi/geth: v1.16.34 -> v1.16.43
- Update github.com/luxfi/ids: v1.0.2 -> v1.1.4
- Update github.com/luxfi/crypto: v1.2.9 -> v1.17.15
- Update Go version to 1.25.5
- All tests pass
v1.0.1
2025-12-11 05:44:25 +00:00
Hanzo Dev 7ec590f9f9 Release v1.0.0 v1.0.0 2025-12-04 08:38:47 -08:00
Hanzo Dev 7fbb28a575 feat: math v0.1.5 - set improvements and documentation
- Add clear method to Set type
- Add documentation site structure
- Update Go module version
v0.1.5
2025-12-03 23:58:07 -08:00
Hanzo Dev 84ce29ae02 Add Peek method to Set v0.1.4 2025-10-30 12:33:06 -07:00
Hanzo Dev c25b6e7f89 Update go.mod v0.1.3 2025-10-30 12:12:02 -07:00
Hanzo Dev a154081bc1 Add missing Set methods and fix tests
- Make Add() variadic to accept multiple elements
- Add Overlaps() method to check for common elements
- Add Pop() method to remove and return an element
- Add NewSet() constructor with optional initial capacity
- Implement MarshalJSON/UnmarshalJSON for JSON serialization
- Fix test to use return values from Union/Difference

All tests now passing.
2025-10-28 09:59:35 -07:00
Hanzo Dev 93e59bf1d4 Update set implementation and add documentation 2025-10-28 09:59:35 -07:00
Zach Kelling bd2d8bed31 Update go.mod dependencies 2025-09-24 02:39:13 +00:00
Zach Kelling 2a3a7e8a14 chore: standardize on Go 1.25.1 2025-09-21 08:44:30 +00:00
Zach Kelling 4ba63b8a06 fix: set Go version to 1.22.8 for compatibility v0.1.1 2025-09-21 07:58:55 +00:00
Hanzo Dev f271a0362b Initial commit: Lux math library v0.1.0 2025-08-18 13:18:19 -05:00