Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
FastMath.cpp
00001 #include "FastMath.h" 00002 #include "LUT.h" 00003 00004 const float Multiplier = 81.4873308631f; 00005 00006 float FastMath::FastSin(float theta){ 00007 while (theta < 0.0f) theta += 6.28318530718f; 00008 while (theta >= 6.28318530718f) theta -= 6.28318530718f; 00009 return SinTable[(int) (Multiplier*theta)] ; 00010 } 00011 00012 float FastMath::FastCos(float theta){ 00013 return FastSin(1.57079632679f - theta); 00014 } 00015 //========HJB added=====// 00016 int FastMath::Sgn(float d){ 00017 if(d<0) return -1; 00018 else if (d==0) return 0; 00019 else return 1; 00020 }
Generated on Fri Jul 15 2022 03:16:42 by
1.7.2