|
From: Francois G. <fg...@ya...> - 2001-09-11 00:25:59
|
Hello,
Using floating point numbers in an accounting context is not optimal, and
some random bugs will appear from time to time. Personally, I have 0.01 baht
(currency in thailand, makes 0.0002 USD) sitting idle in credit of the
account receivable, following such rounding problems. Try to explain THAT to
an average financial controller...
There is a module at CPAN, Math::Currency, which address that issue by
creating a new class of numbers and providing overloaded operators so that
the actual code may run with minimal modifications.
Francois
PS: I'm new to accounting (I used to _hate_ accountants), and very, very
pleased to have found sql-ledger which "opened my eyes" ;-)
On Tuesday 11 September 2001 05:31, you wrote:
> Dieter Simader wrote:
> > This error is caused by how numbers are processed by your computer.
> > Somewhere along the line your machine thinks that the result of adding
> > 11.86 and 1.19 is 13.050000000001 and not 13.05 IMHO this should not
> > happen but apparently it does.
> >
> > The workaround. In GL.pm add the following before line 77
> >
> > $debit = sprintf("%.2f", $debit);
> > $credit = sprintf("%.2f", $credit);
>
> Should this be included in all future versions? And are there any other
> places where it may be necessary?
>
> Adrian
|