1
Dependencies: mbed-dev-f303 FastPWM3
FastMath/FastMath.cpp
- Committer:
- Jasper_gu
- Date:
- 2020-08-14
- Revision:
- 56:d34e4540ec12
- Parent:
- 51:b0a3ef66ea3d
File content as of revision 56:d34e4540ec12:
#include "FastMath.h" #include "LUT.h" const float Multiplier = 81.4873308631f; float FastMath::FastSin(float theta){ while (theta < 0.0f) theta += 6.28318530718f; while (theta >= 6.28318530718f) theta -= 6.28318530718f; return SinTable[(int) (Multiplier*theta)] ; } float FastMath::FastCos(float theta){ return FastSin(1.57079632679f - theta); } //========HJB added=====// int FastMath::Sgn(float d){ if(d<0) return -1; else if (d==0) return 0; else return 1; }