Tuesday, June 25, 2024 20:34

Table of contents >> Introduction > Double variable type

Double variable type

C# compiler allocates 64 bits (8 bytes) to store a double variable type. For reference, a double variable type can keep values with a precision of 14 or 15 digits, in the interval between 1.7E-308 and 1.7E+308.

You should know that the float and the double variable types are floating binary point types. In other words, they represent a number like this:

The binary number and the location of the binary point are both encoded within the value.

Decimal (of which we will discuss in the next lesson) is a floating decimal point type. In other words, they represent a number like this:
The following image illustrates the representation of a double variable type:

double variable type
Additional Information

This section, as many others that will follow, represents real numbers using scientific notation. This system allows to represent any number utilizing a single digit to the left of the point, an unlimited number of digits to the right of the point, and an exponent using a power of 10. When you calculate the real value of the number, multiply the number (mantissa) with the value of 10 to the power (where x represents the exponent). For instance, number 3.1415967E+7 equals to 31415967.0, or 3.1415967 * 107.

The concepts explained in this lesson are also shown visually as part of the following video:

Tags: , ,

Leave a Reply

Follow the white rabbit