Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📘 Description
The logging of session cost value gave an imprecise decimal value.
🔄 Related Issue (if applicable)
#284
🎯 Goal
Ensure precise and accurate rounding of decimal value when logging Cost of the session
🔍 Additional Context
The quantize method in the decimal module is used to round a Decimal object to a specified precision. It requires a Decimal argument that indicates the desired precision and an optional rounding strategy.
How quantize Works
Precision Specification: By passing a Decimal value that represents the desired precision, we can control the number of decimal places to which the value is rounded. For example, Decimal('0.0000001') specifies that we want to round to six decimal places.
Rounding Strategy: The method supports various rounding strategies. In our case, we used ROUND_HALF_UP, which rounds the number to the nearest neighbor, with ties (a digit exactly in the middle, i.e., 5) rounding up.
🧪 Testing