Very basic questions but hard to find in google!

return sqrt(eps - 2.*log(eps + rand()/(double) RAND_MAX))*cos(rand()*pi2/RAND_MAX);

The part of the formula where it says "2.*log". I belive the "dot" only represnts that the number 2 is 2.0. However, I am not 100% sure about this as I actually dont see the reason to put "2." instead of just "2" So, does the "dot" indicate 2.0 or does it represent something else?

Second basic question:

aux += ((K-Sp)>0?K-Sp:0)

What does the "?" mean and what does the ":" mean.

Thanks alot
YR

1) yes, 2. just means 2.0

2) That is just a shorthand if-else statement. You have to be careful with that because occasionally I've found that it doesn't work correctly.

if( K-Sp) > 0)
    aux += K-SP;
else
    aux += 0;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.