View Single Post
Old 06-09-2012, 04:13 AM   PM User | #10
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by Krupski View Post
I do need parseInt because the algorithm depends on integer math and indeed fails if floating point numbers get involved.
but parseInt() in JavaScript doesn't convert the values to integers, it converts between number bases eg base 16 to base 10

Math.floor() is the JavaScript function to convert from a float to an integer.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote