OK Int rounds numbers that are exactly halfway e.g. 0.5, 1.5 etc towards nearest even number e.g. 0.5 = 0 but 1.5 = 2. I think this is called bankers rounding (for a more fair rounding of money), but it stinks for me! Anyone know a quick way to always round 0.5 down? e.g 1.5 = 1 but 1.6 = 2
Better Int()?
BlitzPlus Forums/BlitzPlus Programming/Better Int()? lol, nice one. Just me over doing it as usual.
Owned.
Nice one guys! I was just too tired to work it out and it was causing me a massive bug in a level editor.
Too bad this function doesn't just return the integer part, like most other basic's do....
Russell
Russell
Russell: luckily Floor does that.
Not by itself. Floor just rounds 'down' toward negative infinity. Floor(-1.7) returns -2.0 for example.
Russell
Russell
Under other basics, Int(-1.7) would return -1.
For the fractional portion, you can use Frac(-1.7), if available or just subtract the Int() portion from the original. Of course, that can be a bit sketchy given the nature of floats (-1.7 could be defined internally as -1.700099 or similar).
Beaker's example does help, though.
Russell
For the fractional portion, you can use Frac(-1.7), if available or just subtract the Int() portion from the original. Of course, that can be a bit sketchy given the nature of floats (-1.7 could be defined internally as -1.700099 or similar).
Beaker's example does help, though.
Russell
Russell: I knew that, glad u did too!