© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
95 replies
WaffleDevs

❔ Need Help Understanding Casting

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

Equation:
Mathf.Pow(Math.Max((float)num - 300f, 0f) / 1200f, 2f
Mathf.Pow(Math.Max((float)num - 300f, 0f) / 1200f, 2f

Double:
(double)Mathf.Pow(Math.Max((float)num - 300f, 0f) / 1200f, 2f
(double)Mathf.Pow(Math.Max((float)num - 300f, 0f) / 1200f, 2f

int num = 1272
int num = 1272

Mathf.Pow(float f, float p)
Mathf.Pow(float f, float p)
returns
(float)Math.Pow((double)f, (double)p);
(float)Math.Pow((double)f, (double)p);
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

i need help understanding this
C#CC# / help
2y ago
need help understanding `Task`s
C#CC# / help
3y ago
✅ Need help understanding inheritance with constructors
C#CC# / help
3y ago
✅ I need help understanding this code.
C#CC# / help
3y ago