Last active
August 29, 2015 14:27
-
-
Save ziggi/1796cb43eed67d8abe7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stock Float:floatsuperround(Float:value, count) | |
{ | |
new | |
Float:intpart = float(floatround(value, floatround_tozero)), | |
Float:fractpart = floatfract(value) * float(pow(10, floatfractlength(value))); | |
return intpart + fractpart / float(pow(10, count)); | |
} | |
stock pow(value, degree) | |
{ | |
new | |
result = 1; | |
while (degree--) { | |
result *= value; | |
} | |
return result; | |
} | |
stock floatfractlength(const Float:value) | |
{ | |
new | |
length = 0, | |
Float:temp = value; | |
while (floatfract(temp) != 0) { | |
temp *= 10; | |
length++; | |
} | |
return length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment