Number constructors — Creating Lisp types from C numbers
cl_object ecl_make_fixnum(
cl_fixnum n)
;
cl_object ecl_make_integer(
cl_fixnum n)
;
cl_object ecl_make_unsigned_integer(
cl_index n)
;
cl_object ecl_make_single_float(
float n)
;
cl_object ecl_make_double_float(
double n)
;
cl_object ecl_make_long_float(
long double n)
;
cl_object ecl_make_uint8_t(
uint8_t n)
;
cl_object ecl_make_int8_t(
int8_t n)
;
cl_object ecl_make_uint16_t(
uint16_t n)
;
cl_object ecl_make_int16_t(
int16_t n)
;
cl_object ecl_make_uint32_t(
uint32_t n)
;
cl_object ecl_make_int32_t(
int32_t n)
;
cl_object ecl_make_uint64_t(
uint64_t n)
;
cl_object ecl_make_int64_t(
int64_t n)
;
cl_object ecl_make_short(
short n)
;
cl_object ecl_make_ushort(
unsigned short n)
;
cl_object ecl_make_int(
int n)
;
cl_object ecl_make_uint(
unsigned int n)
;
cl_object ecl_make_long(
long n)
;
cl_object ecl_make_ulong(
unsigned long n)
;
cl_object ecl_make_long_long(
long long n)
;
cl_object ecl_make_ulong_long(
unsigned long long n)
;
cl_object ecl_make_ratio(
cl_object numerator,
cl_object denominator)
;
cl_object ecl_make_complex(
cl_object real,
cl_object imag)
;
These functions create a Lisp object from the corresponding C number. If the number is an integer type, the result will always be an integer, which may be a bignum. If on the other hand the C number is a float, double or long double, the result will be a float.
There is some redundancy in the list of functions that convert from cl_fixnum and cl_index to lisp. On the one hand, ecl_make_fixnum()
always creates a fixnum, dropping bits if necessary. On the other hand, ecl_make_integer
and ecl_make_unsigned_integer
faithfully converts to a Lisp integer, which may a bignum.
Note also that some of the constructors do not use C numbers. This is the case of ecl_make_ratio
and ecl_make_complex
, because they are composite Lisp types.
These functions or macros signal no errors.