added RoundFloat and deprecated FloatRound
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40851
This commit is contained in:
parent
6f7f487275
commit
0e8ba9ed15
@ -213,21 +213,25 @@ native Float:ArcSine(Float:angle);
|
||||
native Float:ArcTangent2(Float:x, Float:y);
|
||||
|
||||
/**
|
||||
* Different methods of rounding.
|
||||
* Rounds a floating point number using the "round to nearest" algorithm.
|
||||
*
|
||||
* @param value Floating point value to round.
|
||||
* @return The value rounded to the nearest integer.
|
||||
*/
|
||||
enum floatround_method
|
||||
stock RoundFloat(Float:value)
|
||||
{
|
||||
floatround_round = 0, /**< Standard IEEE rounding */
|
||||
floatround_floor, /**< Next lowest integer value. */
|
||||
floatround_ceil, /**< Next highest integer value. */
|
||||
floatround_tozero /** Closest integer to zero. */
|
||||
};
|
||||
return RoundToNearest(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backwards compatibility - use RoundToNearest or any of the other rounding natives.
|
||||
* Backwards compatibility stock. Do not use.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
native FloatRound(Float:value, floatround_method:method=floatround_round);
|
||||
stock FloatRound(Float:value)
|
||||
{
|
||||
return RoundToNearest(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* User defined operators.
|
||||
|
Loading…
Reference in New Issue
Block a user