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.

DarkBASIC Professional Discussion / 1.#QNANO error. Coordinates all screwy

Author
Message
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 30th Apr 2011 01:10
So this is a problem that Iv'e been working on for a long time. At the beginning of the game there is no ai until you talk to someone which initiates it. I know that the problem happens when I start using the ai. Every once in a while when I go to move after starting the ai it freezes, then the screen turns black, and the x y and z coordinates are all replaced by 1.#QNANO.

I've tried to find and fix the problem for a couple months now... to no avail...

Any help is much appreciated
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Apr 2011 01:28
You will need to provide more information/details such as code otherwise the best anyone can do is guess.

A clever person solves a problem, a wise person avoids it - Albert Einstein
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 30th Apr 2011 03:28
It means you're dividing zero by zero somewhere and then positioning the camera at that value position.

[b]
tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 30th Apr 2011 03:31
Are you using Newton wrapper? I've seen that occur in Newton, but don't know why. I found ways to avoid it.


A 3D marble platformer using Newton physics.
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Apr 2011 04:08
@ Diggsey, doesn't that cause a runtime error and the program has to close?

but I wouldn't rule out an illegal maths operation such as squarerooting a negative number.

A clever person solves a problem, a wise person avoids it - Albert Einstein
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 30th Apr 2011 09:57 Edited at: 30th Apr 2011 10:01
Integer division by zero causes a runtime error

floating point division by zero returns an error code meaning "not a number"(NAN)

soo


[edit]

What's really bad is that most floating point operations involving a #NAN return #NAN, so you can get cascading floats that aren't numbers.

Also, I have a thread in [code snippets] with functions to determine if a float is a number or not.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 30th Apr 2011 14:20
Thanks for the explanation N Fuzzy and my apologies to Diggsey. One thing though, this prints "0" for me, am I missing something?



A clever person solves a problem, a wise person avoids it - Albert Einstein
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 30th Apr 2011 21:50
It seems that DBPro has some checks in so if you divide by zero it replaces it by zero. Seems a bad idea to me

You can see the effect with something like this code though:


[b]
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 2nd May 2011 23:59
Sorry it took me so long to reply. I don't know where the error would be at all and my program is quite big. I can't very well have you guys sift through the whole dang thing for hours trying to find my error. The big thing is that sometimes it works perfect, and then sometimes it does the 1.#QNANO. There must be something that makes it change!
Hodgey
16
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 3rd May 2011 02:25
Trig functions will can also return things like -1.#IND such as asin(1.3). So if you are using trig funtions, check what numbers go into them.

A clever person solves a problem, a wise person avoids it - Albert Einstein
Mychal B
15
Years of Service
User Offline
Joined: 21st Jul 2010
Location: Coos bay, rainville
Posted: 20th May 2011 20:53
I just thought that I would post this for anyone looking for an answer. I worked on increasing the performance of my game and bingo!

Every time I leveled up I would go directly to the code to respawn a good number of zombies and it would not return until all of them were made. This caused a slow down for a couple seconds, and during those seconds it wasn't receiving any of the movment information.

By only respawning one zombie per game loop and then checking to see if all of the zombies were done yet I eliminated the error and vastly increased performance.

Login to post a reply

Server time is: 2026-07-10 16:12:44
Your offset time is: 2026-07-10 16:12:44