pingcap / pingcap/tidb

TRUNCATE precision differs in TiDB / MySQL 9 compared to MySQL 8

Open
#65,925 2 comments 0 reactions 0 assignees View on GitHub
contribution severity/moderate sig/execution type/bug
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)

SELECT
TRUNCATE(1 * 0.025/365 * 146, 4) AS trunc_result1,
1 * 0.025/365 * 146 AS normal_result1,
1 * 0.025 * 146/365 AS normal_result2;

Image

### 2. What did you expect to see? (Required)
SELECT
TRUNCATE(1 * 0.025/365 * 146, 4)

The result should be 0.0100

### 3. What did you see instead (Required)

0.0099

### 4. What is your TiDB version? (Required)

v8.5.3

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.