小编Ror*_*can的帖子

什么是“-1.#IND”?

我有一些代码可以让我绘制新月形状,并提取了要绘制的值。然而,有些数字已经到位了-1.#IND。首先,如果有人可以解释这意味着什么,因为谷歌返回了 0 个链接。其次是否有办法阻止它发生。

我的代码有一个简短的类比。除此之外我还有很多代码,但这只是计算角度。

for(int j=0; j<=n; j++)//calculation for angles and output displayed to user
{
    Xnew2 = -j*(Y+R1)/n; //calculate x coordinate
    Ynew2 = Y*(pow(1-(pow((Xnew2/X),2)),0.5));
    if(abs(Ynew2) <= R1)
        cout<<"\n("<<Xnew2<<", "<<Ynew2<<")"<<endl;
}
Run Code Online (Sandbox Code Playgroud)

更多信息

我现在遇到这个代码的问题。

for(int i=0; i<=n; i++) //calculation for angles and output displayed to user
{                                          
    Xnew = -i*(Y+R1)/n; //calculate x coordinate
    Ynew = pow((((Y+R1)*(Y+R1)) - (Xnew*Xnew)), 0.5); //calculate y coordinate
Run Code Online (Sandbox Code Playgroud)

for(int j=0; j<=n; j++)//calculation for angles and output displayed to user
{
    Xnew2 = -j*(Y+R1)/((n)+((0.00001)*(n==0))); //calculate …
Run Code Online (Sandbox Code Playgroud)

c++ floating-point

4
推荐指数
1
解决办法
4213
查看次数

标签 统计

c++ ×1

floating-point ×1