mercredi 20 septembre 2017

Assert in a power function implementation in C++ [duplicate]

This question already has an answer here:

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