[Lazarus] Problem rounding values at post
zeljko
zeljko at holobit.net
Wed Jun 4 11:08:15 CEST 2014
On 06/04/2014 10:43 AM, Mattias Gaertner wrote:
> On Wed, 04 Jun 2014 15:47:24 +0800
> "Allan E. Registos" <allan.registos at smpc.steniel.com.ph> wrote:
>
>> On Wednesday, 04 June, 2014 06:03 AM, Philippe wrote:
>>>
>>> generally, if one needs accurate values he does not use real values
>>> ... use integer (or word, longint, longword etc) ... then when needed
>>> make the conversion or formating (for computing or printing) ...
>>>
>> My thinking is quite the opposite. I am not a mathematician though. :)
>> What if we need a high degree of precision in our computation? So we
>> need this type of figure: #####.##### the more precision(accuracy) we
>> need, the more digits
>
> If you need 5 digits, i.e. decimals: multiply by 100.000 when
> storing and divide by 100.000 when loading the value.
> Computers work on binary numbers and decimal 1.2 (= 1+2/10) has no exact
> representation in binary.
That's why numeric type is used. Saving field as integer and divide it
while loading is stupid if you have correct numeric type in db.
zeljko
More information about the Lazarus
mailing list