this a weakness of javascript, there is no decimal type. but as Kevin
pointed out there are several libraries.

One of the most complete I have seen so far is BigNumber (in npm is
bignumber.js):

https://github.com/MikeMcl/bignumber.js

I have never used though


2012/12/28 Kevin Purnelle <[email protected]>

> Hello,
>
> I am building my first app with nodeJS and I am very excited about
> everything I have been learning with nodejs until now.
> My concerns are about numbers, which can't be represented precisely with
> the current specs for floating point numbers in js (not only js, I know)
> In that application I have to handle money, so calculations and storage of
> these values must be error free.
>
> The app is built with AngularJS, nodeJS (with express) and Mongodb
>
> Could anybody indicates how to handle numbers: from the time when the user
> fills the form to the time when the value is stored into the database and
> then, presented again to the user?
>
> So far, I've read that people advise to store money values as integers
> (so, stored in cents) but I would like to know if somebody has already
> faced that problem and how it was solved.
>
> Thank you :)
>
> --
> 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

Reply via email to