0.30000000000000004
0.30000000000000004 copied to clipboard
MYSQL FLOAT
Perhaps this example could explain.
CREATE TABLE test
(fla
FLOAT,flb
FLOAT,dba
DOUBLE(10,2),dbb
DOUBLE(10,2));
We have a table like this:
+-------+-------------+ | Field | Type | +-------+-------------+ | fla | float | | flb | float | | dba | double(10,2)| | dbb | double(10,2)| +-------+-------------+ For first difference, we try to insert a record with '1.2' to each field:
INSERT INTO test
values (1.2,1.2,1.2,1.2);
The table showing like this:
SELECT * FROM test
;
+------+------+------+------+ | fla | flb | dba | dbb | +------+------+------+------+ | 1.2 | 1.2 | 1.20 | 1.20 | +------+------+------+------+ See the difference?
We try to next example:
SELECT fla+flb, dba+dbb FROM test
;
Hola! We can find the difference like this:
+--------------------+---------+ | fla+flb | dba+dbb | +--------------------+---------+ | 2.4000000953674316 | 2.40 | +--------------------+---------+
Source: https://stackoverflow.com/a/28511784/676479