diff options
Diffstat (limited to 'include/gmisc/gmisc.h')
-rw-r--r-- | include/gmisc/gmisc.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/gmisc/gmisc.h b/include/gmisc/gmisc.h index 5943e642..ff3d0c76 100644 --- a/include/gmisc/gmisc.h +++ b/include/gmisc/gmisc.h @@ -184,6 +184,23 @@ extern "C" { /** @} */ #endif +#if GMISC_NEED_INVSQRT + /** + * @brief Fast inverse square root function (x^-1/2) + * @return The approximate inverse square root + * + * @param[in] n The number to find the inverse square root of + * + * @note This function generates an approximate result. Higher accuracy (at the expense + * of speed) can be obtained by modifying the source code (the necessary line + * is already there - just commented out). + * @note This function relies on the internal machine format of a float and a long. + * If your machine architecture is very unusual this function may not work. + * + * @api + */ + float invsqrt(float n); +#endif #ifdef __cplusplus } #endif |