I have always found that the best way to deal with money is to use
cents rather than dollars. ie. if you have $0.02 then you have 2c and
arithmetic always works with integers. It dispenses with all kinds of
problems and makes things a lot easier. Just format your output in the
correct way as and when you need it.

That's my 2c worth. :)

Cheers,
Andy

On 2 January 2013 03:04, Kevin Purnelle <[email protected]> wrote:
> Thank you for providing insight :) and Happy new year :)
>
>
> On Monday, 31 December 2012 18:58:54 UTC+1, Mark Hahn wrote:
>>
>> In general you can think of js numbers as integers or floats, assuming you
>> need less than the 56 bits of resolution.  A common misconception is that
>> floating point numbers have some sort of built-in inaccuracy.  It took me a
>> while to quit worrying about it.
>>
>> I even send numbers to jquery/DOM with things like the .0000004 present.
>> It wastes some characters when serializing but that isn't a big problem in
>> the overall scheme of things.
>>
>>
>> On Mon, Dec 31, 2012 at 9:52 AM, Kevin Purnelle <[email protected]>
>> wrote:
>>>
>>> Ok thank you, this was my real concern, if repeated imprecision in
>>> operations could lead to inconsistency after some time. :)
>>>
>>> On Monday, 31 December 2012 18:35:41 UTC+1, Mark Hahn wrote:
>>>>
>>>> Just chain using all floats and use toFixed at the end.  Floating points
>>>> have all the resolution you need.  It doesn't hurt for 0.000004 to hang
>>>> around during the intermediate calculations.
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>>
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en



-- 
Andrew Chilton
e: [email protected]
w: http://appsattic.com/
t: https://twitter.com/andychilton
p: +64 21 891 681

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to