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 Discussion / [LOCKED] Da hell is QNAN?

Author
Message
daViet
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: Iceworld
Posted: 16th Aug 2004 23:14
I'm tryin to make this racing physics engine which involves some moderate complexity equations such as a 4 or 5 variables getting times and divided together and adding them with another such and such. When I try to put da engine into play, nothing happens. Printing out da variables values onto da screen yields crap like 1.#QNAN... WTF is dis? Does that mean infinity or something? Does DBC have a limit to the amount of times vars cood get multiplied?

<<<--- Nissan s15 200sx Silvia
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 16th Aug 2004 23:51
Was that in English? Anyone? Or maybe he mistook the Post Message box for a mobile phone text message.

"I am not young enough to know everything."
- Oscar Wilde
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 16th Aug 2004 23:56
post a small snippet that yields the same results

SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 17th Aug 2004 00:26
I had a similar problem with a formula giving me the response of 1.#IND so I'll be watching close too. I solved the IND problem at the time, though not sure I remember what I did right now.

Any truly great code should be indisguishable from magic.
daViet
20
Years of Service
User Offline
Joined: 8th Jul 2004
Location: Iceworld
Posted: 18th Aug 2004 02:57
Quote: "wtf is commonly used around here as What the f***!
Just thought I'd let you know"

for ur sake, no i didn't wanna know, nor do i give. If u haven't figured it out already, I was playin wen i wrote all those interpretations, jus like when da admin guy was jokin bout sayin my post was a sms message.. at least i think he was .

Anyways, forget da crap i put up b4 (i'm allow 2 say crap ryte?), there was nothing wrong with that one. Here's the code that screwy:


<<<--- Nissan s15 200sx Silvia
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 18th Aug 2004 09:19
Yeah... using those values and forumlae and just running through a first approximantation of the results, I would say the values are growing so large (or so small) so quickly that it's causing an overflow. I may be wrong in that accessment, but since the math loops with some very large values, (P#=12,400,000 on first pass, c#=126,480,000 on second) that might be why the odd result shows up.

Any truly great code should be indisguishable from magic.
Calculus
21
Years of Service
User Offline
Joined: 22nd Feb 2004
Location: Earth
Posted: 20th Aug 2004 07:00
Just had a brief look at this.

It seems that your equation is iterating itself inside the loop and producing an ever increasing value until it hits negative infinity. When it does this and repeats one more calculation it will present the answer as -1.#IND. This happens because you cannot perform a mathematical operation on infinity.

1.#QNAN - Quiet Not a Number
This is used when a mathematical operation is performed on inappropriate data, such as strings or the undefined value. Sometimes displayed when outside numerical limits.

1.#INF - Infinity (A number too large to evaluate)

-1.#INF - Negative infinity (A negative number too large to evaluate)

-1.#IND - Indefinite / Indeterminate (Can be caused by finding the square root of a negative number or a mathematical operation / state that is not recognised)

The drag force equation looks vaguely familiar however the other one I am not sure about.

It would be helpful if we knew what was being calculated in the equation that fails i.e. Acceleration, tractive effort, momentum, gradient forces etc.

Maybe if you put in the main loop the variables it will stop iterating itself but as I mentioned above we need to know exactly what it is for.



Kind Regards Calculus
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 21st Aug 2004 15:54
Wow,
that was some hardcore flamin.
Maybe it's just some coders get irritated that while they spend hours daily using all sorts of shortcut grammar programming they still force themselves to use perfect grammar. My standpoint is I just want to be able to understand you completely.

now that that crap's outta the way:

I ran your first snippet through DBC. I'm guessing you're using Classic since this is the classic board?

Try putting your problem down on paper and doing a deskcheck first.

Define what you are trying to do, write out the process. Declare all the variables you need, check it with brain/easy to use calculator, and then put it in code.
We'd be able to help you better if we knew what you were trying to do. I don't know...looks like...flight physics?

Crazy Donut Productions, Current Project: Project Starbuks
Sony stole our name!

Login to post a reply

Server time is: 2025-05-25 12:45:47
Your offset time is: 2025-05-25 12:45:47