Results 1 to 4 of 4

Thread: float4

  1. #1
    Join Date
    Apr 2007

    Unanswered: float4

    I'm just looking through my lecture notes to finish off my assignment and have noticed something in the notes - float4.
    I can't find an explanation of what it is/does in them and I don't have my books with me at the moment. Can someone tell me what float4 is and what it does please?

  2. #2
    Join Date
    Jan 2007
    Jena, Germany
    Guessing from the name, it may be a data type. But there is no FLOAT4 in SQL - neither a data type with that name nor anything else is named that way in the standard.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Apr 2002
    Toronto, Canada
    Quote Originally Posted by the_mysql_manual


    A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display width and number of decimals are undefined. As of MySQL 3.23, this is a true floating-point value. In earlier MySQL versions, FLOAT(p) always has two decimals. This syntax is provided for ODBC compatibility. Using FLOAT might give you some unexpected problems because all calculations in MySQL are done with double precision.
    helps? | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Sep 2004

    float-4 versus float-8

    I'd think the "4" refers to the storage length in bytes.
    As opposed to the other two often used, viz. "float-8" and "float-16". (The latter is e.g. available in the C and C++ programming languages.)
    I believe that most relational systems use the term "FLOAT" or "REAL" for float-4, and the term "DOUBLE" for float-8.
    Since typically 3 of the 4 bytes are used for the mantissa and 1 for the exponent and the signs, a quick calculation shows that the precision of a float-4 will be about 7 digits (24 bits), while for a float-8 it will be about 14 digits (48 bits).
    If I'm not mistaken, the mySQL "p" refers to the number of bits in the precision; hence a FLOAT (or float-4) is most often a FLOAT(24), while a DOUBLE (or float-8) is most often a FLOAT(48).
    Last edited by Peter.Vanroose; 05-05-07 at 07:13.
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts