IntIsPerfectPower
Description
Test whether a value is a perfect power.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Value to test |
Usage example (from documentation)
bool power = IntIsPerfectPower(&value);Success
Returns true when the value can be written as a^b with b > 1.
Failure
Returns false otherwise.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:2206:
}
bool IntIsPerfectPower(const Int *value) {
ValidateInt(value);- In
Math.c:622:
bool test_int_is_perfect_power(void) {
WriteFmt("Testing IntIsPerfectPower\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:630:
Int one = IntFrom(1, &alloc.base);
bool result = IntIsPerfectPower(&power);
result = result && !IntIsPerfectPower(&non_power);
result = result && IntIsPerfectPower(&one);- In
Math.c:631:
bool result = IntIsPerfectPower(&power);
result = result && !IntIsPerfectPower(&non_power);
result = result && IntIsPerfectPower(&one);- In
Math.c:632:
bool result = IntIsPerfectPower(&power);
result = result && !IntIsPerfectPower(&non_power);
result = result && IntIsPerfectPower(&one);
IntDeinit(&power);- In
Math.c:1869:
// on real code and fails under the mutant.
bool test_m18_perfect_power_max_degree_only(void) {
WriteFmt("Testing IntIsPerfectPower hits exponent == max_degree (32 = 2^5)\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Math.c:1880:
Int square_anchor = IntFrom(64, &alloc.base);
bool result = IntIsPerfectPower(&boundary);
result = result && IntIsPerfectPower(&square_anchor);- In
Math.c:1881:
bool result = IntIsPerfectPower(&boundary);
result = result && IntIsPerfectPower(&square_anchor);
IntDeinit(&boundary);- In
Math.c:4114:
Int npw = IntFrom(7777u, a);
bool ok = IntIsPerfectPower(&pw) && !IntIsPerfectPower(&npw);
IntDeinit(&pw);
Last updated on