Raised This Month: $ Target: $400
 0% 

Float problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Elusive138
Senior Member
Join Date: Dec 2010
Old 05-07-2011 , 07:40   Re: Float problem
Reply With Quote #7

There might be an easier way, but for rounding to a number of decimal places, you can always do
PHP Code:
fNum floatround(fNum*10) / 10.0 
PHP Code:
stock Float:floatround_dp(Float:numdp)
{
     new 
Float:mult floatpower10.0float(dp) )
     return 
floatroundnum mult ) / mult

All that does is shift everything you want to keep left of the decimal point, round it, and shift it back.

Last edited by Elusive138; 05-07-2011 at 07:56.
Elusive138 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 04:17.


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