#undef NDEBUG #include "Utils.hpp" #include #include #include using namespace Utils; using namespace std; static double const TEST_BASE = 0.9; double exponentiation(double base, int power_arg) noexcept { precondition(power_arg >= 0, "power_arg >= 0"); int power = power_arg; double result = 1.0; 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; }