Strange INT behavior

Blitz3D Forums/Blitz3D Beginners Area/Strange INT behavior

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Int() doesn't just round the number, it actually converts the number to an integer (ie. not floating point anymore.) Ceiling and Floor are the proper commands for rounding; that they aren't working the way you expect is probably due to how they behave with negative numbers. For example, -2.0 is lower than -1.1 so Floor#(-1.1) will give you -2.0; if you wanted/were expecting -1.0 (ie. simply replacing everything after the decimal point with 0) you have to use an If statement to check the value first and then use Floor or Ceiling as appropriate.