AM中波放送用SDR.CICフィルタのみを使用.CQ出版社「トランジスタ技術」誌,2021年5月号に掲載

Dependencies:   mbed

Revision:
0:7a653530c8ce
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FastSin.hpp	Sat Aug 29 11:26:29 2020 +0000
@@ -0,0 +1,33 @@
+//--------------------------------------------------------------
+//  高速低精度 sin 計算
+//      sin(πx/2), -2< = x <= 2 を計算する
+//      誤差の絶対値の最大値:6.7706E-5
+//
+//      係数はミニマックス近似で求めたもの.ただし,誤差は絶対誤差で評価した
+//
+//  2020/08/11, Copyright (c) 2020 MIKAMI, Naoki
+//--------------------------------------------------------------
+
+#include "mbed.h"
+
+#ifndef FAST_SINE_LOW_PRECISION_HPP
+#define FAST_SINE_LOW_PRECISION_HPP
+
+namespace Mikami
+{
+    float FastSin(float x)
+    {
+        static const float A1 =  1.57032033f;
+        static const float A3 = -0.64211427f;
+        static const float A5 =  0.07186159f;
+        
+        x = (x >  1.0f) ?  2.0f - x : x;
+        x = (x < -1.0f) ? -2.0f - x : x;
+
+        float x2 = x*x;
+        float sinx = ((A5*x2 + A3)*x2 + A1)*x;
+        
+        return sinx;
+    }
+}
+#endif  // FAST_SINE_LOW_PRECISION_HPP
\ No newline at end of file