Raised This Month: $ Target: $400
 0% 

Round float values


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quark
Veteran Member
Join Date: Oct 2011
Location: Your mind.
Old 08-12-2014 , 03:24   Round float values
Reply With Quote #1

I have a question, I've been searching and i did not understand something. I read that %d and %i are only for integers, so, it round floats or should I use float.inc?

EDIT - I think I get it lel
__________________

Check out My Plugins:
qServerInfo ; ASKTAG

Last edited by quark; 08-12-2014 at 03:25.
quark is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-12-2014 , 05:00   Re: Round float values
Reply With Quote #2

%f is for Floats, lol. Or, with just une digit after the comma: %.1f
__________________

Last edited by HamletEagle; 08-12-2014 at 09:19. Reason: For making Yami happy
HamletEagle is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 08-12-2014 , 05:06   Re: Round float values
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
%s is for floats, lol.
Wrong, %f is for Floats
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-12-2014 , 08:03   Re: Round float values
Reply With Quote #4

This is what I wanted to say, didn't think that someone would care about a capitalized letter....
__________________
HamletEagle is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 08-12-2014 , 08:06   Re: Round float values
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
This is what I wanted to say, didn't think that someone would care about a capitalized letter....
's' is not the capitalized form of 'f'
__________________
ddhoward is offline
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 08-12-2014 , 08:40   Re: Round float values
Reply With Quote #6

Quote:
Originally Posted by quark View Post
I have a question, I've been searching and i did not understand something. I read that %d and %i are only for integers, so, it round floats or should I use float.inc?
No, it doesn't round floats. It will simply interpret the value you put into it as an int, and it will look like a totally random and unrelated number. You have to round the value using floatround first.
__________________
In Flames we trust!
Nextra is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-12-2014 , 09:19   Re: Round float values
Reply With Quote #7

Quote:
Originally Posted by ddhoward View Post
's' is not the capitalized form of 'f'
My bad, now I see that I writted %s and not %f.
__________________
HamletEagle is offline
Reply



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:05.


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