[Lazarus] Problem rounding values at post

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Jun 4 10:43:39 CEST 2014


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.


Mattias




More information about the Lazarus mailing list