double Versus decimal - CSharp Language Basics

CSharp examples for Language Basics:double

Introduction

double is useful for scientific computations.

decimal is useful for financial computations.

Here's a summary of the differences:

Category double decimal
Internal representation Base 2 Base 10
Decimal precision 15-16 significant figures 28-29 significant figures
Range +/-(~10-324 to ~10308) +/-(~10-28 to ~1028)
Special values +0, -0, +Infinity, -Infinity, and NaN None
Speed Native to processor Non-native to processor (about 10 times slower than double)

Related Tutorials