Repository navigation
Breaking Changes
- Replaced the function-based API with a class-based API.
- Arithmetic operations (
add,subtract,multiply,divide) are now instance methods of theCalculatorclass. - Removed top-level function exports from the public API.
Added
- Introduced the
Calculatorclass as the primary public interface. - Automatic input coercion:
- Supports
int,float, and numericstrvalues. - Inputs are converted internally without requiring explicit casting.
- Supports
- Centralized input validation using internal utility modules.
Improved
- Consistent and explicit error handling:
- Raises
TypeErrorfor invalid numeric inputs. - Raises
ValueErrorfor division by zero.
- Raises
- Improved internal project structure to support future extensibility.
- Updated test suite to reflect the new class-based design.
Internal
- Added internal
utils.convert_to_numhelper for numeric normalization. - Clarified public API boundaries by limiting exports to supported interfaces.
Migration Guide
Before (v0.1.x):
from mathlib import add
add(2, 3)After (v0.2.0):
from mathlib import Calculator
calc = Calculator()
calc.add(2, 3)