Flusspferd API and module docs

mixin gmp.Base

Description

Common behaviour shared between all GMP classes.

All the methods on this mixin that return gmp.Base infact return instances of the same type as the invocant – i.e. if gmp.Base#abs is called on a gmp.Integer it will return an Integer.

Instance methods

  • abs #

    gmp.Base#abs() ⇒ gmp.Base

    Return the absolute value of this.

  • add #

    gmp.Base#add(rhs) ⇒ gmp.Base

    Returns this + rhs as the same concrete type as this.

  • cmp #

    gmp.Base#cmp(rhs) ⇒ Number
    • rhs (Number | gmp.Base) – value to compare with

    Returns a positive value if this > rhs, zero if this == rhs, and a negative value if this < rhs.

  • div #

    gmp.Base#div(rhs) ⇒ gmp.Base

    Returns this / rhs as the same concrete type as this.

  • getDouble #

    gmp.Base#getDouble() ⇒ Number

    Returns the value as a floating point number

  • mul #

    gmp.Base#mul(rhs) ⇒ gmp.Base

    Returns this * rhs as the same concrete type as this.

  • sgn #

    gmp.Base#sgn() ⇒ Number

    Return an integer indication the sign of the value: 1 if > 0, 0 if == 0, and -1 if < 0.

  • sub #

    gmp.Base#sub(rhs) ⇒ gmp.Base

    Returns this - rhs as the same concrete type as this.

  • toString #

    gmp.Base#toString([base = 10]) ⇒ String
    • base (Number) – base to represent value in.

    Returns the value as a string