quagmt / udecimal

A high-performance, high precision, zero allocation fixed-point decimal library for financial applications
https://quagmt.github.io/udecimal/
BSD 3-Clause "New" or "Revised" License
111 stars 4 forks source link

feat: add round away from zero and fix StringFixed issue #24

Closed quagmt closed 4 days ago

quagmt commented 4 days ago

Description

This PR includes:

  1. Add RoundAwayFromZero
    • Initially the name for this method is RoundToInf but I think people might mistakenly assume that RoundToInf is rounding to positive infinity. Renaming it to RoundAwayFromZero provides more clarity and helps avoid confusion
    • The name is also verbose unlike RoundHAZ and RoundHTZ. That's because short from of this method method is RoundAZ which looks very similar to RoundHAZ if we just glance. Also I feel like make it verbose will help reduce the cognitive complexity (no more mapping RoundAZ = Round Away From Zero). It's also good to rename RoundHAZ to RoundHalfAwayZero so it's consistent and less complex but that change is beyond the scope of this PR
  2. Fix StringFixed() issue described in https://github.com/quagmt/udecimal/issues/23
codecov[bot] commented 4 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.89%. Comparing base (5a55047) to head (e506607). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #24 +/- ## ========================================== + Coverage 95.79% 95.89% +0.09% ========================================== Files 5 5 Lines 1713 1752 +39 ========================================== + Hits 1641 1680 +39 Misses 48 48 Partials 24 24 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.