O'Reilly logo

MySQL in a Nutshell by Russell J.T. Dyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Approximate Numeric Datatypes

Approximate numeric datatypes store floating-point numbers like fractions where an approximation must be made. For instance, an accurate number, per se, cannot be stored for 1/3, because the decimal point for 3 continues on endlessly. Table A-2 lists approximate numeric datatypes. There are synonyms for a few of these types. DOUBLE and REAL are synonyms for DOUBLE PRECISION. However, if the SQL mode for the server has the REAL_AS_FLOAT option enabled, REAL is a synonym for FLOAT. For FLOAT, a level of precision may be specified. It may be from 0 to 24 for single-precision floating-point numbers and from 25 to 53 for double-precision floating-point numbers. If a precision isn’t given with FLOAT, a single-precision floating point is assumed. With DOUBLE, if UNSIGNED is specified, negative values are not allowed.

Table A-2. Approximate numeric datatypes

FLOAT( precision ) [UNSIGNED] [ZEROFILL]

 

FLOAT[(width,digits)] [UNSIGNED] [ZEROFILL]

 

-3.402823466E+38 to -1.175494351E-38

0

1.175494351E-38 to 3.402823466E+38

DOUBLE PRECISION[(width,digits)] [UNSIGNED] [ZEROFILL]

 

-3.402823466E+38 to -1.175494351E-38

0

1.175494351E-38 to 3.402823466E+38

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required