int() function

Blitz3D Forums/Blitz3D Beginners Area/int() function

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

It shouldn't though, not according to both the Manual
Um, I don't know what you're smoking, but the manual does state that it works that way:
Int( value )
Parameters:
value = a number, or a string which represents a number
Description:
Converts the value to the nearest integer. 

This is the same as Blitz's automatic type conversion. 
So the two commands... 

n = value 
n = Int( value ) 

... do exactly the same thing when n is an integer variable. 

If Int is applied to a string it converts as much as possible: 

Int( "10" ) ........ result is 10 
Int( "3.7" ) ....... result is 3, stops at "." which can't be part of an integer 
Int( "junk3" ) .... result is 0, stops at "j" 

Int converts floating point numbers by rounding to the nearest integer. 
NOTE: This is not the traditional meaning of Int in Basic. 

What about numbers exactly halfway between integers? 
The rounding is to the nearest even integer: 

Int( 2.5 ) ... produces 2 
Int( 3.5 ) ... produces 4 

See also Floor and Ceil for other types of rounding.