Raised This Month: $ Target: $400
 0% 

Formatting float


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-24-2015 , 16:00   Re: Formatting float
Reply With Quote #4

Code:
client_print(id, print_chat, "My var: %i", floatround(gVar));
It returns the integer representation of a float value.
And modes are:
Code:
enum floatround_method {
    floatround_round = 0,
    floatround_floor,
    floatround_ceil,
    floatround_tozero
};
round is just classic rounding (to the nearest int). ( 17.6 -> 18 )
floor rounds downwards ( 17.8 -> 17 )
ceil rounds upwards ( 17.3 -> 18 )
tozero rounds toward zero ( -17.7 -> -17 | 17.7 -> 17)

Last edited by klippy; 12-24-2015 at 16:03.
klippy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode