C
Join ServerC#
help
❔ ✅ Equation in code
CCTJ2/13/2023
I have thsese two equations, one is inverse of another.
I managed to get orange equation to work but green one does not for some reason. Any Ideas what I did wrong?
I managed to get orange equation to work but green one does not for some reason. Any Ideas what I did wrong?
public static int GetLevel(decimal XP)
{
double level = 4 * Math.Pow((double)XP, 0.2794) - 5;
level = Math.Floor(level);
return (int)level;
}
public static double GetXpForLevel(int level)
{
double XP = Math.Pow((level + 5) / 4, 5000 / 1397); //gives wrong output
return XP;
}

EEro2/13/2023
Math.Pow((level + 5) / 4d, 5000d / 1397d);
CCTJ2/13/2023
That worked, thanks!
CCTJ2/13/2023
On side question, what does
d
do?EEro2/13/2023
makes the number a
double
CCTJ2/13/2023
Oh okay
thanks
thanks
CCTJ2/13/2023
!close
AAccord2/13/2023
Closed!
AAccord2/14/2023
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.