CAST

Previous  Next

 

int  = CAST( number AS REAL ) AS INTEGER

real = CAST( number AS INTEGER ) AS REAL

 


 

Copies the contents of a REAL or INTEGER to a different type of the same size casting the contents of one type to another while preserving the "raw" bit contents..

 

Example:

 

DIM r AS REAL

DIM i AS INTEGER

 

r = 1.23

i = CAST( r )

 

PRINT FORMAT( "r = %1.2f --> i = 0x%08X / %d", r, i, i ),

 

' This will produce the following output:

r = 1.23 --> i = 0x3F9D70A4 / 1067282596