]]>well this is a big help thank u so much guys !!

]]>I've got the whole idea now, Reedbeta.

Thanks again

]]>Well, assuming v1.y and so forth are floats, it doesn't make a difference in this particular case because the compiler will promote ints to floats anytime an int and a float are added/multiplied/whatever.

But before any promotion is done, in C/C++ 16 is an int, 16.0f is a float, and 16.0 is a double.

So, 3 / 2 == 1, because 3 and 2 are ints so the compiler does integer division (truncates the fractional part). But 3.0f / 2.0f == 1.5f. Also 3.0f / 2 or 3 / 2.0f give 1.5f, because the compiler promotes the int to a float.

]]>I know what it is the f at the end of 16.0f but it just doesn't give me a rest as

16.0f == 16.00 == 16

16 * 1.1 = 17.6 and 16.00 * 1.1 = 17.6 this is still the same

or

16 * 1 = 16 and 16.00 * 1 = 16So what is the whole point of telling the compiler that number 16 is a float as it doesn't make any difference???

]]>Thanks so much for your help guys

]]>16.0f is just a floating-point constant (hence the 'f' at the end), where 16 is an integer constant. You can change the 16.0f to just 16, but the compiler will convert it to a floating-point number internally when the code is compiled, assuming that v1.y is a fp number.

]]>I have asked incorrect question, what I want to know is:

is 16.0f equal to 16?

as in language I code it doesn't recognize 16.0f

I have found here: http://www.flipcode.net/archives/The\_Art\_of\_Demomaking-Issue\_03\_Timer\_Related\_Issues.shtml that "Note that 256.0f = 2\\^8, because we have a 8 bit fractional part"

So I assume that 16.0f == 2\\^4 which is simply 16, so if I make

const int Y1 = iround(16 * v1.y);should be correct, am I right ???

]]>Like the comment says it's converting to 28.4 fixed-point. This means the 32-bit integer is considered to have 28 bits left of the radix point and 4 bits to the right. Another way to say it is that it's counting the coordinates in units equal to 1/16th of a pixel (2\\^4 = 16). So the float pixel values are multiplied by 16 first. You can google for fixed point if you're not familiar with it.

]]>this is such a basic question I know and I am sorry, but I don't know C at all and there I found this piece of code with rounding float to the nearest integer with sub pixel accuracy which is this " 16.0f * "

Cited Code

// 28.4 fixed-point coordinates

const int Y1 = iround(16.0f * v1.y);

const int Y2 = iround(16.0f * v2.y);

const int Y3 = iround(16.0f * v3.y);Could someone explain to me what exactly means "16.0f" I tried to Google it but without any luck.

Regards

D.