From 0e8ba9ed15a479a9a6f5225c67720d1b3466bc00 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 23 May 2007 15:49:28 +0000 Subject: [PATCH] added RoundFloat and deprecated FloatRound --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40851 --- plugins/include/float.inc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/include/float.inc b/plugins/include/float.inc index e3de4049..714d4aeb 100644 --- a/plugins/include/float.inc +++ b/plugins/include/float.inc @@ -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.