What about rounding? Do you round all values after every operation? How do 
you do that?

I mean, if there is 10 dollars to be evenly split between three people, one 
of them must receive $3.3334, and two others must receive $3.3333 (all 
banks I know of work with 1/100 of a cent). Otherwise money will not add 
up, and manager will be mad. If you're working with integers, it comes 
almost naturally because you know a priori you can't really divide evenly. 
But with floats it could be a different story.


On Friday, May 24, 2013 10:41:49 PM UTC+4, Mark Hahn wrote:
>
> > Which is okay for most use cases but not, say, when you are processing 
> monetary transactions.
>
> This is somewhat of a myth.  People are afraid of floating point numbers 
> because they are somehow "imprecise".  In fact, up to around 50 bits they 
> are as precise as integers.  I've used them for money many times.  It is as 
> simple as keeping the units in pennies.
>

-- 
-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to