AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Round float values (https://forums.alliedmods.net/showthread.php?t=246111)

quark 08-12-2014 03:24

Round float values
 
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

HamletEagle 08-12-2014 05:00

Re: Round float values
 
%f is for Floats, lol. Or, with just une digit after the comma: %.1f

YamiKaitou 08-12-2014 05:06

Re: Round float values
 
Quote:

Originally Posted by HamletEagle (Post 2182695)
%s is for floats, lol.

Wrong, %f is for Floats

HamletEagle 08-12-2014 08:03

Re: Round float values
 
This is what I wanted to say, didn't think that someone would care about a capitalized letter....

ddhoward 08-12-2014 08:06

Re: Round float values
 
Quote:

Originally Posted by HamletEagle (Post 2182791)
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'

Nextra 08-12-2014 08:40

Re: Round float values
 
Quote:

Originally Posted by quark (Post 2182665)
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.

HamletEagle 08-12-2014 09:19

Re: Round float values
 
Quote:

Originally Posted by ddhoward (Post 2182795)
's' is not the capitalized form of 'f'

My bad, now I see that I writted %s and not %f.


All times are GMT -4. The time now is 13:07.

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