This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

math question (beginner)

I'm using float variables, but I want to convert these variables to integer


like: 0.9 .... 1
30.9 .... 31
54.2 .... 54


please give a suggestion

thanks very much

Parents
  • I would have guessed that execution would be faster to cast to an int then add 1 as opposed to doing a floating point addition (1 in Nocky's example and .5 in Drew's) then casting to an int.

    Then again I could be wrong, you could always try it both ways and find out.

    Walt

Reply
  • I would have guessed that execution would be faster to cast to an int then add 1 as opposed to doing a floating point addition (1 in Nocky's example and .5 in Drew's) then casting to an int.

    Then again I could be wrong, you could always try it both ways and find out.

    Walt

Children