C# Floating Point Variable Types - dummies

C# Floating Point Variable Types

By Bill Sempf, Charles Sphar, Stephen R. Davis

Part of C# 2010 All-In-One For Dummies Cheat Sheet

C# floating point variables come in two types: float and double. The following table compares these two types in terms of size, range, and accuracy.

Type Size (bytes) Range Accuracy In Use
float 8 1.5 x 10–45 to 3.4 x 1038 6–7 digits float f = 1.2F;
double 16 5.0 x 10–324 to 1.7 x 10308 15–16 digits double d = 1.2;