Multi precision Rational

Introduced properties

fun abs(res: NativeMPQ)

gmp :: NativeMPQ :: abs

fun add(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: add

fun cmp(op: NativeMPQ): Int

gmp :: NativeMPQ :: cmp

fun cmp_si(num: Int, den: Int): Int

gmp :: NativeMPQ :: cmp_si

fun div(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: div

fun equal(op: NativeMPQ): Bool

gmp :: NativeMPQ :: equal

fun finalize

gmp :: NativeMPQ :: finalize

Delete this NativeMPZ
fun get_d: Float

gmp :: NativeMPQ :: get_d

fun get_str(base: Int32): CString

gmp :: NativeMPQ :: get_str

fun inv(res: NativeMPQ)

gmp :: NativeMPQ :: inv

fun mul(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: mul

fun neg(res: NativeMPQ)

gmp :: NativeMPQ :: neg

init new: NativeMPQ

gmp :: NativeMPQ :: new

fun set(op: NativeMPQ)

gmp :: NativeMPQ :: set

fun set_d(op: Float)

gmp :: NativeMPQ :: set_d

fun set_si(op1: Int, op2: Int)

gmp :: NativeMPQ :: set_si

fun set_str(str: CString)

gmp :: NativeMPQ :: set_str

fun set_z(op: NativeMPZ)

gmp :: NativeMPQ :: set_z

fun sub(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: sub

fun swap(op: NativeMPQ)

gmp :: NativeMPQ :: swap

Redefined properties

redef type SELF: NativeMPQ

gmp $ NativeMPQ :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun abs(res: NativeMPQ)

gmp :: NativeMPQ :: abs

fun add(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: add

fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun cmp(op: NativeMPQ): Int

gmp :: NativeMPQ :: cmp

fun cmp_si(num: Int, den: Int): Int

gmp :: NativeMPQ :: cmp_si

fun div(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: div

fun equal(op: NativeMPQ): Bool

gmp :: NativeMPQ :: equal

fun finalize

gmp :: NativeMPQ :: finalize

Delete this NativeMPZ
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun get_d: Float

gmp :: NativeMPQ :: get_d

fun get_str(base: Int32): CString

gmp :: NativeMPQ :: get_str

fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun inv(res: NativeMPQ)

gmp :: NativeMPQ :: inv

intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
fun mul(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: mul

fun neg(res: NativeMPQ)

gmp :: NativeMPQ :: neg

init new: NativeMPQ

gmp :: NativeMPQ :: new

init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
fun set(op: NativeMPQ)

gmp :: NativeMPQ :: set

fun set_d(op: Float)

gmp :: NativeMPQ :: set_d

fun set_si(op1: Int, op2: Int)

gmp :: NativeMPQ :: set_si

fun set_str(str: CString)

gmp :: NativeMPQ :: set_str

fun set_z(op: NativeMPZ)

gmp :: NativeMPQ :: set_z

fun sub(res: NativeMPQ, op: NativeMPQ)

gmp :: NativeMPQ :: sub

fun swap(op: NativeMPQ)

gmp :: NativeMPQ :: swap

intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
package_diagram gmp::NativeMPQ NativeMPQ core::Pointer Pointer gmp::NativeMPQ->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

gmp $ NativeMPQ
# Multi precision Rational
extern class NativeMPQ `{mpq_ptr`}

    # Initializing

    new `{
        mpq_ptr self = (mpq_ptr)malloc(sizeof(mpq_t));
        mpq_init(self);
        return self;
    `}

    # Arithmetic Functions

    fun add(res, op: NativeMPQ) `{
        mpq_add(res, self, op);
    `}

    fun sub(res, op: NativeMPQ) `{
        mpq_sub(res, self, op);
    `}

    fun mul(res, op: NativeMPQ) `{
        mpq_mul(res, self, op);
    `}

    fun div(res, op: NativeMPQ) `{
        mpq_div(res, self, op);
    `}

    fun neg(res: NativeMPQ) `{
        mpq_neg(res, self);
    `}

    fun abs(res: NativeMPQ) `{
        mpq_abs(res, self);
    `}

    fun inv(res: NativeMPQ) `{
        mpq_inv(res, self);
    `}

    # Assignment

    fun set(op: NativeMPQ) `{ mpq_set(self, op); `}

    fun set_z(op: NativeMPZ) `{ mpq_set_z(self, op); `}

    fun set_si(op1: Int, op2: Int) `{
        mpq_set_si(self, op1, op2);
        mpq_canonicalize(self);
    `}

    fun set_d(op: Float) `{ mpq_set_d(self, op); `}

    fun set_str(str: CString) `{
        mpq_set_str(self, str, 10);
        mpq_canonicalize(self);
    `}

    fun swap(op: NativeMPQ) `{ mpq_swap(self, op); `}

    # Convertion Functions

    fun get_d: Float `{ return mpq_get_d(self); `}

    fun get_str(base: Int32): CString `{
        return mpq_get_str(NULL, base, self);
    `}

    # Comparison Functions

    fun cmp(op: NativeMPQ): Int `{
        return mpq_cmp(self, op);
    `}

#    fun cmp_z(op: NativeMPZ): Int `{
#        return mpq_cmp_z(self, op);
#    `}

    fun cmp_si(num: Int, den: Int): Int `{
        return mpq_cmp_si(self, num, den);
    `}

    fun equal(op: NativeMPQ): Bool `{
        return mpq_equal(self, op);
    `}

    # Getter

    fun numref: NativeMPZ `{
        return mpq_numref(self);
    `}

    fun denref: NativeMPZ `{
        return mpq_denref(self);
    `}

    # Delete this NativeMPZ
    fun finalize `{
        mpq_clear(self);
        free(self);
    `}
end
lib/gmp/native_gmp.nit:148,1--250,3