Here, at least for reference, is an exerpt from the RDB documentation.

-----
       SQL provides three floating-point numeric data types:

       o  FLOAT

          Specifies that the column is a 32-bit (REAL) or 64-bit (DOUBLE
          PRECISION) floating-point number, depending on the precision
          indicated in the positive integer (n).  If n is less than 25,
          FLOAT specifies a 32-bit floating-point number. If n is 25 or
          greater, FLOAT specifies a 64-bit floating-point number.

          The maximum value for n is 53. If FLOAT does not include n, it
          specifies a 64-bit floating-point number.

       o  REAL

          Specifies that the column is a 32-bit floating-point number
          with precision to 24 binary digits.

       o  DOUBLE PRECISION

          Specifies that the column is a 64-bit floating-point number
          with precision to 53 binary digits.
-----

-----Original Message-----
From: Peter J. Holzer [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 12:40 AM
To: '[EMAIL PROTECTED]'
Subject: Re: Float vs. double in MySQL


On 2002-03-18 10:47:33 -0500, Jason Erickson wrote:
> are you saying that FLOAT(16,3) is not a valid declaration for Mark's
> 'float_col', or that there's something in MySql that won't do it??

Mark didn't say how he defined the columns exactly, just "float" and
"double", so I assumed that he didn't specify the precision. If you
don't specify the precision, MySQL will store a float as a standard
IEEE-754 single precision floating point number and a double as an
IEEE-754 double precision floating point number.

> I can't find anything in Monty's MySql book (Appendix B, pg. 502) that
> indicates this would be an invalid declaration...

It isn't invalid, but it seems that the manual is misleading here. It
says:

  When the keyword FLOAT is used for a column type without a precision
  specification, MySQL uses four bytes to store the values. 

To me this implies that if you do specify a precision, MySQL chooses an
appropriate longer type (presumably double), but this doesn't seem to be
the case (at least not with 3.23.49, which is what I have here).

        hp

-- 
   _  | Peter J. Holzer      | My definition of a stupid question is
|_|_) | Sysadmin WSR / LUGA  | "a question that if you're embarassed to
| |   | [EMAIL PROTECTED]        | ask it, you stay stupid."
__/   | http://www.hjp.at/   |    -- Tim Helck on dbi-users, 2001-07-30

Reply via email to