#if defined _float_included
  #endinput
#endif
#define _float_included

/* Different methods of rounding */
enum floatround_method {
  floatround_round,
  floatround_floor,
  floatround_ceil
}

/**************************************************/
/* Convert an integer into a floating point value */
native float:float(value);

/**************************************************/
/* Multiple two floats together */
native float:floatmul(float:oper1, float:oper2);

/**************************************************/
/* Divide the dividend float by the divisor float */
native float:floatdiv(float:dividend, float:divisor);

/**************************************************/
/* Add two floats together */
native float:floatadd(float:dividend, float:divisor);

/**************************************************/
/* Subtract oper2 float from oper1 float */
native float:floatsub(float:oper1, float:oper2);

/**************************************************/
/* Return the fractional part of a float */
native float:floatfract(float:value);

/**************************************************/
/* Round a float into a integer value */
native       floatround(float:value, floatround_method:method=floatround_round);

/**************************************************/
/* Compare two integers. If the two elements are equal, return 0.
   If the first argument is greater than the second argument, return 1,
   If the first argument is less than the second argument, return -1. */
native floatcmp(float:fOne, float:fTwo);


/**************************************************/
#pragma rational float

/* user defined operators */
native float:operator*(float:oper1, float:oper2) = floatmul;
native float:operator/(float:oper1, float:oper2) = floatdiv;
native float:operator+(float:oper1, float:oper2) = floatadd;
native float:operator-(float:oper1, float:oper2) = floatsub;

stock float:operator++(float:oper)
    return oper+1.0;

stock float:operator--(float:oper)
    return oper-1.0;

stock float:operator-(float:oper)
    return oper^float:0x80000000;               /* IEEE values are sign/magnitude */

stock float:operator*(float:oper1, oper2)
    return floatmul(oper1, float(oper2));       /* "*" is commutative */

stock float:operator/(float:oper1, oper2)
    return floatdiv(oper1, float(oper2));

stock float:operator/(oper1, float:oper2)
    return floatdiv(float(oper1), oper2);

stock float:operator+(float:oper1, oper2)
    return floatadd(oper1, float(oper2));       /* "+" is commutative */

stock float:operator-(float:oper1, oper2)
    return floatsub(oper1, float(oper2));

stock float:operator-(oper1, float:oper2)
    return floatsub(float(oper1), oper2);

stock bool:operator==(float:oper1, float:oper2)
    return floatcmp(oper1, oper2) == 0;

stock bool:operator==(float:oper1, oper2)
    return floatcmp(oper1, float(oper2)) == 0;  /* "==" is commutative */

stock bool:operator!=(float:oper1, float:oper2)
    return floatcmp(oper1, oper2) != 0;

stock bool:operator!=(float:oper1, oper2)
    return floatcmp(oper1, float(oper2)) != 0;  /* "==" is commutative */

stock bool:operator>(float:oper1, float:oper2)
    return floatcmp(oper1, oper2) > 0;

stock bool:operator>(float:oper1, oper2)
    return floatcmp(oper1, float(oper2)) > 0;

stock bool:operator>(oper1, float:oper2)
    return floatcmp(float(oper1), oper2) > 0;

stock bool:operator>=(float:oper1, float:oper2)
    return floatcmp(oper1, oper2) >= 0;

stock bool:operator>=(float:oper1, oper2)
    return floatcmp(oper1, float(oper2)) >= 0;

stock bool:operator>=(oper1, float:oper2)
    return floatcmp(float(oper1), oper2) >= 0;

stock bool:operator<(float:oper1, float:oper2)
    return floatcmp(oper1, oper2) < 0;

stock bool:operator<(float:oper1, oper2)
    return floatcmp(oper1, float(oper2)) < 0;

stock bool:operator<(oper1, float:oper2)
    return floatcmp(float(oper1), oper2) < 0;

stock bool:operator<=(float:oper1, float:oper2)
    return floatcmp(oper1, oper2) <= 0;

stock bool:operator<=(float:oper1, oper2)
    return floatcmp(oper1, float(oper2)) <= 0;

stock bool:operator<=(oper1, float:oper2)
    return floatcmp(float(oper1), oper2) <= 0;

stock bool:operator!(float:oper1)
    return floatcmp(oper1, 0.0) == 0;

/* forbidden operations */
forward operator%(float:oper1, float:oper2);
forward operator%(float:oper1, oper2);
forward operator%(oper1, float:oper2);

