So far this forum has been unbelievably helpful, so here goes another question:
How does one define an integer variable, or convert a floating point number to the nearest integer value (i.e. rounded not truncated)?
I'm trying to divide two numbers and use the result as a counter variable, but there is floating point error in the result (which should be a whole number). I could only find the parseInt() function, but that's only for string conversion, right? I know this is real basic stuff, but my last programming language was FORTRAN (it's okay, go ahead and laugh).
Thanks.
How does one define an integer variable, or convert a floating point number to the nearest integer value (i.e. rounded not truncated)?
I'm trying to divide two numbers and use the result as a counter variable, but there is floating point error in the result (which should be a whole number). I could only find the parseInt() function, but that's only for string conversion, right? I know this is real basic stuff, but my last programming language was FORTRAN (it's okay, go ahead and laugh).
Thanks.
Comment