I just finished converting this piece of code to masm:
	for (int c=0;c<=Points;c++)

{
double deltaangle=2.0*3.1415926/(double)c;
alpha1[c]=2.0*sin(0.5*deltaangle)*sin(0.5*deltaangle);
beta1[c]=sin(deltaangle);
deltaangle=-2.0*3.1415926/(double)c;
alpha2[c]=2.0*sin(0.5*deltaangle)*sin(0.5*deltaangle);
beta2[c]=sin(deltaangle);
}


If you look at it closely, the author has 'deltaangle' definined to be 2Pi/Count. Where count starts at 0. So this means the first term is infinite, and then getting the sine of this.

My question is, is this an ok practice for C++? Does C++ put check code in for this scenario, or can a direct tanslation to the FPU work with out a hitch?

Thanx
:NaN:
Posted on 2002-05-24 12:25:07 by NaN

It was a specific design decision of C++ not to handle divide-by-zero. Whereas Java and Ada, for example, take the opposite view. Why? The usual answers -- efficiency and an assumption that C++ will tend to be used with more of an awareness of the hardware.


Looks like do direct conversion for joo!
Posted on 2002-05-24 12:52:47 by Graebel
" Quiet NaNs
A Quiet NaN, when used as an operand in any floating point operation, quietly (that is without causing any trap or exception) produces another quiet NaN as the result, which, in turn, propagates. A Quiet NaN has a 1 set in the most significant bit-position in the mantissa field. See the picture. The 1 outside the bit-pattern box is the hidden-one, signifying normalized number. The `S' is the sign-bit, indicating that a Quiet NaN can be of either sign.

A Quiet NaN

Quiet NaNs are produced, when you do things like try to take the square root of a negative number, divide by zero, etc. Modern FPUs have the ability to either produce a quiet NaN, or raise a signal of some sort, when they encounter such operands on such instructions. They can be initialized to do either of the two options, in case the code runs into these situations. "


http://www.serc.iisc.ernet.in/~ghoshal/fpv.html#nan
Posted on 2002-05-24 14:29:55 by bdjames
Thanx for the help on this... I will continue with the direct translation, and if i run into problems here l8r on, i will be armed with the idea that there is a NaN on the loose :grin:

Thanx again!
:alright:
NaN
Posted on 2002-05-24 15:47:36 by NaN