Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Problems with Floats

Author
Message
DrT
15
Years of Service
User Offline
Joined: 10th May 2008
Location: 26.78 degrees North, -70.49 degrees West
Posted: 4th Dec 2011 13:21
According to the AppGameKit documentation, floats are supposed to range from 3.4 E +/- 38.

1) You can not hard wire 3.4E38 into your program. It ends up being 0 after compiling.
2) You can not write it out in terms of all the zeros either.
3) If you try to build the float up to the maximum or minimum values, these don't behave as expected either.

I'll report this at http://code.google.com/p/agk/issues/list.

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 8th Dec 2011 00:20
If anyone knows 100% what the correct values returned should be, please post in the Google Issues Board so I have a number of perspectives before I tackle this one. As I reported to the poster, I don't spend much time around the fussy edges of large number systems

I drink tea, and in my spare time I write software.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 8th Dec 2011 12:33
IEEE has maximum at 3.4028234 × 10^38 for single precision floats.

This could be either a compiler problem or a processor implementation issue.

-- Jim
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Dec 2011 00:23
If any information around this issue can be added to the issues board bug entry, that would be useful so we don't lose this info in the threads Thanks!

I drink tea, and in my spare time I write software.
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 9th Dec 2011 05:10
Hello!

Lee, I write this information here in addition to the issues board because it can be of interest for anyone.

May be will be useful to say that Microsoft uses the IEEE 754 floating-point standard, mainly used for x86. It requires that numbers have to be stored in binary format. Others stores the floats in ASCII. And if the format is not compatible with the platform it can give erroneous results sometimes without warnings.

If the standar used is C99, I'm not sure but I think its not supported by Microsoft from Visual C++ 2010

Comment: Its possible to adjust the results using i.e. the round() function but it may take some time to find the correct format for the needs of the application.

Regards!

Login to post a reply

Server time is: 2024-05-05 21:58:37
Your offset time is: 2024-05-05 21:58:37