This question already has an answer here:
- Is floating point math broken? 20 answers
Why am I getting an assert error from the following code and how could I fix it?
double res = 1;
for(int i = 0; i < n; i++)
{res*=x;}
assert(pow(x, n) == res);
n is unsigned int, x is double.
Aucun commentaire:
Enregistrer un commentaire