您好,我有以下代码段
for(int k = 0; k< 1000; ++k)
{
double acc = 1.0;
if(...)
{
short amSeq = 100;
for (short c = 0; c <= 21; ++c)
{
for (short kk = (Range.uSequences[k][c]), s = SeqComp[c]; kk != 0; --kk, --s, --amSeq)
{
acc *= static_cast<double>(s) / amSeq;
}
}
}
else
acc = 0;
}
我想知道是否有任何方法可以优化acc *= static_cast<double>(s) / amSeq;
删除 static_cast 的行将速度提高 200 倍,但显然会产生不正确的结果。谢谢