Str to float
Whats the different between those two natives
str_to_float & floatstr for some reason str_to_float gives false outputs. |
Re: Str to float
Where did you even find strfloat?
Quote:
|
Re: Str to float
1 Attachment(s)
Quote:
Sorry i meant floatstr, here is the code. Try changing floatstr to str_to_float. |
Re: Str to float
If you want to prove that a native isn't working properly then create a smallest possible script that proves it. I'm not going to run that, especially because it depends on other plugins which I'd have to search for.
These two natives are nearly equal, but everyone pretty much uses str_to_float - it has a more descriptive name. |
Re: Str to float
Quote:
|
Re: Str to float
floatstr uses atof from the C standard library, while str_to_float has its own implementaton. atof can accept more input, but is also subject to change. For example in C++11 it had more functionality added (acceps hexadecimal, infinity and NaN values). It seems that floatstr is a relic from AMX days or even earlier as it uses old ways of retrieving strings from Pawn.
In general, for ordinary float values there is absolutely no difference. atof information: http://www.cplusplus.com/reference/cstdlib/atof/ str_to_float implementation: https://github.com/alliedmodders/amx...tring.cpp#L482 |
All times are GMT -4. The time now is 12:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.