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:1909:
}
bool IntIsPerfectPower(const Int *value) {
ValidateInt(value);- In
Int.Math.c:612:
bool test_int_is_perfect_power(void) {
WriteFmt("Testing IntIsPerfectPower\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Math.c:620:
Int one = IntFrom(1, &alloc.base);
bool result = IntIsPerfectPower(&power);
result = result && !IntIsPerfectPower(&non_power);
result = result && IntIsPerfectPower(&one);- In
Int.Math.c:621:
bool result = IntIsPerfectPower(&power);
result = result && !IntIsPerfectPower(&non_power);
result = result && IntIsPerfectPower(&one);- In
Int.Math.c:622:
bool result = IntIsPerfectPower(&power);
result = result && !IntIsPerfectPower(&non_power);
result = result && IntIsPerfectPower(&one);
IntDeinit(&power);
Last updated on