As documented under Floating-Point Types (Approximate Value) - FLOAT, DOUBLE:
MySQL performs rounding when storing values, so if you insert 999.00009 into a FLOAT(7,4) column, the approximate result is 999.0001.
Because floating-point values are approximate and not stored as exact values, attempts to treat them as exact in comparisons may lead to problems. They are also subject to platform or implementation dependencies. For more information, see Section C.5.5.8, “Problems with Floating-Point Values”
For maximum portability, code requiring storage of approximate numeric data values should use FLOAT or DOUBLE PRECISION with no specification of precision or number of digits.
Therefore, upon inserting 1.8 into your database, MySQL rounded the literal to 001.8000 and encoded the closest approximation to that number in binary32 format: i.e. 0x3FE66666, whose bits signify:
Sign : 0b0
Biased exponent: 0b01111111
= 127 (representation includes bias of +127, therefore exp = 0)
Significand : 0b[1.]11001100110011001100110
^ hidden bit, not stored in binary representation
= [1.]7999999523162841796875
This equates to:
(-1)^0 * 1.7999999523162841796875 * 2^0
= 1.7999999523162841796875
This is the value that is returned by MySQL to the client. It would appear that AdoDB then inspected the column's datatype and rounded the result accordingly, whereas PDO does not.
If you want exact values, you should use a fixed point datatype, such as DECIMAL.
PDO::ATTR_EMULATE_PREPARESsetting, but I still get eitherfloat(18)orstring(7) "18.0000":-?