dolthub / dolthub/dolt

Match MySQL `float64` to `float32` conversion precision loss

Open
#11,801 0 comments 0 reactions 0 assignees View on GitHub
correctness sql
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

MySQL drops more precision for float32 conversions.
Dolt and Postgres:
```
tmp/main*> select cast(20010203123456 as float);
+-------------------------------+
| cast(20010203123456 as float) |
+-------------------------------+
| 2.0010202e+13 |
+-------------------------------+
1 row in set (0.00 sec)
```

MySQL:
```
mysql> select cast(20010203123456 as float);
+-------------------------------+
| cast(20010203123456 as float) |
+-------------------------------+
| 20010200000000 |
+-------------------------------+
1 row in set (0.00 sec)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the SQL CAST example for 20010203123456 and locate the float64-to-float32 conversion path responsible for the result. Add a regression test for the conversion, and consider the work complete when the result matches the expected MySQL precision and the test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.