[KIAI-458] - Formula not accepted
After attempting to edit the leveling formula to
18141.0333*({level}-5.927)^(1/3)+({level}-1)*229.844911+31269.02231, the bot says that, at Level 5, the XP goes beyond the range of 1 and 100 million, when it is in fact exactly 14500.
It has been confirmed using GeoGebra and the function g(x)=18141.0333 (x-5.927)^(((1)/(3)))+(x-1)*229.844911+31269.02231 that, indeed, g(5) equals 14500, and that g(50) and g(100) produce the same result as the bot when calculating the formula.
Bashing my head against the wall (trying to submit the formula over and over) did not resolve the issue, neither did spacing out all of the elements of the formula.

14 Replies
Hey @Neulo! Our team will answer your post soon.
If this is an issue in your server, make sure you've included your server's ID (This can be found on the
/ping command), as well as which users are having this issue.
Once your question has been answered, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution to help others find the solution via Answer OverflowHey. I’m pretty sure Kiai calculates exponents using
**, like 3**2 would be 9if it was, then the two other calculations wouldnt go through

and here it just fails all of them
@Kiai eval kiai.leveling.limitedMathEvaluate(
18141.0333*(1-5.927)^(1/3)+(1-1)*229.844911+31269.02231)
Type:
⏱ 957.25μs
looks like for level 1, it results in an imaginary number
46703.533464305976 + 26733.35750924651i
@Kiai eval kiai.leveling.limitedMathEvaluate(
18141.0333*(5-5.927)^(1/3)+(5-1)*229.844911+31269.02231)
Type:
⏱ 1.88ms
Same thing for level 5
oh wow lol
soooooooo anything that could be done about this issue?
I’m marking this as a bug so I’ll see if I can fix the issue and get back to you
from my limited testing (removing certain parts of the formula), everything gets fixed when i remove the ^(1/3)
now, everything gets also fixed when i do this
18141.0333*cbrt({level}-5.927)^(1/3)+({level}-1)*229.844911+31269.02231
instead of using ^(1/3), i used cbrt()
now, defining non-cubic and non-square roots is still an issue, which cant be dismissedfunny

Yes its because the raw mathematical calculation doesn't enforce a real number and it ends up a Complex result because of the result where if
{level} - 5.927 is negative and you try to ^(1/3) it ends up as a Complex because of how it gets interpreted at runtime. The natural log of a negative number is usually a Complex number in most programming languages.
If you force the cube root, it forces the mathematical calculation to stay in the real number domain