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.
Dependencies: QEI mbed-rtos mbed
Fork of BLDCmotor by
fast_math.h
00001 #ifndef __fast_math_h 00002 #define __fast_math_h 00003 00004 #define PI 3.14159265358979 // π: def. of PI 00005 #define DEG60 512 // 60degを512に定義 00006 00007 extern unsigned short sin60[]; // sin table from 0 to 60 deg. (max precision error is 0.003%) 00008 // sin(th) = (float)(_sin(th/(PI/3.)*(float)DEG60+0.5))/65535.; 00009 extern long _sin(unsigned short); // return( 65535*sin(th) ), th=rad*DEG60/(PI/3)=rad*(512*3)/PI (0<=rad<2*PI) 00010 extern long _cos(unsigned short); // return( 65535*sin(th) ), th=rad*DEG60/(PI/3)=rad*(512*3)/PI (0<=rad<2*PI) 00011 extern void init_fast_math(); // call before using _sin(). sin0-sin60deg; 0deg=0, 60deg=512 00012 00013 //extern float norm(float); // 2ノルムを計算 00014 extern float sqrt2(float x); // √xのx=1まわりのテイラー展開 √x = 1 + 1/2*(x-1) -1/4*(x-1)^2 + ... 00015 00016 #endif
Generated on Tue Jul 12 2022 20:05:59 by
1.7.2
