float vs double in c#

float vs double in c#

 

Difference between decimal, float and double in .NET?
 


Main difference.

Float - 7 digits (32 bit)

Double-15-16 digits (64 bit)

Decimal -28-29 significant digits (128 bit)

 

Float

It is used mostly in graphic libraries because very high demands for processing powers, also used situations that can endure rounding errors.

 

Decimal

In case of financial applications it is better to use Decimal types because it gives you a high level of accuracy and easy to avoid rounding errors

 

Double

Double Types are probably the most normally used data type for real values, except handling money.

2021-10-03