The input is type number. They are basic operations, for example I had this:

sellingPrice = buyingPrice * x that got me results such as 12.60000000004

but the user will enter decimal numbers so should I convert it to integer 
when the request is handled by the server and store it as such in my 
database?

On Friday, 28 December 2012 23:01:38 UTC+1, Rick Waldron wrote:
>
> Just curious, what is the input type of your form's input field? If it's 
> "text", then the value doesn't start life as a number anyway—it's just a 
> string. 
>
> Also, what sort of calculations are you expecting to do? 
>
> Rick
>
> On Friday, December 28, 2012, José F. Romaniello wrote:
>
>> 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 
>>
>>> 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
>>
>

-- 
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