NaN value on NewtonBody Position

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: NaN value on NewtonBody Position

Postby Julio Jerez » Sat Nov 19, 2011 10:59 pm

I paste in the code and clal calculate conve hull and it work fine, ther is not problem wi the at mesh.

I do no know what is wrong in Linux that tshio si no working teh math class soudl simple work,
I can not run anything linux now, so I do not know what to do. this is the first time I see that anything like that.

you have to have some bugus compile of GCC because Newton has build fine with GCC.
for what I can see there is a somthong wrokng with CGG and the funtion that get teh matiza form a float

the mantiza is of a extended float is initialisedd in this function.
Code: Select all
dgGoogol::dgGoogol(dgFloat64 value)
   :m_sign(0)
   ,m_exponent(0)
{
   dgInt32 exp;
   dgFloat64 mantissa = fabs (frexp(value, &exp));

   m_exponent = dgInt16 (exp);
   m_sign = (value >= 0) ? 0 : 1;

   memset (m_mantissa, 0, sizeof (m_mantissa));
   m_mantissa[0] = (dgInt64 (dgFloat64 (dgUnsigned64(1)<<62) * mantissa));

// add this asset, thsi can no be a negative value, maybe GCC is no calcucating dgUnsigned64(1)<<62) correctly
_ASSERTE (m_mantissa[0] >= 0);
}


I check in that code, wi the that check. you cna just sync again.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NaN value on NewtonBody Position

Postby Julio Jerez » Sat Nov 19, 2011 11:00 pm

check out if you version of GCC has thsoi funtion

dgFloat64 mantissa = frexp(value, &exp);

as you can see dgFloat64 mantissa = fabs (frexp(value, &exp));

is an absolute value, there is not way that later GCC find it to be negative.
mutiplication of positive number do not produce negative values, I do not know how GCC can get that wrong, only it it generation incorrect arithmetic on 64 bit integers.

try verifying that CGG is making dgInt64 a 64 bit value, and that operation are in fact 64 bit,

for example check to see if dgInt64 x = dgUnsigned64(1)<<62
is a value and not zero.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NaN value on NewtonBody Position

Postby Julio Jerez » Sun Nov 20, 2011 11:30 am

Ok I dusted off my my old laptop and upadte to teh lates uubuntu 10.04 (i think)
I synced to SVN and buidl the engine,
I fix a bunch of warning intrudec bu the new assert,
and I check in teh new syntact fixed I also added the corrent default options to teh make file (removed -fast math)
now I will see if the bug happen in my system with the data you game my.


In teh mean time you cna sicn to teh lates svn an see if I did nio make any errors,
I do not have a mean to run anythong in thsi linux system.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NaN value on NewtonBody Position

Postby Julio Jerez » Sun Nov 20, 2011 1:30 pm

Pk I just finished build teh test app and I past your data in file softBody demo
...\applications\newtonDemos\sdkDemos\demos\SoftBodies.cpp

to make sure teh assert is being call I hard coded the tesst in teh controctor that initialize the extended presion float
Code: Select all
dgGoogol::dgGoogol(dgFloat64 value)
   :m_sign(0)
   ,m_exponent(0)
{
   dgInt32 exp;
   dgFloat64 mantissa = fabs (frexp(value, &exp));

   m_exponent = dgInt16 (exp);
   m_sign = (value >= 0) ? 0 : 1;

   memset (m_mantissa, 0, sizeof (m_mantissa));
   m_mantissa[0] = (dgInt64 (dgFloat64 (dgUnsigned64(1)<<62) * mantissa));

// hack to make sure this is working in linux
assert (m_mantissa[0] >= 0);

   // it looks like GCC have problems with this
   _ASSERTE (m_mantissa[0] >= 0);
}



the code crate the convex hull without any problems, I do not know what is wrong in your side.
in any case maybe you can put the test in some place so that I can run it, but I am positive that those bugs are not in the engine, at least not in the data that you provided.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NaN value on NewtonBody Position

Postby KATO2 » Sun Nov 20, 2011 6:09 pm

Ok, Julio. Thank you for your help.

I changed the large box, to a treecollision as you suggested. and i'm using two thread for physics engine and the error occurs very occasionally. I will continue debugging the program to try to eliminate all errors.

i will sync to svn, and test simulation again. i can put the test in a repository, but, do you have to install many other libraries, because i am using ogre, newton and ogrenewt, also i have object info in a postgreSQL database.

thank you very much again for your help.
KATO2
 
Posts: 23
Joined: Thu Nov 10, 2011 11:16 pm

Re: NaN value on NewtonBody Position

Postby Julio Jerez » Mon Nov 21, 2011 12:33 am

KATO2 wrote:I changed the large box, to a treecollision as you suggested. and i'm using two thread for physics engine and the error occurs very occasionally.

that sounds good, but still not good enough it should not crash ever.
you need to find thebpad geometris that you have in the game and make sure they are replaced with well behave models.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron