[Lazarus] FloatToStrIntl

Pavel Řezníček cigydd at gmail.com
Sat Sep 13 14:49:14 CEST 2008


Michael Van Canneyt napsal(a):
> On Sat, 13 Sep 2008, Pavel Řezníček wrote:
>
>   
>> Hello all,
>>
>> On Lazarus v0.9.25 r16541 i386-win32-win32/win64, I have the following 
>> problem.
>>
>> I access an SQLite3 database. There I have a column defined as 
>> numeric(3), it means, 3 whole number digits and no decimal places. The 
>> table has to be synchronised with PostgreSQL using the same table name 
>> and column names. Therefore the column definition is simply taken from 
>> the PostgreSQL definition.
>>
>> The data is maybe stored correctly in the database but when I call the 
>> AsString property on that field, I don't get e. g. '14' as expected but 
>> '0,0014'.
>>     
>
> And this is correct. 
>
> The string is formatted according to the default float format. 
> The underlying data format is not relevant. If you want this,
> set the DisplayFormat property to something FormatFloat understands.
> (I suppose '000')
>
> Michael.
OK, that's what I wanted to know and thank you for your help, Michaël.

Still, excuse me for my newbie-fashioned question:

What does that '0,0014' mean? Does it mean 0.0014 in Pascal notation? If 
yes, why?
I suppose it's divided by 10 thousands. Why? Are you saying that the 
default float format divides numbers by 10 000? Strange to me ... though 
respectable.

Another point: Shouldn't the AsString property try to respect the 
underlying format? I know that SQLite is pretty "guessing" the type and 
format but still think that the way the field is defined should be of 
some revelance... Could we call this a feature request? :-)

Pavel



More information about the Lazarus mailing list