[Lazarus] Problem rounding values at post

Allan E. Registos allan.registos at smpc.steniel.com.ph
Thu Jun 5 01:30:32 CEST 2014


On Wednesday, 04 June, 2014 04:43 PM, 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.
Okay. So, my confusion starts with what the data type the DB recommends
when precision is needed and the data type built with Lazarus/fpc.  If
accuracy and decimals are needed, one must use in Lazarus Integer, and
deal with the digits with another integer and merge it as one data type
and becomes numeric for storing at the DB side?

Or anyway, as Joost mentioned in his post, one must deal with a
TBCDField to read the input values if Zeos provided this correctly.

>
>
> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4267 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140605/24476be5/attachment-0003.bin>


More information about the Lazarus mailing list