src/math.c
double sqrt_(double x) {
#ifdef USE_STDLIB_
    #include <math.h>
    return sqrt(x);
#else
    /* Newton's method. */
    double result = x / 2;
    double temp = 0.0f;

    while (temp != result) {
        temp = result;
        result = (temp + x / temp) / 2;
    }

    return result;
#endif
}
/**
 * Takes the square root of a number. Has a secondary implementation for when the math library is not available.
 *
 * The secondary implementation is slow, but the function will rarely be used in the library and can be swapped out
 * for a faster implementation if one exists in the target toolchain.
 *
 * Note: the function does not verify that the value is negative.
 *
 * Parameters:
 * - x: The number to take the square root of.
 *
 * Returns:
 * - The square root of x.
 */
Takes the square root of a number. Has a secondary implementation for when the math library is not available.
The secondary implementation is slow, but the function will rarely be used in the library and can be swapped out
for a faster implementation if one exists in the target toolchain.

the function does not verify that the value is negative.

- x: The number to take the square root of.

- The square root of x.
Takes the square root of a number . Has a secondary implementation for when the math library is not available . The secondary implementation is slow but the function will rarely be used in the library and can be swapped out for a faster implementation if one exists in the target toolchain . the function does not verify that the value is negative . - x : The number to take the square root of . - The square root of x .
double sqrt_(double x) {
#ifdef USE_STDLIB_
    #include <math.h>
    return sqrt(x);
#else
    double result = x / 2;
    double temp = 0.0f;
    while (temp != result) {
        temp = result;
        result = (temp + x / temp) / 2;
    }
    return result;
#endif
}
double sqrt_ ( double x ) { #ifdef USE_STDLIB_ #include <math.h> return sqrt ( x ) ; #else double result = x / 2 ; double temp = 0.0f ; while ( temp != result ) { temp = result ; result = ( temp + x / temp ) / 2 ; } return result ; #endif }
Takes the square root of a number.
Takes the square root of a number .
/* Newton's method. */