Skip to content

Commit 20cdc88

Browse files
committed
fix precision loss
1 parent 790561f commit 20cdc88

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

utils/econfuncs.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,15 @@ async def update_amount(user, change=0, bonuses=True, tracker_reason="unknown"):
8686
prestieges = await get_prestiege(user)
8787
if prestieges is not None and bonuses:
8888
if change > 0:
89-
change = int(change + (change * (0.025 * prestieges[0])))
89+
change = int(
90+
Decimal(change)
91+
+ (Decimal(change) * (Decimal("0.025") * Decimal(prestieges[0])))
92+
)
9093
else:
91-
change = int(change - (change * (0.05 * prestieges[2])))
94+
change = int(
95+
Decimal(change)
96+
- (Decimal(change) * (Decimal("0.05") * Decimal(prestieges[2])))
97+
)
9298
if prestieges is not None:
9399
uncapped = True if prestieges[3] else False
94100
new_balance = bal + change

0 commit comments

Comments
 (0)