IntIsPerfectSquare
Description
Test whether a value is a perfect square.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Value to test |
Usage example (from documentation)
bool square = IntIsPerfectSquare(&value);Success
Returns true when value = n^2 for some integer n.
Failure
Returns false otherwise.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:1890:
}
bool IntIsPerfectSquare(const Int *value) {
ValidateInt(value);- In
Int.Math.c:595:
bool test_int_is_perfect_square(void) {
WriteFmt("Testing IntIsPerfectSquare\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Int.Math.c:602:
Int non_square = IntFrom(145, &alloc.base);
bool result = IntIsPerfectSquare(&square);
result = result && !IntIsPerfectSquare(&non_square);- In
Int.Math.c:603:
bool result = IntIsPerfectSquare(&square);
result = result && !IntIsPerfectSquare(&non_square);
IntDeinit(&square);
Last updated on