In ARMbasic this is an automatic type conversion between SINGLE and INTEGER
But if you want to do it explicitly, in your code add the following do-nothing
#define I2F(x) 0.0+x ' works because 0.0 is the first operand encountered and makes it floating point
#define F2I(y) 0+y ' works because the first operand is 0 an integer
ARMbasic automatically converts INTEGER type variables to/from SINGLE type variables.
In the simplest case, this is done by assigning SINGLE type = INTEGER type or vice versa.
When statements are parsed by ARMbasic, the parser looks for the first variable or constant and will use that elements type to determine whether to use floating point or integer calculations. Index parameters are always treated as INTEGER.
DIM SINGLEtype AS SINGLE
SINGLEtype = 1/2 ' results in 0.500000
INTEGERtype = 1/2 ' results in 0
functionCall ( 0.123 + INTEGERtype) ' passes a SINGLE type to functionCall
functionCall ( 123 + SINGLEtype ) ' passes an INTEGER to functionCall
To access bit fields within a SINGLE, you must convert it to an INTEGER without the implied type conversion. The easiest way to do that is
INTEGERtype = * (ADDRESSOF SINGLEtype) ' now you can do bit manipulations with AND, OR, XOR, NOT on INTEGERtype.