| Bug #79925 | String const '69E5' is not treated as scientific notation when casting to int | ||
|---|---|---|---|
| Submitted: | 12 Jan 2016 8:07 | Modified: | 12 Jan 2016 9:35 |
| Reporter: | Su Dylan | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.7.8, 5.5.48, 5.6.28, 5.7.10 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[12 Jan 2016 9:35]
MySQL Verification Team
Hello Su Dylan, Thank you for the report and test case. Observed that 5.5.48/5.6.28/5.7.10 are affected. Thanks, Umesh
[10 Apr 2023 2:40]
dick Dick
As far as I know, string->int it's going to look for the first number until it hits a non-number and then cast those numbers as the result. Change signed to double or float results in 6900,000. So these are two different conversion strategies

Description: Output: ===== mysql> select cast('69E5' as decimal ), cast('69E5' as signed); +--------------------------+------------------------+ | cast('69E5' as decimal ) | cast('69E5' as signed) | +--------------------------+------------------------+ | 6900000 | 69 | +--------------------------+------------------------+ 1 row in set, 1 warning (0.00 sec) mysql> select version(); +-----------+ | version() | +-----------+ | 5.7.8-rc | +-----------+ 1 row in set (0.00 sec) Problem: ===== "cast('69E5' as signed) " is expected to return 6900000 How to repeat: select cast('69E5' as decimal ), cast('69E5' as signed); Suggested fix: 690000 is returned for 'cast('69E5' as signed) '.