Link to home
Start Free TrialLog in
Avatar of vikasbapat
vikasbapat

asked on

Javascript double datatype needed ?

Hi ,
I have a value which converts into NaN while converting using parseFloat() function ,but as of the value range is more its not working.

So is there any other alternate like "parseDouble()" or sort of or any other suggestion or logic to handle this.

eg when I convert parseFloat('123456789.565') then it returns NaN. please help me.

Thanks in Advance.
function add()
{
     var ch1 = '1212154.45'; //Comes from textbox
     var ch2 = '1212154454.45'; //Comes from textbox
 
           alert(parseFloat(ch1) ) // returns NaN
 
     var total = parseFloat(ch1) + parseFloat(ch2)
 
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Normally I have read somewhere, that they should convert automatically when used with a mathematical operation.
typo, should read  'reals'  not  'rels'"
Avatar of vikasbapat
vikasbapat

ASKER

ok thank you  i will try that example
A B grade? I think I have answered the question exactly?