Hi,
I have a MySQL table, created by reading in the contents of a file and inserting them into the table.
I have been using the decimal(n, d) data type in order to record the numbers, however the numbers I read in from the file are in e.g. 1.00053E+20 format.
MySQL seems to have a problem reading in these numbers, is there anything I can do? And for the above number would decimal(1,20) work?
Many thanks
Mark
Number formats in MySQL
Moderator: General Moderators
According to this manual, M is minimum number of characters used in string representation of the number, D is number of decimals stored after the mantissa is normalized. Following your example (100003400000000000):MySQL manual wrote: DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]
A normal-size (double-precision) floating-point number. Allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308. If UNSIGNED is specified, negative values are disallowed. M is the display width and D is the number of decimals. DOUBLE without arguments or FLOAT(p) (where p is in the range from 25 to 53) stands for a double-precision floating-point number.
- First step is to normilize the mantissa: 1.000034
- Due to the decimal dot has been moved 17 positions to the left, exponent is 17
- Hence the number is represented as 1.000034E+17