My code to get the correct result for powers calculation in Unity

void Start()
{
    float numberA = 3 ^ 2;
    float numberB = Mathf.Pow(3, 2);        
Debug.Log("Compare code powers " + " 3^2 = " + numberA + " Mathf.Pow(3,2) = " + numberB);
}

Compare code powers 3^2 = 1 Mathf.Pow(3,2) = 9
UnityEngine.Debug:Log(Object)
MathRoundExperiments:Start() (at Assets/MathRoundExperiments.cs:13)

1 Like

Nice looking code!

Privacy & Terms