Double vs Decimal

The double type is 64 bit floating point value. The range of values is from ±5.0 × 10−324 to ±1.7 × 10308 with 15-16 digits for its precision. On other hand the decimal value is 128 bit data type. The range of values is from ±1.0 × 10−28 to ±7.9 × 1028 with 28-29 significant digits for precision. So the decimal type is smaller but more accurate that makes it ideal for financial calculations.

Also very helpful to see how you can map SQL and CLR types between each other here:

http://msdn.microsoft.com/en-us/library/bb386947.aspx

Advertisements
This entry was posted in .NET, C#, T-SQL. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s