Feature: Number class #326

Closed
opened 2025-03-09 09:43:11 +00:00 by jamie · 4 comments
jamie commented 2025-03-09 09:43:11 +00:00 (Migrated from git.hazaar.io)

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

  1. Create a Number class within the Hazaar framework.
  2. 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
  3. Ensure the methods follow best practices and efficient implementations.
  4. 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)
## 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 1. Create a `Number` class within the Hazaar framework. 2. 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 3. Ensure the methods follow best practices and efficient implementations. 4. Document usage examples for developers. ## Priority/Severity - [x] 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)
jamie commented 2025-03-09 09:43:11 +00:00 (Migrated from git.hazaar.io)

assigned to @jamie

assigned to @jamie
jamie commented 2025-03-09 21:32:34 +00:00 (Migrated from git.hazaar.io)

created branch 326-feature-number-class to address this issue

created branch [`326-feature-number-class`](/hazaar/framework/-/compare/master...326-feature-number-class) to address this issue
jamie commented 2025-03-09 21:32:40 +00:00 (Migrated from git.hazaar.io)

mentioned in merge request !211

mentioned in merge request !211
jamie commented 2025-03-10 08:50:19 +00:00 (Migrated from git.hazaar.io)

mentioned in commit c169453efc

mentioned in commit c169453efc89fa88d8114143c0636f3cb1c1ac3d
jamie (Migrated from git.hazaar.io) closed this issue 2025-03-10 08:50:19 +00:00
jamie self-assigned this 2025-09-04 01:14:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: hazaar/framework#326
No description provided.