[MDEV-30546] The representation of 0 in division function in computing string Created: 2023-02-02 Updated: 2023-02-02 Resolved: 2023-02-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data types |
| Affects Version/s: | 10.9.4 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | 王瑞丰 | Assignee: | Sergei Golubchik |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
mariadb docker |
||
| Issue Links: |
|
||||||||
| Description |
|
When we use the division function to calculate, we find that if there is a negative number type string, the result will be inconsistent with the expectation select 0/-4; – actual: 0.0000, expect: 0 MySQL has verified this as a bug. please see https://bugs.mysql.com/bug.php?id=109837. so I consider it also a bug for mariadb. |
| Comments |
| Comment by Sergei Golubchik [ 2023-02-02 ] | ||
|
It's partially "not a bug" and partially a duplicate.
both results are of DECIMAL type, @@div_precision_increment applies.
the result is DOUBLE with not fixed precision, so it's printed as 0. Negative zero is MDEV-6856 | ||
| Comment by Sergei Golubchik [ 2023-02-02 ] | ||
|
I'm closing it as "not a bug" because the main complain is (it's clearer in MySQL bug report) that "We believe that 0 and '0' can be regarded as the same during type conversion". |