Skip to content

Latest commit

 

History

History
162 lines (116 loc) · 3.66 KB

ROADMAP.md

File metadata and controls

162 lines (116 loc) · 3.66 KB

BigDecimal Implementation Roadmap

This document tracks the implementation progress of the BigDecimal library, inspired by the bignumber.js implementation but focused on decimal arithmetic with arbitrary precision.

Implemented Features ✅

Core Functionality

  • Basic BigDecimal class structure
  • Constructor supporting multiple input types (string, number, bigint, BigDecimal)
  • Internal value representation using bigint
  • Scale (decimal places) management
  • Sign handling

Arithmetic Operations

  • Addition (plus)
  • Subtraction (minus)
  • Multiplication (times)
  • Division (div)
  • Power (pow)
  • Square root (sqrt) - basic implementation
  • Negation (negate)
  • Absolute value (abs)

Comparison and Validation

  • Comparison methods (compareTo)
  • Value validation (isValid)
  • Zero checks (isZero)
  • Sign checks (isPositive, isNegative)

Formatting and Conversion

  • toString() implementation
  • toFixed() for decimal place formatting
  • valueOf() for primitive conversion
  • Symbol.toPrimitive implementation

Rounding

  • Basic rounding implementation (round)

Planned Features 🚀

Enhanced Arithmetic

  • Modulo operation (mod)
  • Integer division (idiv)
  • Enhanced sqrt implementation with Newton's method
  • Exponential function (exp)
  • Natural logarithm (ln)
  • Trigonometric functions (sin, cos, tan)

Precision and Rounding

  • Multiple rounding modes:
    • ROUND_UP
    • ROUND_DOWN
    • ROUND_CEIL
    • ROUND_FLOOR
    • ROUND_HALF_UP
    • ROUND_HALF_DOWN
    • ROUND_HALF_EVEN
    • ROUND_HALF_CEIL
    • ROUND_HALF_FLOOR
  • Precision management
  • Significant digits handling

Configuration

  • Global configuration system
  • Decimal places settings
  • Rounding mode settings
  • Exponential notation settings
  • Format settings

Additional Features

  • fromString with exponential notation
  • Scientific notation support
  • Custom formatting options
  • Locale-aware formatting
  • Binary/Octal/Hex conversion

Error Handling

  • Enhanced error messages
  • Custom error types
  • Error handling configuration

Performance Optimizations

  • Caching mechanism
  • Lazy evaluation
  • Memory usage optimizations
  • Algorithm improvements

Testing and Documentation

  • Comprehensive unit tests
  • Performance benchmarks
  • API documentation
  • Usage examples
  • TypeScript type improvements

Future Considerations 🤔

Advanced Features

  • BigDecimal.random() implementation
  • Matrix operations
  • Complex number support
  • Interval arithmetic
  • Financial calculations (compound interest, etc.)

Integration

  • Browser bundle optimization
  • Node.js optimizations
  • WebAssembly implementation
  • Worker thread support

Standards Compliance

  • IEEE 754 compliance
  • Decimal128 support
  • Standard decimal arithmetic specification

Release Planning 📅

v1.0.0 (Current)

  • Basic arithmetic operations
  • Core functionality
  • Essential formatting

v1.1.0

  • Enhanced rounding modes
  • Improved error handling
  • Additional arithmetic operations

v1.2.0

  • Configuration system
  • Advanced formatting options
  • Performance optimizations

v2.0.0

  • Advanced mathematical functions
  • Complete IEEE 754 compliance
  • Comprehensive documentation

Contributing

Please feel free to contribute to any of the planned features or suggest new ones. Follow these steps:

  1. Check the feature isn't already being worked on
  2. Open an issue to discuss the implementation
  3. Submit a pull request with tests and documentation