Difference between revisions of "Double"

esse quam videri
Jump to: navigation, search
 
(5 intermediate revisions by 2 users not shown)
Line 3: Line 3:
  
 
=Relevance=
 
=Relevance=
Doubles are commonly used for large numbers in programming. They can also hold a useful amount of decimal precision
+
Doubles are commonly used for large numbers in programming. Being floating-point numbers, doubles can hold decimal precision.
  
 
=Explanation=
 
=Explanation=
 +
Doubles can be used for arithmetic expressions such as addition, multiplication, division in programming. It is functionally similar to a float data type, however, it can hold twice as much data. This means that the numbers used in a double can be twice as large or twice as accurate as that of a float.
  
  
 +
<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; // result2 = 12.5
 +
result3 = a / b; // result3 = 2;
 +
</syntaxhighlight>
  
=Resources=
 
 
== See also ==
 
== See also ==
 
*[[Variable]]
 
*[[Variable]]
Line 15: Line 24:
 
* [[SQL Data Types]]
 
* [[SQL Data Types]]
 
* [[.NET Data Types]]
 
* [[.NET Data Types]]
 
==Notes==
 
  
  
==External Links==
 
  
  

Latest revision as of 15:58, 8 August 2019

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. It is functionally similar to a float data type, however, it can hold twice as much data. This means that the numbers used in a double can be twice as large or twice as accurate as that of a float.


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; // result2 = 12.5
result3 = a / b; // result3 = 2;

See also