NAME
src/pmc/integer.pmc - Integer PMC class
DESCRIPTION
Integer
provides an integer for languages that want a value-restricted integer type without going to an I register.
Functions
PMC init_pmc(PMC *init)
Create a new Integer with arguments passed according to pdd03.
void init()
Initializes the integer with a default value of PMC *clone()
Creates an exact duplicate of this PMC.
PMC instantiate_str(STRING *rep)
Class method to construct an Integer from the string representation void set_pmc(PMC *value)
Sets the value of the integer to the value in void share()
Sets this PMC as shared and read-only.
INTVAL get_integer()
Returns the integer value of the Integer.
INTVAL get_bool()
Returns the boolean value of the Integer.
FLOATVAL get_number()
Returns the floating-point value of the integer.
PMC *get_bignum()
Return a new BigInt PMC with the value of STRING *get_string()
STRING *get_repr()
Returns the string value of the integer.
void set_integer_native(INTVAL value)
Sets the value of the integer to the value of the void set_number_native(FLOATVAL value)
Morphs the integer to a void set_bool(INTVAL value)
Morphs the integer to a void set_bigint_int(INTVAL value)
Morphs the integer to a void set_string_native(STRING *value)
Morphs the integer to a PMC *add(PMC *value, PMC *dest)
PMC *add_int(INTVAL value, PMC *dest)
Adds void i_add(PMC *value)
void i_add(INTVAL value)
void i_add(FLOATVAL value)
Adds PMC *subtract(PMC *value, PMC *dest)
Subtracts PMC *subtract_int(INTVAL value, PMC *dest)
Subtracts void i_subtract(PMC *value)
void i_subtract_int(INTVAL value)
void i_subtract_float(FLOATVAL value)
Subtracts PMC *multiply(PMC *value, PMC *dest)
PMC *multiply_int(INTVAL value, PMC *dest)
Multiplies the integer by void i_multiply(PMC *value)
void i_multiply_int(INTVAL value)
void i_multiply_float(FLOATVAL value)
Multiply PMC *divide(PMC *value, PMC *dest)
PMC *divide_int(INTVAL value, PMC *dest)
PMC *divide_float(FLOATVAL value, PMC *dest)
Divides the number by void i_divide(PMC *value)
void i_divide_int(INTVAL value)
void i_divide_float(FLOATVAL value)
Divides PMC *floor_divide(PMC *value, PMC *dest)
PMC *floor_divide_int(INTVAL value, PMC *dest)
PMC *floor_divide_float(FLOATVAL value, PMC *dest)
Divides the number by void i_floor_divide(PMC *value)
void i_floor_divide_int(INTVAL value)
void i_floor_divide_float(FLOATVAL value)
Divides PMC *modulus(PMC *value, PMC *dest)
PMC *modulus(INTVAL value, PMC *dest)
PMC *modulus(FLOATVAL value, PMC *dest)
Calculates the value of corrected void i_modulus(PMC *value)
void i_modulus(INTVAL value)
void i_modulus(FLOATVAL value)
Calculates modulus in place.
PMC *pow(PMC *value, PMC *dest)
PMC *pow_int(INTVAL value, PMC *dest)
Returns SELF to the void i_pow(PMC *value)
void i_pow_int(INTVAL value)
Raises SELF to the INTVAL is_equal(PMC *value)
The INTVAL cmp(PMC *value)
Returns the result of comparing the integer with INTVAL cmp_num(PMC *value)
Returns the result of numerically comparing the integer with void increment()
Increments the integer.
void decrement()
Decrements the integer.
PMC *absolute(PMC *dest)
void absolute()
Sets STRING *get_as_base(INTVAL base)
Converts and returns the integer in base void freeze(visit_info *info)
Used to archive the integer.
void thaw(visit_info *info)
Used to unarchive the integer.
0
.
rep
.
*value
.
SELF
.
Integer
*value
.
Float
and sets the value from value
.
Boolean
and sets the value from value
.
BigInt
and sets the value from value
.
String
and sets the value from value
.
value
to the integer and returns the result in *dest
.
value
to SELF
inplace.
*value
from the integer and returns the result in *dest
.
If dest
is NULL,
a PMC of this type.Please note: as SELF
or value
maybe be subclassed,
we have to call get_integer
and set_integer_native
always.
value
from the integer and returns the result in *dest
.
value
from SELF
inplace.
*value
and returns the result in *dest
.
value
with SELF
inplace.
value
and returns the result in *dest
.
SELF
by value
inplace.
value
and returns the result in *dest
.
SELF
by value
inplace.
mod
value
and returns the result in dest
.
See also ops/math.ops.
value
th power in dest
.
value
th power.RT #46631 Complex and BigInt rhs.
==
operation.
*value
.
*value
.
dest
to the absolute value of SELF.
base
.
base
must be between 2 and 36,
inclusive.