Bug #13349 CAST(1.0E+300 TO DECIMAL) returns wrong result + diff little/big endian
| Submitted: | 20 Sep 2005 12:56 | Modified: | 3 Nov 2005 8:40 |
|---|---|---|---|
| Reporter: | Matthias Leich | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0 | OS: | |
| Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
[23 Sep 2005 0:01]
Jim Winstead
This likely happens because the route from double to decimal is via sprintf(buf, "%f", double) and then conversion from string to decimal.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Examples: My box (Intel Pentium M -- little endian) SELECT 1.0E+300, CAST(1.0E+300 AS DECIMAL); 1.0E+300 1e+300 CAST(1.0E+300 AS DECIMAL) 803823920273299782054992133678869364753954248541633605124057805104488924519071744 <--- I expect 65 times the digit 9. Warnings: Level Error Code 1292 Message Truncated incorrect DECIMAL value: '' aix52 (PowerPC -- big endian) SELECT 1.0E+300, CAST(1.0E+300 AS DECIMAL); 1.0E+300 1e+300 CAST(1.0E+300 AS DECIMAL) 0 <--- I expect 65 times the digit 9. Warnings: Level Error Code 1292 Message Truncated incorrect DECIMAL value: '' When a value is too big for a certain data type, MySQL tends to return the biggest value of the data type range. I expect 65 times the digit 9. The cast result on my box is big, but not correct. The cast result on aix52 is totally ugly. BTW: INSERT INTO ... <DECIMAL(65) COLUMN>= 1E+300 works like expected on both boxes (gives the truncation warning + 65 times the 9 as result) This bug harms the development of testcases. Currently we have only one file with expected results independend of the processor architecture. My environment: - Intel PC with Linux(SuSE 9.3) - MySQL compiled from source Version 5.0 ChangeSet@1.1980, 2005-09-19 aix52: - PowerPC - Version 5.0 last ChangeSet around 2005-09-13 How to repeat: Please execute the statements above.