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 / trapping -1.#IND00

Author
Message
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Feb 2014 00:07 Edited at: 20th Feb 2014 00:08
Anyway of trapping the above out of range float value?

(This only started happening when I upgraded to a new PC with a I7-4960X cpu in it...)

Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 20th Feb 2014 06:47 Edited at: 20th Feb 2014 09:23
Hi nz0,

how is the value produced? I've found that I get weird results if I do this:



while doing this works fine:



Normal integers add or subtract fine with both examples. It's only the floats that produce extreme values.
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Feb 2014 09:21
There was a reported issue with INC and DEC on floats.

-- Jim - When is there going to be a release?
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 20th Feb 2014 13:39
I haven't used inc and dec as I encountered problems with it before.
I should also add that I have moved to Windows 8.1 as well and considering there was a bug fix for the windows player on Windows 8, could this also be a factor?

Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 20th Feb 2014 19:36
Quote: "I should also add that I have moved to Windows 8.1 as well and considering there was a bug fix for the windows player on Windows 8, could this also be a factor?"


That might cause it. Perhaps we can test it empirically. If you have some test-code for us, I (and maybe other users) can test it for you. I have machines with Windows 7 x64 pro and home, and a couple of android devices. If other users have a Windows 8 setup like yours, we can see if the float acts weird on the whole range of machines or only on a specific subset.
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 21st Feb 2014 00:49
Be difficult to isolate it, due to where it is in the code.
Will try to narrow it down a bit.

The original question was how can I test for it?

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Feb 2014 05:40
Only way I can think of wouldn't be very efficient. Convert it to a string.

nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 22nd Feb 2014 12:48
I'm pretty sure that would fail, as the input value would not be a float any more.

In other languages, you could catch exceptions and handle them according to what type they were. In javascript, I think you could test for isNaN() - is "not a number".

Anyway, I have upgraded to the 108.21 version so I will see if I can repeat the condition.

nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 22nd Feb 2014 20:16
After putting loads of traps in, I tracked this down eventually to my timer based movement routine.
Since upgrading my PC, I get over 1000fps which is great, but which means that frames can take 0 milliseconds to update (there is no more precision than this).

Under some conditions, I calculate something which is based on the current/previous frame difference which is divided with:



(The MasterTimer.Adjust# value could sometimes be 0.0 now that I have an amazing new PC )

I have had to add the following line to my timer based movement routine, which ensures that I will avoid possible divide by zero.



@Phaelax: Yes, I checked for the string value which helped me narrow it down. Phew!!

May be worth checking your timer based movement routines (if you use them) as when you hit 1000fps, you will need to handle this.

Zwarteziel
13
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 23rd Feb 2014 09:14
Glad you found the source of the problem! Tough this might indeed become a problem on newer machines in the future. (Part of me wishes I had the money to observe such problems firsthand )

Login to post a reply

Server time is: 2024-05-09 21:34:20
Your offset time is: 2024-05-09 21:34:20