AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Float to string precision (https://forums.alliedmods.net/showthread.php?t=53535)

commonbullet 04-05-2007 21:51

Float to string precision
 
I don't know if that's a bug or if it's the expected behavior.

Code:
new fstr[15]    float_to_str(1234.2, fstr, 14)

In this example the string value is 1234.199951

Code:
format(fstr, 14, "%f", 1234.2)
Results in the same stuff...

Greenberet 04-06-2007 07:09

Re: Float to string precision
 
thats how floats are working.
http://steve.hollasch.net/cgindex/coding/ieeefloat.html


All times are GMT -4. The time now is 06:41.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.