Float, Double, and Decimal in C#

Comparison of Float, Double, Decimal in C# (SO)

Name Digits Bits Precision/Accuracy Speed
Float 7 digits 32 bit lower faster
Double 15-16 digits 64 bit lower faster
Decimal 28-29 significant digits 128 bit higher slower


float flt = 1F/3;
double db = 1D/3;

decimal dcm = 1M/3;

var equal = db == dcm; //Needs a cast
var equal = db == flt; //Does not need a cast