MySQL Tutorial/Data Types/FLOAT

Материал из SQL эксперт
Версия от 09:53, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]

A small (single-precision) floating-point number.

Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38.

M is the total number of digits.

D is the number of digits following the decimal point.

If M and D are omitted, values are stored to the limits allowed by the hardware.

A single-precision floating-point number is accurate to approximately 7 decimal places.

10. 11. FLOAT 10. 11. 1. <A href="/Tutorial/MySQL/0200__Data-Types/FLOATpUNSIGNEDZEROFILL.htm">FLOAT(p) [UNSIGNED] [ZEROFILL]</a> 10. 11. 2. FLOAT[(M,D)] [UNSIGNED] [ZEROFILL] 10. 11. 3. <A href="/Tutorial/MySQL/0200__Data-Types/Forfloatingpointvaluesresultsareinexact.htm">For floating-point values, results are inexact:</a>

FLOAT(p) [UNSIGNED] [ZEROFILL]

A floating-point number.

p represents the precision in bits.

If p is from 0 to 24, the data type becomes FLOAT with no M or D values.

If p is from 25 to 53, the data type becomes DOUBLE with no M or D values.

10. 11. FLOAT 10. 11. 1. FLOAT(p) [UNSIGNED] [ZEROFILL] 10. 11. 2. <A href="/Tutorial/MySQL/0200__Data-Types/FLOATMDUNSIGNEDZEROFILL.htm">FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]</a> 10. 11. 3. <A href="/Tutorial/MySQL/0200__Data-Types/Forfloatingpointvaluesresultsareinexact.htm">For floating-point values, results are inexact:</a>

For floating-point values, results are inexact:

mysql>
mysql> SELECT .1E0 + .2E0 = .3E0;
+--------------------+
| .1E0 + .2E0 = .3E0 |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)
mysql> SELECT .1 + .2 = .3;
+--------------+
| .1 + .2 = .3 |
+--------------+
|            1 |
+--------------+
1 row in set (0.00 sec)
mysql>