Difference between revisions of "Double"
esse quam videri
Line 7: | Line 7: | ||
=Explanation= | =Explanation= | ||
Doubles can be used for arithmetic expressions such as addition, multiplication, division in programming. | Doubles can be used for arithmetic expressions such as addition, multiplication, division in programming. | ||
+ | |||
+ | |||
+ | <syntaxhighlight lang ="csharp"> | ||
+ | double a = 5; | ||
+ | double b = 2.5; | ||
+ | double result1, result2, result3; // You can also declare several variables of the same type this way. | ||
+ | |||
+ | result1 = a + b; // result1 = 7.5 | ||
+ | result2 = a * b; // result = 12.5 | ||
+ | result3 = a / b; // result3 = 2; | ||
+ | </syntaxhighlight> | ||
Revision as of 19:01, 16 July 2019
Contents
Definition
A double is a data type. It is a floating-point number that has 64 bits of space.
Relevance
Doubles are commonly used for large numbers in programming. Being floating-point numbers, doubles can hold decimal precision.
Explanation
Doubles can be used for arithmetic expressions such as addition, multiplication, division in programming.
double a = 5;
double b = 2.5;
double result1, result2, result3; // You can also declare several variables of the same type this way.
result1 = a + b; // result1 = 7.5
result2 = a * b; // result = 12.5
result3 = a / b; // result3 = 2;