Problem with sum : 0.099999 instead of 0.01
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alexia_Schumacker
Posted On:   Friday, August 16, 2002 01:40 AM

Hi,

I've got a problem with javascript which sum different value.

Sometimes when it sums, instead of 0.01 there is 0.0999999999.

here is my code to sum :



total = parseFloat(Remplace(document.formul.c11.value))+parseFloat(Remplace(document.formul.c12.value))+parseFloat(Remplace(document.formul.c13.value))+parseFloat(Remplace(document.formul.c14.value));



Thank you for your help



Alexia

Re: Problem with sum : 0.099999 instead of 0.01

Posted By:   Firat_Tiryaki  
Posted On:   Sunday, August 18, 2002 11:47 PM

try to avoid using parseInt, parseFloat, etc...

Re: Problem with sum : 0.099999 instead of 0.01

Posted By:   Simon_Ablett  
Posted On:   Friday, August 16, 2002 02:54 AM

Floating point representations have problems representing certain numbers. So, periodically you will come across errors such as this when performing floating point calculations.

Regards.

Re: Problem with sum : 0.099999 instead of 0.01

Posted By:   Anonymous  
Posted On:   Friday, August 16, 2002 02:26 AM


And which problem does that cause ?

About | Sitemap | Contact