Feature: Number class
Problem Statement
Hazaar currently lacks a dedicated utility class for handling common number operations. Similar to how the Arr
and Str
classes were created for array and string helper functions, a Number
class should be introduced to provide a centralized and efficient way to handle number-related operations.
Who will benefit?
- Developers working with numerical calculations in Hazaar.
- Applications that require consistent and reusable number processing functions.
- Codebases looking to reduce redundancy in number handling logic.
Benefits and risks
Benefits
- Consistency: Provides a standardized way to handle numerical operations.
- Code Reusability: Eliminates the need for repetitive number processing logic.
- Precision: Helps prevent common floating-point errors and improves accuracy.
Risks
- Overcomplication: The class should remain focused on essential and commonly used number operations.
- Performance Considerations: Certain calculations may introduce overhead if not optimized properly.
Proposed Solution
- Create a
Number
class within the Hazaar framework. - Implement commonly used number helper functions such as:
- Rounding and precision handling
- Formatting numbers (e.g., currency, scientific notation)
- Safe division with zero handling
- Percentage calculations
- Number comparison utilities
- Ensure the methods follow best practices and efficient implementations.
- Document usage examples for developers.
Priority/Severity
-
High (This will bring a huge increase in performance/productivity/usability/legislative cover) -
Medium (This will bring a good increase in performance/productivity/usability) -
Low (anything else e.g., trivial, minor improvements)