C#C
C#3y ago
WaffleDevs

❔ Need Help Understanding Casting

I have an equation that returns a float of value 0.6561f. When i cast it to a double, it turns into 0.6560999751091003d. I don't understand why.

Equation: Mathf.Pow(Math.Max((float)num - 300f, 0f) / 1200f, 2f
Double: (double)Mathf.Pow(Math.Max((float)num - 300f, 0f) / 1200f, 2f
int num = 1272
Mathf.Pow(float f, float p) returns (float)Math.Pow((double)f, (double)p);
Was this page helpful?