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 static void bigint_set_double(PARROT_INTERP, PMC *self, double value)
Set the value of the BigInt to 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 static void bigint_set_long(PARROT_INTERP, PMC *self, long value)
Initialize the BigInt value from a static void bigint_set_double(PARROT_INTERP, PMC *self, double value)
Initialize the BigInt value from a static void bigint_set_str(PARROT_INTERP, PMC *self, const STRING *value, int base)
Initialize the BigInt value from a static BIGINT* bigint_get_self(PARROT_INTERP, PMC *self)
Get the static void bigint_set_self(PARROT_INTERP, PMC *self, BIGINT *value)
Set the static long bigint_get_long(PARROT_INTERP, PMC *self)
Convert the BigInt value to a 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 static void bigint_add_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Add 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 static void bigint_sub_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Subtract static void bigint_mul_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Multiply static void bigint_mul_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Multiply static void bigint_pow_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Raise static void int_check_divide_zero(PARROT_INTERP, INTVAL value)
If static void bigint_check_divide_zero(PARROT_INTERP, PMC *value)
If static void bigint_div_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Divide static void bigint_div_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Divide static void bigint_fdiv_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Floating-point divide static void bigint_fdiv_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Floating-point divide static void bigint_mod_bigint(PARROT_INTERP, PMC *self, PMC *value, PMC *dest)
Modulo static void bigint_mod_bigint_int(PARROT_INTERP, PMC *self, INTVAL value, PMC *dest)
Modulo static INTVAL bigint_cmp(PARROT_INTERP, PMC *self, PMC *value)
Compare static INTVAL bigint_cmp_int(PARROT_INTERP, PMC *self, INTVAL value)
Compare static void bigint_abs(PARROT_INTERP, PMC *self, PMC *dest)
Take the absolute value of static void bigint_neg(PARROT_INTERP, PMC *self, PMC *dest)
Take the negative value of
value
.
value
.
dest
to the same value as src
.
long
double
STRING
BIGINT*
pointer from self
BIGINT*
pointer from value
PMC
long
double
value from the BigInt.
self
and value
and store the result in dest
.
value
from self
and store the result in dest
.
value
from self
and store the result in dest
.
self
by value
and store the result in dest
.
self
by value
and store the result in dest
.
self
to the power value
and store the result in dest
.
value
is 0
,
throw an exception.
value
is 0
,
throw an exception.
self
by value
and store the result in dest
.
self
by value
and store the result in dest
.
self
by value
and store the result in dest
.
self
by value
and store the result in dest
.
self
by value
and store the result in dest
.
self
by value
and store the result in dest
.
self
and value
,
returning 1,
0 or -1 depending on the relation.
self
and value
,
returning 1,
0 or -1 depending on the relation.
self
.
Store the result in dest
.
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 void set_string_native(STRING *value)
Sets the value of the integer to the result of converting void set_string_keyed_int(INTVAL base, STRING *value)
Same assume number base void set_pmc(PMC *value)
Sets the value of the integer to the integer value of 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 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 PMC *neg(PMC *dest)
void i_neg()
Set
value
.
*value
to a number.
base
.
*value
.
base
.
dest
to the absolute value of SELF.
dest
to the negated value of SELF
.