[Israel.pm] perl arithmetic

Yuval Kogman lists at woobling.org
Sun Apr 18 07:51:21 PDT 2004


On Sun, Apr 18, 2004 at 17:21:59 +0300, Pinkhas Nisanov wrote:

> > or implement it all in integers, working with the smallest
> > unit possible (like 1000 agoroths =3D=3D 10 nis, and 1010 =3D=3D 10.10).
> > 
> 
> It will not help, because:
> ==> perl -e 'print int 100*4.56, "\n";'
> 455

What I meant was always work with the highest percision you can, using
integer arithmetic, never converting to float, except for formatting
purposes.

BTW:
[eris:~] nothingmuch% perl -e 'print int 100*4.56, "\n";'
456

-- 
 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: Crackers, lick the furniture: neeyah!!!!!!!!!!!!!



More information about the Perl mailing list