📄 tinytrig.h
字号:
/********************************************************************* FILE: TinyTrig.h** DESCRIPTION: Header file for Tiny Trig functions library.** VERSION: 1.0**********************************************************************/// NOTE: CHANGE THESE THREE VALUES TO CHANGE THE LIBRARY ACCURACY// The inverse trig functions accuracy cannot be improved because// they use table lookup methods, not approximation equations.#define TT_MIN_VALUE 1.0e-6#define TT_MAX_VALUE 1.0e+6#define TT_ACCURACY 1.0e-6// Other constants that define various Tiny trig limits#define TAN_MIN_VALUE -552.0 // -89.9 degrees#define TAN_MAX_VALUE +552.0 // +89.9 degrees#define POS_INFINITY 1.2e+38 // Float max#define NEG_INFINITY 3.4e-38 // Float min// Plain old numeric constants and conversion factors#define PI 3.14159265358979311600e+00#define TWO_PI 2.0 * PI#define HALF_PI PI / 2.0// The lookup table constants: size, scaling, and accuracy#define TRIG_TAB_SIZE 108#define SCALE_FACTOR 1.0e+5#define TT_TAB_ACCURACY 1.0e-4// External function prototypesdouble _sqrt ( double x ); // Square root of xdouble _abs ( double x ); // absolute valuedouble _sin ( double x ); // Sine of x using power seriesdouble _cos ( double x ); // Cosine of x double _tan ( double x ); // Tangent of x double _asin ( double x ); // Arc sine of x double _acos ( double x ); // Arc cosine of x double _atan ( double x ); // Arc tangent of x double _sin2 ( double x ); // Sine of x using table lookupdouble _cos2 ( double x ); // Cosine of x using table lookupdouble _tan2 ( double x ); // Tangent of x using table lookup// Internal function prototypes for non-Starter functions// Check their definitions in the source code for parameter definitionsstatic double TTLookup ( double x, UInt32 lkupTab [ TRIG_TAB_SIZE ], UInt32 rsltTab [ TRIG_TAB_SIZE ] );static UInt8 SearchTable ( UInt32 table [ TRIG_TAB_SIZE ], UInt32 value );static double ScaleNearZero ( double x, double scale );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -