[Include] float2.inc - Additional operators for floats
#6

pawn Код:
new Float:val1 = 33.123, val2;
val2 = val1;
printf("val2 = %i", val2); // val2 = 33
variable = Float:value is actually a mirroring operator for floatround. The line which allows assigning float values to integer variables is here:

pawn Код:
native operator=(Float:oper) = floatround;
These codes are equivalent:
pawn Код:
new Float:val1 = 33.123, val2;
val2 = val1;
printf("val2 = %i", val2); // val2 = 33
pawn Код:
new Float:val1 = 33.123, val2;
val2 = floatround(val1);
printf("val2 = %i", val2); // val2 = 33
I actually don't recommend using this part of the include and i'm still thinking of removing it as it might cause confusion and I prefer to see the tag mismatch warning.
Reply


Messages In This Thread
float2.inc - Additional operators for floats - by kristo - 14.07.2015, 09:36
Re: float2.inc - Additional operators for floats - by kristo - 22.07.2015, 17:32
Re: float2.inc - Additional operators for floats - by CodeStyle175 - 23.07.2015, 09:20
Re: float2.inc - Additional operators for floats - by kristo - 23.07.2015, 09:32
Re: float2.inc - Additional operators for floats - by CodeStyle175 - 23.07.2015, 09:36
Re: float2.inc - Additional operators for floats - by kristo - 23.07.2015, 09:42

Forum Jump:


Users browsing this thread: 3 Guest(s)