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

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jul 11 17:19:48 CEST 2011


Ludo Brands schrieb:
>>> How do you get the 40734.825668912003 value?
>> Fields.FieldByName(Value).AsFloat();
> 
> Floattostr limits precision to 15 digits (40734.8256689120). When updating
> the mysql database it converts the float to a string and looses the last 2
> digits. The last digits are returned by gdb or the str procedure with
> precision >15, but won't be displayed in data controls.

It doesn't make sense to display more digits than stored in the binary 
variable. There is no loss, only rounding errors in the conversion from 
binary to decimal text.

DoDi




More information about the fpc-devel mailing list