[Javascript] (no subject)

Scott Hamm linuxgold at gmail.com
Wed Nov 2 12:24:48 CST 2005


I only care for Decimal(4,2) -- for SQL data type.



On 11/2/05, Mark Wonsil <wonsil at 4m-ent.com> wrote:
> >
> > kpp = parseFloat(kpp);
> > kph = parseFloat(kph);
> > if(!isNaN(kpp) &&!isNaN(kph) )
> > {
> >       ktot = kpp + kph;
> > }
> > alert("passed here, with value of " + ktot + ".")
> > If(ktot>'8')
>
> It's a type issue, very common in JavaScript. Ktot is a float but '8' is a
> character. Try:
>
> If (ktot > 8f)
>
> Or
>
> If (ktot > parseFloat('8'))
>
> BTW, comparing floats can be tricky. Do you care if the total is 8.00001 or
> 8.000000003232? Those will be greater than 8.0. What I normally do is
> subtract the two numbers, take the absolute value and check to see if the
> difference is within my tolerance:
>
> If (abs(ktot - 8.0f)) < 0.0001
>
> Mark W.
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>


--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



More information about the Javascript mailing list