Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

C Sharp double: Difference between revisions

From Coderwiki
new: info, size, example
 
(No difference)

Latest revision as of 08:34, 19 August 2025

The double class in C Sharp is a data type which can store positive and negative decimal numbers in variables.

See Floating point for generic information about what doubles can represent and how they are represented in memory.

A double in C# is represented by 8 bytes, or 64 bits.

They are usually accurate up to around 15 digits.

If you need less precision or don't need very large/small numbers, you can instead use the float data type.

double a;
double b = 539.72;
double c = (double)781; // 781.0