dbxzjq: float fastInvSqrt(const float x) { const float xhalf = x * 0.5f; union { float x; int32_t i; } u; =x; = 0x5f3759df - ( >> 1); //0x5f375a86 return * (1.5f - xhalf * * ); }
快速打开vscode的命令行界面
单片机快速开平方的算法
dbxzjq: float fastInvSqrt(const float x) { const float xhalf = x * 0.5f; union { float x; int32_t i; } u; =x; = 0x5f3759df - ( >> 1); //0x5f375a86 return * (1.5f - xhalf * * ); }