Skip to content

Commit f04ece8

Browse files
committed
Fix rounding errors
1 parent 6486a1a commit f04ece8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/App.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ function App() {
5252
? 0
5353
: Math.floor(
5454
Math.cbrt(
55-
3 * totalUpgradeLevelXp +
56-
Math.sqrt(9 * totalUpgradeLevelXp ** 2 - 1 / 27),
55+
3 * (totalUpgradeLevelXp + 0.5) +
56+
Math.sqrt(9 * (totalUpgradeLevelXp + 0.5) ** 2 - 1 / 27),
5757
) +
5858
Math.cbrt(
59-
3 * totalUpgradeLevelXp -
60-
Math.sqrt(9 * totalUpgradeLevelXp ** 2 - 1 / 27),
59+
3 * (totalUpgradeLevelXp + 0.5) -
60+
Math.sqrt(9 * (totalUpgradeLevelXp + 0.5) ** 2 - 1 / 27),
6161
) -
6262
1,
6363
); //calculate level based on total upgrade level XP

0 commit comments

Comments
 (0)