Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Casting (float) everywhere in C#. Is it better to just work in doubles?

Working on an XNA game, I'm using float for most of my number values. Most C# functions seem to input/output doubles so I'm writing (float) a lot. Should I just be using Doubles or is how I'm working OK?

like image 308
Iain Avatar asked Nov 24 '10 10:11

Iain


1 Answers

You should be using doubles. They are more accurate than single precision floats and there will be an overhead for casting.

like image 126
ChrisF Avatar answered Sep 28 '22 05:09

ChrisF