C#, Experience Points math equation

Hi everyone,

lately I’ve been trying to make an Exp system for a unity project, I’m trying to implement the following equation in C#
((([Current Level]/2+2)^2)+([Current level]^1,0821))^2

When I tried implementing it in C# it looked like this
Current_Exp = Mathf.Pow((Mathf.Pow((Current_Level/2+2), 2)+Mathf.Pow(Current_Level, 1.0821F)), 2);

With the C# version the answers are different than the answers before I implemented it in C#
I don’t know what I’m doing wrong and I would really appreciate it if someone could help me with this.

Simple fix
Current_Exp = Mathf.Pow((Mathf.Pow((Current_Level/2+2), 2)+Mathf.Pow(Current_Level, 10821F)), 2);

You were using 1.0821 instead of 10821

I’m affraid it doesn’t work like that, the 1.0821 is the exponential growth factor. changing it to 10821 results in “Infinity” for unity as soon as you go over the number 1 for current_level.

Hi,
The other implementation is using floats or doubles ?
What is the type of Current_Exp ?
Also, I personally prefer to use parentheses.

((([Current Level]/2+2)^2)+([Current level]^1,0821))^2

()^2

(([Current Level]/2+2)^2)

([Current level]^1,0821)

Current_Exp = Mathf.Pow( ( Mathf.Pow( ( (Current_Level/2) +2 ), 2 ) + ( Mathf.Pow( Current_Level, 1.0821F ) ) ), 2);

Ok well I’m an idiot for not even remembering the 3 digit rule. 1,0821 wouldn’t even exist, it would have to be 10,821. I do realize that some countries use , rather than . as a decimal point too but for some reason didn’t take that into consideration.

ah yes I’m really sorry for using a , instead of a .
It’s just so normal for me to use a , rather than a .

The [Current_Level] variable is an int and the experience points variable is a float.