Primitive C types - Factor Documentation (original) (raw)

The following numerical types are defined in the alien.c-types vocabulary; a u prefix denotes an unsigned type:

C type Notes
char always 1 byte
uchar
short always 2 bytes
ushort
int always 4 bytes
uint
long same size as CPU word size and void*, except on 64-bit Windows, where it is 4 bytes
ulong
longlong always 8 bytes
ulonglong
float single-precision float (not the same as Factor's float class!)
double double-precision float (the same format as Factor's float objects)

C99 complex number types are defined in the alien.complex vocabulary.

When making alien calls, Factor numbers are converted to and from the above types in a canonical way. Converting a Factor number to a C value may result in a loss of precision.