[fixed]fast_atof bug'n'suggestion

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
IPv6
Posts: 188
Joined: Tue Aug 08, 2006 11:58 am

[fixed]fast_atof bug'n'suggestion

Post by IPv6 »

Fast_atof incorrectly parsing some floats (which are correctly read by standard atof).

fast_atof("0.43701171875") evaluates to 0.007 instead of 0.437
Error is in "u32 strtol10". It is trying to "atol" value 43701171875 which is bigger than u32 which is causing u32 (DWORD) overflow which is leading to wrong number. i suggest to add limitation to number of characters read after '.' symbol, since they are not that significant at all.

The number itself was exported by script from another software so i think its worth a fix :)
GameRotor-Games and more...
Wiredplane-Shareware utilities...
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I guess the main problem is nobody seems to mind if they write floats or doubles into ascii file formats, even if the spec says floats.
You're right though, it should be limited to 8 chars or less (8 is big enough to hold a 24-bit int)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
CuteAlien
Admin
Posts: 9735
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

It also has troubles with floats, see here: http://irrlicht.sourceforge.net/phpBB2/ ... highlight=
(sorry, I did see this thread only afterwards).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Thanks for the report. This should be fixed in SVN 1647^W 1648.

See bug 1865300 for a test app.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply