pingcap / pingcap/tidb

The boundary value of the float data type is not displayed correctly

Open
#42,219 1 comment 0 reactions 1 assignee Claimed by @CbcWestwolf View on GitHub
severity/moderate sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report
In TiDB, the default precision of the FLOAT data type is 8 digits,so when I input a float with more than 8 digits, I should get a result that truncates the float to the remaining 8 digits.
reference: https://docs.pingcap.com/tidb/stable/data-type-numeric#float-type

### 1. Minimal reproduce step (Required)
create table t (a float);
insert into t values(111.111111);
select * from t;

### 2. What did you expect to see? (Required)
+------------+
| a |
+------------+
| 111.11111 |
+------------+
### 3. What did you see instead (Required)
+------------+
| a |
+------------+
| 111.111115 |
+------------+
### 4. What is your TiDB version? (Required)
4.0.16、5.4.1、6.5.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.