XFloat Documentation - 9. Other Methods

Written by Integralus

9. Other Methods

Bitwise Operations

  • .lshift(n)

    • n: (24-bit integer) the number of bit to shift

    Shift current object to left by n bits. It produces the same result as multiplying with 2n

    This method returns 'this'.

  • .rshift(n)

    • n: (24-bit integer) the number of bit to shift

    Shift current object to right by n bits. It produces the same result as dividing with 2n

    This method returns 'this'.

    This method do not delete bits pushed out. So, the result of shifting 3 to right by 1 bit is 1.5 instead of 1.


Low-level Operations

  • .addExp(e)

    • e: (24-bit integer) the exponent value to increase

    Increase the exponent of current XFloat object by e. Increasing the exponent by 1 produces the same results as multiplying with 224. Increasing the exponent by -1 produces the same results as dividing with 224.

    This method returns nothing.

  • .getExp()

    Return the lowest exponent of current object.

  • .getMantissa()

    Return the mantissa of current object. The return value is Array type.

    This method returns an internal mantissa data of XFloat object. Note that modifying a return value causes changing this object.

  • .getMse()

    Return the highest exponent of current object.

  • .getSign()

    Return the sign of current object. The return value can be one of 1, 0, -1.

Other languages