"NaN" with thousand seperator

# Thread: "NaN" with thousand seperator

1. Member
Join Date
Dec 1969
Posts
95

## "NaN" with thousand seperator

I am calcuating form fields that are currency. Works great with any number less than \$999.99. Once I have a number such as \$1,000.00 the sum field returns a "NaN".<BR><BR>

2. Member
Join Date
Dec 1969
Posts
95

## Here Is The Code For Anyone Who Can Help Thnx

function cent(amount) {<BR> // returns the amount in the .99 format<BR> return (amount == Math.floor(amount)) ? amount + &#039;.00&#039; : ( (amount*10 == Math.floor(amount*10)) ? amount + &#039;0&#039; : amount);<BR>}<BR><BR> function update(form) {<BR> var subtotal = (form.CommTotal.value - 0) + (form.VendorCost.value - 0) +(form.VendorRushFee.value -0) +(form.VendorSetup.value -0);<BR> subtotal = Math.floor(subtotal * 100)/100;<BR> form.TotalCost.value = cent(subtotal);<BR> form.GrossProfit.value = cent(form.price.value - subtotal);<BR> <BR>}

3. Senior Member
Join Date
Dec 1969
Posts
155

## Not a Number

NaN = Not a Number<BR><BR>Don&#039;t know if that&#039;s helpful or not....

4. Member
Join Date
Dec 1969
Posts
95

## RE: "Nan" Not a Number

thank you for responding. yes i understand not a number = Nan. I&#039;m trying to figure out why amounts larger than 999.99 returns a Nan.<BR><BR>ie 1,000. the comma creates the Nan

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•