NAME

src/pmc/bigint.pmc - BigInt PMC

DESCRIPTION

BigInt provides arbitrary precision integer mathematic functions.

Functions

static void bigint_set_long(PARROT_INTERP, PMC *self, long value)
Set the value of the BigInt to value.
static void bigint_set_double(PARROT_INTERP, PMC *self, double value)
Set the value of the BigInt to value.
static void bigint_init(PARROT_INTERP, PMC *self)
Initialize a BigInt
static void bigint_clear(PARROT_INTERP, PMC *self)
Clear the BigInt memory.
static void bigint_set(PARROT_INTERP, PMC *dest, PMC *src)
Set the BigInt value dest to the same value as src.
static void bigint_set_long(PARROT_INTERP, PMC *self, long value)
Initialize the BigInt value from a long
static void bigint_set_double(PARROT_INTERP, PMC *self, double value)
Initialize the BigInt value from a double
static void bigint_set_str(PARROT_INTERP, PMC *self, const STRING *value, int base)
Initialize the BigInt value from a STRING
static BIGINT* bigint_get_self(PARROT_INTERP, PMC *self)
Get the BIGINT* pointer from self
static void bigint_set_self(PARROT_INTERP, PMC *self, BIGINT *value)
Set the BIGINT* pointer from value PMC
static long bigint_get_long(PARROT_INTERP, PMC *self)
Convert the BigInt value to a long
static int bigint_get_bool(PARROT_INTERP, PMC *self)
Get a boolean representation of the BigInt
static char * bigint_get_string(PARROT_INTERP, PMC *self, int base)
Get a STRING representation of the BigInt.
static double bigint_get_double(PARROT_INTERP, PMC *self)
Get a double value from the BigInt.
static void bigint_add_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Add self and value and store the result in dest.
static void bigint_add_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Add an INTVAL to the BigInt.
static void bigint_sub_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Subtract value from self and store the result in dest.
static void bigint_sub_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Subtract value from self and store the result in dest.
static void bigint_mul_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Multiply self by value and store the result in dest.
static void bigint_mul_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Multiply self by value and store the result in dest.
static void bigint_pow_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Raise self to the power value and store the result in dest.
static void int_check_divide_zero(PARROT_INTERP, INTVAL value)
If value is 0, throw an exception.
static void bigint_check_divide_zero(PARROT_INTERP, PMC *value)
If value is 0, throw an exception.
static void bigint_div_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Divide self by value and store the result in dest.
static void bigint_div_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Divide self by value and store the result in dest.
static void bigint_fdiv_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Floating-point divide self by value and store the result in dest.
static void bigint_fdiv_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Floating-point divide self by value and store the result in dest.
static void bigint_mod_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Modulo self by value and store the result in dest.
static void bigint_mod_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Modulo self by value and store the result in dest.
static INTVAL bigint_cmp(PARROT_INTERP, PMC *self, PMC *value)
Compare self and value, returning 1, 0 or -1 depending on the relation.
static INTVAL bigint_cmp_int(PARROT_INTERP, PMC *self, INTVAL value)
Compare self and value, returning 1, 0 or -1 depending on the relation.
static void bigint_abs(PARROT_INTERP, PMC *self, PMC *dest)
Take the absolute value of self. Store the result in dest.
static void bigint_neg(PARROT_INTERP, PMC *self, PMC *dest)
Take the negative value of self. Store the result in dest.

Methods

METHOD version()
Return GMP version string "x.y.z".
void set_integer_native(INTVAL value)
void set_number_native(FLOATVAL value)
Sets the value of the bigint to value.
void set_string_native(STRING *value)
Sets the value of the integer to the result of converting *value to a number.
void set_string_keyed_int(INTVAL base, STRING *value)
Same assume number base base.
void set_pmc(PMC *value)
Sets the value of the integer to the integer value of *value.
FLOATVAL get_number()
Returns the value of the integer as a floating point number.
INTVAL get_integer()
Returns the value of the integer.
INTVAL get_bool()
Returns the boolean value of the integer.
STRING *get_string()
Returns the string representation of the integer.
STRING *get_string_keyed_int(INTVAL base)
Returns the string representation of the integer in base base.
STRING *get_repr()
Returns the string representation of the integer with the letter 'L' appended.
void increment()
Increments the integer.
void decrement()
Decrements the integer.
PMC *absolute(PMC *dest)
void i_absolute()
Sets dest to the absolute value of SELF.
PMC *neg(PMC *dest)
void i_neg()
Set dest to the negated value of SELF.