SA-MP Forums Archive
Prints returning weird int values converted from floats. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Prints returning weird int values converted from floats. (/showthread.php?tid=450032)



Prints returning weird int values converted from floats. - Kyle - 11.07.2013

How come after I use the floatround it converts 5.4 to some weird number?

Code:
Print of Float- SmallZoneInf[z][x+2] = 5.40
Print of Int = 1085066496

printf("SmallZoneInf[z][x+2] = %0.2f", SmallZoneInf[z][x+2]);
printf("result = %d", floatround(SmallZoneInf[z][x+2], floatround_round));
Thanks


Re: Prints returning weird int values converted from floats. - Misiur - 11.07.2013

Ok, so basically the number 1085066496 shows up when you try to display 5.4 as integer.

pawn Code:
#include <a_samp>

new Float:Test[2][2] = {
    { 5.4, 1.5 },
    { 5.4, 1.5 }
};

main() {
    printf("%d - %d", Test[0][0], floatround(Test[0][0], floatround_round));
    //1085066496 - 5
}
I can't reproduce your case though


Re: Prints returning weird int values converted from floats. - ReVo_ - 11.07.2013

SmallZoneInf[z][x+2]

SmallZoneInf have the Float: tag?


Re: Prints returning weird int values converted from floats. - Kyle - 11.07.2013

Quote:
Originally Posted by ReVo_
View Post
SmallZoneInf[z][x+2]

SmallZoneInf have the Float: tag?
Slap me now, thx. xD