Hi Alex,

On Thu, 10 Jan 2013 16:17:06 +0000
Alex Brelsfoard <[email protected]> wrote:

> Nevermind... Sorry... Turned out to be a JS problem actually.... parseInt
> vs parseFloat....
> 
> Ugh.
> 
> 
> On Thu, Jan 10, 2013 at 4:06 PM, Alex Brelsfoard
> <[email protected]>wrote:
> 
> > Hi All,
> >
> > I am working on a custom shopping basket, and using Template to multiple
> > the quantity of each item by its base price, and then also summing it.
> > But I'm losing the floating points.  It's coming out as flat INTs.
> >
> > Any idea of how to fix this?
> >
> > Thanks in advance.
> >
> > --Alex
> >
> 

I'm glad you got your problem sorted out, but note that you should note use
the built-in floating-point arithmetics for currency. See:

* https://metacpan.org/release/Math-Currency

* http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html - “What Every
Computer Scientist Should Know About Floating-Point Arithmetic”.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://shlom.in/humanity

<Botje>  Khisanth =~ s/must sleep/must give Botje all my money/ .
    — Freenode’s #perl

Please reply to list if it's a mailing list post - http://shlom.in/reply .

_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to