#undef NDEBUG #include "Utils.hpp" #include #include #include using namespace std; static double const TEST_BASE = 0.9; double exponentiation(double base, int powerArg) noexcept { precondition(powerArg >= 0, "powerArg >= 0"); int power = powerArg; double result = 1; while (power > 0) { result *= base; --power; } return result; } int main(int argc, char **argv) { for (int p = 10; p >= -1; --p) { cout << fmt::format("{0:f} ^ {1:d} = {2:f}", TEST_BASE, p, exponentiation(TEST_BASE, p)) << endl; } return 0; }