mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-06 15:00:27 +00:00
fix: incorrect rounding off near zero (#28948)
This commit is contained in:
@@ -1157,7 +1157,7 @@ def _round_off_if_near_zero(number: float, precision: int = 6) -> float:
|
||||
""" Rounds off the number to zero only if number is close to zero for decimal
|
||||
specified in precision. Precision defaults to 6.
|
||||
"""
|
||||
if flt(number) < (1.0 / (10**precision)):
|
||||
return 0
|
||||
if abs(0.0 - flt(number)) < (1.0 / (10**precision)):
|
||||
return 0.0
|
||||
|
||||
return flt(number)
|
||||
|
||||
Reference in New Issue
Block a user