Bedtime. /Math Utilities

Math Utilities

Fast math functions optimized for embedded use

uint32_t isqrt(uint32_t n)

Fast integer square root

uint32_tnInput value

Returns — Integer square root of n

uint32_t r = isqrt(10000);  // Returns 100
int16_t isin(uint16_t angle)

Fast sine approximation

uint16_tangleAngle in degrees (0-360)

Returns — Sine value scaled to int16_t range (-32768 to 32767)

int16_t icos(uint16_t angle)

Fast cosine approximation

uint16_tangleAngle in degrees (0-360)

Returns — Cosine value scaled to int16_t range (-32768 to 32767)