XFloat Documentation - 5. Mathmatical Functions

Written by Integralus

5. Mathmatical Functions

  • .acos(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of arccos xf in current object. The result is in radian. The precision below decimal point is decided by precision. If xf is less than -1, or greater than 1, XFloatError will be thrown.

    This method returns 'this'.

  • .asin(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of arcsin xf in current object. The result is in radian. The precision below decimal point is decided by precision. If xf is less than -1, or greater than 1, XFloatError will be thrown.

    This method returns 'this'.

  • .atan(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of arctan xf in current object. The result is in radian. The precision below decimal point is decided by precision.

    This method returns 'this'.

  • .atan2(y, x, precision)

    • y: (XFloat object) the value to calculate
    • x: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of atan2(y, x) in current object. The result is in radian. The precision below decimal point is decided by precision.

    This method returns 'this'.

  • .cos(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of cos xf in current object. xf should be in radian. The precision below decimal point is decided by precision.

    This method returns 'this'.

  • .exp(xf, precision)

    • xf: (XFloat object, 24-bit integer, or real number) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of exf in current object. The precision below decimal point is decided by precision.

    This method returns 'this'.

  • .inv(xf, precision)

    • xf: (XFloat object, 24-bit integer, or real number) the value to invert
    • precision: (24-bit integer) the precision below decimal point in word

    Store the inversion ofxf in current object. The precision below decimal point is decided by precision. If xf is 0, XFloatError will be thrown. To get a fraction part of the quotient, calculate an inversion with this method and multiply withmul method. If you find a division method with remainder, see div method.

    This method returns 'this'.

  • .log(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of log xf in current object. The precision below decimal point is decided by precision. If xfis 0 or negative, XFloatError will be thrown.

    This method returns 'this'.

  • .sqrt(xf, precision)

    • xf: (XFloat object, 24-bit integer, or real number) the value to calculate square root
    • precision: (24-bit integer) the precision below decimal point in word

    Store the square root of xf in current object. The precision below decimal point is decided by precision. If xf is negative, XFloatError will be thrown.

    This method returns 'this'.

  • .pi(precision)

    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of Pi in current object. The precision below decimal point is decided by precision.

    This method returns 'this'.

  • .pow(xf, exponent, precision)

    • xf: (XFloat object) the value of base
    • exponent: (XFloat object or 24-bit integer) the value of exponent
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of xfexponent in current object. The precision below decimal point is decided by precision. If xfis 0 and exponent is 0 or negative, XFloatError will be thrown. Also if xf is negative and exponent is non-integer, XFloatError will be thrown.

    This method returns 'this'.

  • .sin(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of sin xf in current object. xf should be in radian. The precision below decimal point is decided by precision.

    This method returns 'this'.

  • .sincos(cos, xf, precision)

    • cos: (XFloat object) the object to be stored in the value of cos
    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of sin xf in current object and store the value of cos xf in cos. xf should be in radian. The precision below decimal point is decided by precision.

    This method calculates both sin and cos values within approximately the same time. If you need both sin and cos, use this method instead of sin and cos separately.

    This method returns 'this'.

  • .tan(xf, precision)

    • xf: (XFloat object) the value to calculate
    • precision: (24-bit integer) the precision below decimal point in word

    Store the value of tan xf in current object. xf should be in radian. The precision below decimal point is decided by precision.

    This method returns 'this'.

All mathmatical function methods return 'this'. So you can chain operations like a.pi(4).sub(1).

Mathmatical funcions Example


Other languages