fix: 替换四六舍入为四五舍入
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from decimal import Decimal
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
|
||||
from commons.models.data_fujian import DataFujian
|
||||
from commons.models.data_network import DataNetwork
|
||||
@@ -37,7 +37,8 @@ class Helper:
|
||||
class RoundMethod:
|
||||
@staticmethod
|
||||
def normal(n, round_bit):
|
||||
result = round(n, round_bit)
|
||||
q_ext = Decimal('0.' + '0' * round_bit)
|
||||
result = Decimal(n).quantize(q_ext, rounding=ROUND_HALF_UP)
|
||||
return result if round_bit != 0 else int(result)
|
||||
|
||||
@staticmethod
|
||||
|
@@ -39,7 +39,7 @@ if __name__ == '__main__':
|
||||
from core.factory import ClientApp
|
||||
|
||||
with ClientApp().app_context():
|
||||
calculate(2025, 3)
|
||||
calculate(2025, 5)
|
||||
|
||||
# for i in range(2, 12):
|
||||
# calculate(2022, i+1)
|
||||
|
Reference in New Issue
Block a user