mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-08-08 13:25:12 +00:00
16 lines
593 B
C
16 lines
593 B
C
/// @file
|
|
/// Table-based implementation of integer square sqr() and square root sqrt()
|
|
|
|
/// Initialize squares table
|
|
/// Uses iterative formula (x+1)^2 = x^2 + 2*x + 1
|
|
void init_squares();
|
|
|
|
/// Find the square of a char value
|
|
/// Uses a table of squares that must be initialized by calling init_squares()
|
|
unsigned int sqr(char val);
|
|
|
|
/// Find the (integer) square root of a unsigned int value
|
|
/// If the square is not an integer then it returns the largest integer N where N*N <= val
|
|
/// Uses a table of squares that must be initialized by calling init_squares()
|
|
char sqrt(unsigned int val);
|