{
// TODO: Add your control notification handler code here
int i,j,k;
/*errorfilemark++;*/
CString filename;
CString str;
filename.Format ("网络最终权值%d.txt"/*,errorfilemark*/);
CFile file (filename, CFile::modeReadWrite|CFile::modeCreate);
CString str_file;
char buffer[2]={13,10};
str_file.Format ("网络训练最终结果-隐层和输出层的权值与偏置:");
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
str_file.Format ("*************************隐层的:*****************************");
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
for(i=0;i<5;i++)
for(j=0;j<8;j++)
{ str_file.Format ("W1(%2d,%2d): %f",i,j,Vij[i][j]);
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
}
for(j=0;j<8;j++)
{ str_file.Format ("B1(%d): %f",j,Bij[j]);
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
}
file.Write (buffer,sizeof(buffer)); file.Write (buffer,sizeof(buffer));
str_file.Format ("*************************输出层的:*****************************");
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
for(j=0;j<8;j++)
for(k=0;k<5;k++)
{ str_file.Format ("W2(%2d,%2d): %f",j,k,Wjk[j][k]);
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
}
for(k=0;k<5;k++)
{ str_file.Format ("B2(%d): %f",k,Bjk[k]);
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
}
file.Write (str_file, str_file.GetLength());
file.Write (buffer,sizeof(buffer));
str.Format ("训练后的网络最终权值、偏置输出到: 网络最终权值%d.txt 中 "/*,errorfilemark*/);
::AfxMessageBox(str);
}
3 个解决方案
#1
1.#QNAN 是浮点数溢出的标志
估计有除零 开方负数 对数负数等操作
估计有除零 开方负数 对数负数等操作
#2
估计哪个地方超出数值表示范围,楼主仔细查看下
#3
你的除数有0的地方,找找
#1
1.#QNAN 是浮点数溢出的标志
估计有除零 开方负数 对数负数等操作
估计有除零 开方负数 对数负数等操作
#2
估计哪个地方超出数值表示范围,楼主仔细查看下
#3
你的除数有0的地方,找找