[Bug]: long double number lost precision
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Environment
- Version or commit-id (e.g. v0.1.0 or 8b23a93):
- Hardware parameters:
- OS type:
- Others:
Actual Behavior
mysql> select 9999999999999999999999999999.9999999999; +-----------------------------------------+ | 9999999999999999999999999999.9999999999 | +-----------------------------------------+ | 10000000000000000000000000000 | +-----------------------------------------+ 1 row in set (0.01 sec)
Expected Behavior
mysql> select 9999999999999999999999999999.9999999999; +-----------------------------------------+ | 9999999999999999999999999999.9999999999 | +-----------------------------------------+ | 9999999999999999999999999999.9999999999 | +-----------------------------------------+
MySQL, PG, MS SQL, Snowflake all perform this way.
Steps to Reproduce
No response
Additional information
If the precision overflows the floating number, Parser should convert it to decimal. In 0.5.0, the decimal only support up to 38 digits. In 0.6.0, the decimal precision needs to be expanded.
At present, in 0.6, even if '9999999999999999999999999999999.999999999999' is converted to decimal128, data truncation errors still occur,Therefore, the precision of 9999999999999999999999999999999.999999999999 cannot be guaranteed now
@qingxinhome @dengn pls update status
The current version cannot be solved temporarily
The current version cannot be solved temporarily
The current version cannot be solved temporarily
Not resolved yet
Not resolved yet
Not resolved yet
Not resolved yet
Decimal will handle 38 digits after refactor.
Wait for decimal rewriting
No progress today
@zengyan1 is working on it
fixed
fixed.
MO: mysql> select 9999999999999999999999999999.9999999999; +-----------------------------------------+ | 9999999999999999999999999999.9999999999 | +-----------------------------------------+ | 9999999999999999999999999999.9999999999 | +-----------------------------------------+ 1 row in set (0.01 sec)