MySQL seems to support double precision
The
FLOAT
andDOUBLE
types represent approximate numeric data values. MySQL uses four bytes for single-precision values and eight bytes for double-precision values.
Is there a method to declare that a literal is a double precision
and not a float
, decimal
or anything else? I don't see this mentioned in the docs on Numeric Literals. In PostgreSQL, I could coerce a literal to a double precision
with
SELECT 1::double precision,
double precision '1',
CAST(1 AS double precision);
Best Answer
Though not in the docs explicitly on Numeric Literals. You can make a
double precision
literal with scientific notation (usinge0
) which seems to work,This is actually supported by the SQL Spec, which shifts the literal from
<exact numeric literal>
to<approximate numeric literal>
when it sees thee
orE
. From SQL 2011n spec,This is what the docs on Numeric Literals presumably refer to when it says,
Though the docs don't say the type, it's
double
(see above).See also,