AOT計算で呼び出し自体を早くする三角関数

Dependents:   NuMidi401 NuFM401

Revision:
2:d8c9637a5f09
Parent:
1:f1e55d228f6a
Child:
3:ba78a1dd8b55
--- a/AOTTrigon.h	Mon Dec 22 13:13:55 2014 +0000
+++ b/AOTTrigon.h	Tue Dec 23 05:32:28 2014 +0000
@@ -12,9 +12,15 @@
      */
     AOTTrigon(int divide=256);
 
-    double sine(double x);
-    double cosine(double x);
-    double tangent(double x);
+    inline double sine(double x) {
+        return t_sin[(int)(fmod(x,3.14159265358979323846264*2.0)*rate)];
+    }
+    inline double cosine(double x) {
+        return sine(x+3.14159265358979323846264/2.0);
+    }
+    inline double tangent(double x) {
+        return sine(x)/cosine(x);
+    }
 
 private:
     double *t_sin;