[fpc-devel] MySQL 5.1 and Double (trouble)

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Mon Jul 11 10:02:00 CEST 2011


Andrew Brunner wrote:
> Can someone check the status of update if the bind parameter for
> double decimal values?
> 
> I'm getting unexpected rounding errors after updating - the data in
> the column looks different than what was specified during the update
> statement.
> 
> Value: double;
> Query.Params.ParamByName(sName).AsFloat:=Value;
> 
> 1.) Update Value                  : 40734.825668912039
> 2.) Actual Value after update :     40734.8256689120
> 3.) Actual Value on read       :    40734.825668912003

Does MySQL come with an "official" program that you can use to run 
queries manually? What happens when you use it to store and retrieve 
that number?

I think that SQL specifies that a double has 53 bits in the mantissa 
which is a bit better than 15 digits which is about what you're seeing.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list