Float calculate result changes when adding brakets
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
initialize
```
create table t0 (a decimal(5,3));
insert into t0 values(0);
insert into t0 values(0.001);
```
then execute queries below:
```
select * from t0 where a=0+1e-1-1e-1; -- return 0
select * from t0 where a=0.001+1e-1-1e-1; -- named q1
select * from t0 where a=0.001+(1e-1-1e-1); -- named q2
```
### 2. What did you expect to see? (Required)
The results of q1 and q2 are the same: return 0.001.
### 3. What did you see instead (Required)
q1 returns empty set; q2 returns 0.001.
Since it acts as MySQL, I'm not sure whether it's expected. But I think it's confusing.
### 4. What is your TiDB version? (Required)
Release Version: v6.5.0
Edition: Community
Git Commit Hash: 706c3fa3c526cdba5b3e9f066b1a568fb96c56e3
Git Branch: heads/refs/tags/v6.5.0
UTC Build Time: 2022-12-27 03:50:44
GoVersion: go1.19.3
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
Contributor guide
Assessment
This issue has not been assessed yet.