Primitive Data Type - Specific Primitive Data Types - Floating-point Numbers

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:

    All ye poets of the age,
    All ye witlings of the stage,
    Learn your jingles to reform,
    Crop your numbers to conform.
    Let your little verses flow
    Gently, sweetly, row by row;
    Let the verse the subject fit,
    Little subject, little wit.
    Namby-Pamby is your guide,
    Albion’s joy, Hibernia’s pride.
    Henry Carey (1693?–1743)