NAME ^

classes/perlnum.pmc - Perl Floating-Point Number

DESCRIPTION ^

These are the vtable functions for the PerlNum base class

Methods ^

void *invoke(void *next)

Pythonic object constructor. SELF is a PerlNum Class object. Return a new float object according to 2.1. Built-in Functions.

void init()

Initializes the number to 0.0.

INTVAL get_integer()

Returns the integer value of the number.

BIGNUM *get_bignum()

Unimplemented. Returns NULL.

STRING *get_string()

Returns the number as a Parrot string.

INTVAL get_bool()

Evaluates the number as a boolean, i.e. it's true if it's not zero.

void set_integer_native(INTVAL value)

void set_number_native(FLOATVAL value)

Sets the value of the number to value.

Note that if value is an integer the number morphs to a PerlInt.

void set_number_same(PMC *value)

Sets the value of the number to the value of *value.

void set_bignum_native(BIGNUM *value)

Unimplemented. Does nothing.

void set_string_native(STRING *value)

Sets the value of the number to the value of *value.

Note that this method morphs the number into a PerlString.

void add(PMC *value, PMC *dest)

Adds *value to the number and returns the result in *dest.

void add_int(INTVAL value, PMC *dest)

Adds value to the number and returns the result in *dest.

void add_float(FLOATVAL value, PMC *dest)

Adds value to the number and returns the result in *dest.

void subtract(PMC *value, PMC *dest)

Subtracts *value from the number and returns the result in *dest.

void subtract_int(INTVAL value, PMC *dest)

Subtracts value from the number and returns the result in *dest.

void subtract_float(FLOATVAL value, PMC *dest)

Subtracts value from the number and returns the result in *dest.

void multiply(PMC *value, PMC *dest)

Multiplies the number by *value and returns the result in *dest.

void multiply_int(INTVAL value, PMC *dest)

Multiplies the number by value and returns the result in *dest.

void multiply_float(FLOATVAL value, PMC *dest)

Multiplies the number by value and returns the result in *dest.

void divide(PMC *value, PMC *dest)

Divides the number by *value and returns the result in *dest.

void divide_int(INTVAL value, PMC *dest)

void divide_float(FLOATVAL value, PMC *dest)

Divides the number by value and returns the result in *dest.

void cmodulus(PMC *value, PMC *dest)

Calculates the value of the number C-style mod *value and returns the result in *dest.

void cmodulus_float(FLOATVAL value, PMC *dest)

void cmodulus_int(INTVAL value, PMC *dest)

Calculates the value of the number C-style mod value and returns the result in *dest.

void modulus(PMC *value, PMC *dest)

Calculates the value of the number mod *value and returns the result in *dest.

void modulus_float(FLOATVAL value, PMC *dest)

void modulus_int(INTVAL value, PMC *dest)

Calculates the value of the number mod value and returns the result in *dest.

void neg(PMC *dest)

If dest is true, then the negation of the number is returned in *dest. Otherwise the number itself is negated.

INTVAL is_equal(PMC *value)

The == operation.

INTVAL cmp(PMC *value)

INTVAL cmp_num(PMC *value)

Returns the result of comparing the number with *value.

void repeat(PMC *value, PMC *dest)

void repeat_int(INTVAL value, PMC *dest)

These two methods raise an "invalid operation" exception.

void increment()

Increments the number.

void decrement()

Decrements the number.

void absolute()

Sets dest to the absolute value of SELF.

void freeze(visit_info *info)

Used to archive the number.

void thaw(visit_info *info)

Used to unarchive the number.


parrot