fix: incorrect rounding off near zero (#28948)

This commit is contained in:
Ankush Menat
2021-12-18 21:34:25 +05:30
committed by GitHub
parent d3c62821fb
commit 0724a148e6

View File

@@ -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 """ Rounds off the number to zero only if number is close to zero for decimal
specified in precision. Precision defaults to 6. specified in precision. Precision defaults to 6.
""" """
if flt(number) < (1.0 / (10**precision)): if abs(0.0 - flt(number)) < (1.0 / (10**precision)):
return 0 return 0.0
return flt(number) return flt(number)