Floating-point Numbers
A floating-point number represents a limited-precision rational number that may have a fractional part. These numbers are stored internally in a format equivalent to scientific notation, typically in binary but sometimes in decimal. Because floating-point numbers have limited precision, only a subset of real or rational numbers are exactly representable; other numbers can be represented only approximately.
Many languages have both a single precision (often called "float") and a double precision type.
Literals for floating point numbers include a decimal point, and typically use "e" or "E" to denote scientific notation. Examples of floating-point literals are:
- 20.0005
- 99.9
- −5000.12
- 6.02e23
Some languages (e.g., Fortran, Python, D) also have a complex number type comprising two floating-point numbers: a real part and an imaginary part.
Read more about this topic: Primitive Data Type, Specific Primitive Data Types
Famous quotes containing the word numbers:
“I had a feeling that out there, there were very poor people who didnt have enough to eat. But they wore wonderfully colored rags and did musical numbers up and down the streets together.”
—Jill Robinson (b. 1936)