I need to get the numbers after the dot as a integer.
examples:
00.65 -> 65
24.38 -> 38
98.00 -> 0
This is not nwscript related. (Its C++)
Any help appreciated.
Modifié par Xardex, 10 septembre 2011 - 04:00 .
Modifié par Xardex, 10 septembre 2011 - 04:00 .
Modifié par ShaDoOoW, 10 septembre 2011 - 04:15 .
Nicely done :-)Lightfoot8 wrote...
...
int Get2decimalsAsInt(float input)
{
input = (input- FloatToInt( input)) * 100;
return FloatToInt(input);
}
...
It should work like this (assuming float input of yy.xxxx)ShaDoOoW wrote...
Lightfoot: this really works? Thought it will round up the float again.
ShaDoOoW wrote...
Lightfoot: this really works? Thought it will round up the float again.
Modifié par Lightfoot8, 10 septembre 2011 - 07:19 .
Modifié par Xardex, 11 septembre 2011 - 11:18 .
Sweet! :=)Axe_Murderer wrote...
fmod(x,1) *100