The following warnings occurred:
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 94 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "lockoutexpiry" - Line: 573 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 573 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $can_access_moderationqueue - Line: 752 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 752 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 892 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 892 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $awaitingusers - Line: 34 - File: global.php(959) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(959) : eval()'d code 34 errorHandler->error
/global.php 959 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 1024 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 1024 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5308 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5308 errorHandler->error
/global.php 1024 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1474 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1474 errorHandler->error
/inc/functions.php 1429 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Forums
NaN error. - Printable Version

+- Forums (https://www.vdrift.net/Forum)
+-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4)
+--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9)
+--- Thread: NaN error. (/showthread.php?tid=460)



NaN error. - pwp71 - 11-30-2006

What does it mean "Detected NaN in origin vector" and what I have to do?

Thanks. PwP71


- thelusiv - 11-30-2006

It's hard to tell what we need to do to fix these. They are caused by bugs in the collision detection code.


- pwp71 - 12-19-2006

ok, I've understood what is the problem in some NaN cases Smile

Keep attention to:
- division by 0
- sqrt( -x )
are the root cause of many problem.

In this case some "Detected NaN in elevation" were due to this formula:

u = alpha / ((v * (alpha_11 - (1.0))) + (1.0));

Sometimes, v = 1 and alpha_11 = 0, so -> u = alpha / 0 -> NaN

"Detected NaN in origin vector" is still open but I'm working also on it.

Tell me a feedback about "Detected NaN in elevation". Thanks.

pwp71

P.S. done, rev. 1439


- joevenzon - 12-19-2006

Good catch! Are you sure we should be returning false for this case, though?


- pwp71 - 12-20-2006

I've tried to use:

u = alpha / 0.00001
or
return false

both work.

I've preferred to use "return false" looking at other code, like:
Code:
        if (D < 0) return false;
        float Q = (-0.5) * (B + ((B < (0.0) ? (-1.0) : (1.0))
          * std::sqrt(D)));
in the same function.

You know this code much better than me, feel free to modify my solution.

pwp71


- thelusiv - 12-21-2006

Good work, I have been playing a lot while testing cars lately, and haven't hit a NaN error in a long time! Thanks very much Smile


- pwp71 - 12-27-2006

Some "Detected NaN in origin vector" are due at this operation:
FIle: Suspension.cc
line 163:
Code:
m_angle = asin (z / m_radius_magnitude);

"z / m_radius_magnitude" should be included between -1.0 and 1.0
Some values are <or> and this make NaN error.

I've used this code
Code:
if( (z / m_radius_magnitude) > 1.0 )
{
   m_angle = asin (1.0);
}
else if ( (z / m_radius_magnitude) >= -1.0 )
{
  m_angle = asin (z / m_radius_magnitude);
}
else
{
   m_angle = asin (-1.0);
}

The stability of game getting better, but there are something wrong.
So, I've continued to investigate.
The problem seem to be:
file: Whell.cc
line 146:
Code:
Three_Vector disp =
    (m_normal * distance).back_project (Three_Vector (0.0, 0.0, -1.0));

One of my trials was to substitute : back_project -> project
Code:
Three_Vector disp =
    (m_normal * distance).project (Three_Vector (0.0, 0.0, -1.0));

With this modify the game is very stable about NaN error, but is more sensible
when car hit an object. Sometime, the car also goes in free fall.
I don't understand what happen yet Sad
Someone have any idea.

Try my modifies and tell me what do you think about that.
If is your opinion is ok I'll commit two files.

Thanks. pwp71.


- joevenzon - 12-27-2006

You should keep it as back_project. I checked in a change that should ensure that back_project never sets anything to NaN. There was already a check for this, but I tried to enhance it.


- pwp71 - 12-28-2006

The modify doesn't work.
To generate a simple,origin NaN error, you must:
- use pau circuit
- go to double curves with a statue on the left
- go out of the main roads passing between the statue and guardrail "dunloop"
- go to the corner, turn on the right and point sidewalk on the left.
- when 3 tires go up to the sidewalk NaN error occurs.

Use before:
Suspension.cc line ~163
Code:
instead:
m_angle = asin (z / m_radius_magnitude);

use:
  if( (z / m_radius_magnitude) > 1.0 )
  {
    m_angle = asin (1.0);
cout << "asin (-1.0)\n";
  }
  else if ( (z / m_radius_magnitude) >= -1.0 )
  {
    m_angle = asin (z / m_radius_magnitude);
  }
  else
  {
    m_angle = asin (-1.0);
cout << "asin (-1.0)\n";
  }
to catch the error.

pwp71

P.S. I've done a replay, but I don't know where download them.
Is it possible to have a common area to download files?
[/code]


- joevenzon - 12-28-2006

I tried your substitution into suspension.cc, and it makes sense, but I never get the cout statements.

What car are you using? I don't get NaN errors at that point in Pau in the T73 or AX2, although the cars do flip out.


- joevenzon - 12-28-2006

pwp71 and I had a chat on IRC and I checked in some fixes.