Bug #72100 0.00000000042 MOD 10 = 0.42000000000
Description:
SELECT 0.00000000042 mod 1;
+---------------------+
| 0.42000000000 |
+---------------------+
SELECT 0.000000000123 mod 0.000000000030;
+-----------------------------------+
| 0.003000000000 |
+-----------------------------------+
These are the right answers, but all multiplied by 1e9. (This is not completely surprising if you know how MySQL represents decimals internally.)
Anything with 0 through 8 leading zeros works fine; the bug starts at 9 leading zeros. There are discontinuities at 17, 26, 35,... leading zeros where sanity is briefly restored.
How to repeat:
create table t (id serial, d decimal(65,30));
insert into t values (),(),(),(),(),(),(),(),();
insert into t values (),(),(),(),(),(),(),(),();
insert into t values (),(),(),(),(),(),(),(),();
update t set d = concat('1e-', id);
select d, d mod 1 from t;
+----------------------------------+----------------------------------+
| d | d mod 1 |
+----------------------------------+----------------------------------+
| 0.100000000000000000000000000000 | 0.100000000000000000000000000000 |
| 0.010000000000000000000000000000 | 0.010000000000000000000000000000 |
| 0.001000000000000000000000000000 | 0.001000000000000000000000000000 |
| 0.000100000000000000000000000000 | 0.000100000000000000000000000000 |
| 0.000010000000000000000000000000 | 0.000010000000000000000000000000 |
| 0.000001000000000000000000000000 | 0.000001000000000000000000000000 |
| 0.000000100000000000000000000000 | 0.000000100000000000000000000000 |
| 0.000000010000000000000000000000 | 0.000000010000000000000000000000 |
| 0.000000001000000000000000000000 | 0.000000001000000000000000000000 |
| 0.000000000100000000000000000000 | 0.100000000000000000000000000000 |
| 0.000000000010000000000000000000 | 0.010000000000000000000000000000 |
| 0.000000000001000000000000000000 | 0.001000000000000000000000000000 |
| 0.000000000000100000000000000000 | 0.000100000000000000000000000000 |
| 0.000000000000010000000000000000 | 0.000010000000000000000000000000 |
| 0.000000000000001000000000000000 | 0.000001000000000000000000000000 |
| 0.000000000000000100000000000000 | 0.000000100000000000000000000000 |
| 0.000000000000000010000000000000 | 0.000000010000000000000000000000 |
| 0.000000000000000001000000000000 | 0.000000000000000001000000000000 |
| 0.000000000000000000100000000000 | 0.000000000100000000000000000000 |
| 0.000000000000000000010000000000 | 0.000000000010000000000000000000 |
| 0.000000000000000000001000000000 | 0.000000000001000000000000000000 |
| 0.000000000000000000000100000000 | 0.000000000000100000000000000000 |
| 0.000000000000000000000010000000 | 0.000000000000010000000000000000 |
| 0.000000000000000000000001000000 | 0.000000000000001000000000000000 |
| 0.000000000000000000000000100000 | 0.000000000000000100000000000000 |
| 0.000000000000000000000000010000 | 0.000000000000000010000000000000 |
| 0.000000000000000000000000001000 | 0.000000000000000000000000001000 |
+----------------------------------+----------------------------------+
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.051 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: SELECT 0.00000000042 mod 1; +---------------------+ | 0.42000000000 | +---------------------+ SELECT 0.000000000123 mod 0.000000000030; +-----------------------------------+ | 0.003000000000 | +-----------------------------------+ These are the right answers, but all multiplied by 1e9. (This is not completely surprising if you know how MySQL represents decimals internally.) Anything with 0 through 8 leading zeros works fine; the bug starts at 9 leading zeros. There are discontinuities at 17, 26, 35,... leading zeros where sanity is briefly restored. How to repeat: create table t (id serial, d decimal(65,30)); insert into t values (),(),(),(),(),(),(),(),(); insert into t values (),(),(),(),(),(),(),(),(); insert into t values (),(),(),(),(),(),(),(),(); update t set d = concat('1e-', id); select d, d mod 1 from t; +----------------------------------+----------------------------------+ | d | d mod 1 | +----------------------------------+----------------------------------+ | 0.100000000000000000000000000000 | 0.100000000000000000000000000000 | | 0.010000000000000000000000000000 | 0.010000000000000000000000000000 | | 0.001000000000000000000000000000 | 0.001000000000000000000000000000 | | 0.000100000000000000000000000000 | 0.000100000000000000000000000000 | | 0.000010000000000000000000000000 | 0.000010000000000000000000000000 | | 0.000001000000000000000000000000 | 0.000001000000000000000000000000 | | 0.000000100000000000000000000000 | 0.000000100000000000000000000000 | | 0.000000010000000000000000000000 | 0.000000010000000000000000000000 | | 0.000000001000000000000000000000 | 0.000000001000000000000000000000 | | 0.000000000100000000000000000000 | 0.100000000000000000000000000000 | | 0.000000000010000000000000000000 | 0.010000000000000000000000000000 | | 0.000000000001000000000000000000 | 0.001000000000000000000000000000 | | 0.000000000000100000000000000000 | 0.000100000000000000000000000000 | | 0.000000000000010000000000000000 | 0.000010000000000000000000000000 | | 0.000000000000001000000000000000 | 0.000001000000000000000000000000 | | 0.000000000000000100000000000000 | 0.000000100000000000000000000000 | | 0.000000000000000010000000000000 | 0.000000010000000000000000000000 | | 0.000000000000000001000000000000 | 0.000000000000000001000000000000 | | 0.000000000000000000100000000000 | 0.000000000100000000000000000000 | | 0.000000000000000000010000000000 | 0.000000000010000000000000000000 | | 0.000000000000000000001000000000 | 0.000000000001000000000000000000 | | 0.000000000000000000000100000000 | 0.000000000000100000000000000000 | | 0.000000000000000000000010000000 | 0.000000000000010000000000000000 | | 0.000000000000000000000001000000 | 0.000000000000001000000000000000 | | 0.000000000000000000000000100000 | 0.000000000000000100000000000000 | | 0.000000000000000000000000010000 | 0.000000000000000010000000000000 | | 0.000000000000000000000000001000 | 0.000000000000000000000000001000 | +----------------------------------+----------------------------------+