UFO:Alien Invasion

Technical support => Feature Requests => Topic started by: pleiades on September 27, 2006, 07:51:22 pm

Title: logf(w) ?? (vc8)
Post by: pleiades on September 27, 2006, 07:51:22 pm
Code: [Select]
void gaussrand(float *gauss1, float *gauss2)
{
float x1,x2,w;

do {
x1 = crand();
x2 = crand();
w = x1 * x1 + x2 * x2;
} while ( w >= 1.0 );


w = sqrt( (-2.0 * logf(w) ) / w );  /// ????????????
*gauss1 = x1 * w;
*gauss2 = x2 * w;
}


c:\svn\ufoai\trunk\src\game\q_shared.c(382) : warning C4100: 'f' : unreferenced formal parameter
c:\svn\ufoai\trunk\src\game\q_shared.c(1217) : error C2143: syntax error : missing ')' before ';'
c:\svn\ufoai\trunk\src\game\q_shared.c(1217) : error C2143: syntax error : missing ';' before ')'
c:\svn\ufoai\trunk\src\game\q_shared.c(1217) : error C2059: syntax error : ')'

Code: [Select]
void gaussrand(float *gauss1, float *gauss2)
{
float x1,x2,w, f;

do {
x1 = crand();
x2 = crand();
w = x1 * x1 + x2 * x2;
} while ( w >= 1.0 );

f = logf(w);
w = sqrt( (-2.0 * f ) / w );   // !!!!!!!!!!!!!
*gauss1 = x1 * w;
*gauss2 = x2 * w;--------------------
}


========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

??????
Title: logf(w) ?? (vc8)
Post by: Mattn on September 27, 2006, 08:43:50 pm
please use code tags - which version are you using? what exactly is the problem here?
Title: logf(w) ?? (vc8)
Post by: pleiades on September 28, 2006, 08:15:35 pm
>>what exactly is the problem here?

Compile as C Code (/TC)

c:\svn\ufoai\trunk\src\game\q_shared.c(382) : warning C4100: 'f' : unreferenced formal parameter
c:\svn\ufoai\trunk\src\game\q_shared.c(1217) : error C2143: syntax error : missing ')' before ';'
c:\svn\ufoai\trunk\src\game\q_shared.c(1217) : error C2143: syntax error : missing ';' before ')'
c:\svn\ufoai\trunk\src\game\q_shared.c(1217) : error C2059: syntax error : ')'

Compile as C++ Code (/TP)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

fixed....