{"id":290757,"date":"2018-10-14T19:15:02","date_gmt":"2018-10-14T15:15:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290757"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290757","title":{"rendered":"\u0424\u0443\u043d\u043a\u0446\u0438\u044f Math.Sin (double) \u0434\u043b\u044f GPU"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h3>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h3>\n<p>  \u041c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0434\u0443\u0433\u0443 \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u044b \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0431\u043e\u0439 \u0446\u0435\u043b\u044c \u043f\u0440\u0435\u0432\u0437\u043e\u0439\u0442\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e System.Math.Sin() (C#) \u0438 \u0435\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433.<br \/>  <a name=\"habracut\"><\/a><br \/>  <i>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u043c\u043e\u0439 \u0432\u044b\u0431\u043e\u0440 (\u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0447\u0438\u0442\u0430\u0442\u044c):<\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Sin_3(rad)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>using System; class Math_d {     const double PI025      = Math.PI \/ 4;     \/\/\/ &lt;summary&gt; 2^17 = 131072 (1 \u043c\u0431), \u043e\u0448\u0438\u0431\u043a\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 10000 (\u0441 \u043a\u043e\u043d\u0446\u0430), \u043f\u0440\u0438 2^21 = 22097152 (16 \u043c\u0431) \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 +-1 (\u0441 \u043a\u043e\u043d\u0446\u0430) (\u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438) &lt;\/summary&gt;     const int length_mem    = 22097152;     const double step_rad   = PI025 \/ length_mem;     \/\/\/ &lt;summary&gt; \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e sin, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438. &lt;\/summary&gt;     static double[] mem_sin;     \/\/\/ &lt;summary&gt; \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e cos, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438. &lt;\/summary&gt;     static double[] mem_cos;      \/\/\/ &lt;summary&gt; \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0440\u043e\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 sin, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432 \u0445\u043e\u0434\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432. &lt;\/summary&gt;     public static void Initialise()     {         Ini_Mem_Sin();         Ini_Mem_Cos();     }     public static double Sin_3(double rad)     {         double rad_025;         int i;          i = (int)(rad \/ PI025);     \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0447\u0430\u0441\u0442\u0438         rad_025 = rad - PI025 * i;  \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0442\u0441\u0442\u0443\u043f \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0447\u0430\u0441\u0442\u0438 (\u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445)         i = i & 7;                  \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0430 8          \/\/\u0418\u0449\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0443\u0441\u043e\u0447\u043a\u0430 \u043a\u0440\u0443\u0433\u0430         switch (i)         {             case 0:                 return Sin_Lerp(rad_025);             case 1:                 return Cos_Lerp(PI025 - rad_025);             case 2:                 return Cos_Lerp(rad_025);             case 3:                 return Sin_Lerp(PI025 - rad_025);             case 4:                 return -Sin_Lerp(rad_025);             case 5:                 return -Cos_Lerp(PI025 - rad_025);             case 6:                 return -Cos_Lerp(rad_025);             case 7:                 return -Sin_Lerp(PI025 - rad_025);         }          return 0;     }      \/\/\/ &lt;summary&gt; \u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 sin \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 &lt;\/summary&gt;     static void Ini_Mem_Sin()     {         double rad;         mem_sin = new double[length_mem];         for (int i = 0; i &lt; length_mem; i++)         {             rad = (i * PI025) \/ length_mem;             mem_sin[i] = Math.Sin(rad);         }     }     \/\/\/ &lt;summary&gt; \u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 cos \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 &lt;\/summary&gt;     static void Ini_Mem_Cos()     {         double rad;         mem_cos = new double[length_mem];         for (int i = 0; i &lt; length_mem; i++)         {             rad = (i * PI025) \/ length_mem;             mem_cos[i] = Math.Cos(rad);         }     }     \/\/\/ &lt;summary&gt; \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 sin \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/param&gt;     static double Sin_Lerp(double rad)     {         int i_0;         int i_1;         double i_0d;         double percent;         double a;         double b;         double s;          percent = rad \/ PI025;         i_0d    = percent * length_mem;         i_0     = (int)i_0d;         i_1     = i_0 + 1;         a       = mem_sin[i_0];         b       = mem_sin[i_1];         s       = i_0d - i_0;          return Math_d.Lerp(a, b, s);     }     \/\/\/ &lt;summary&gt; \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 cos \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/param&gt;     static double Cos_Lerp(double rad)     {         int i_0;         int i_1;         double i_0d;         double percent;         double a;         double b;         double s;          percent = rad \/ PI025;         i_0d = percent * length_mem;         i_0 = (int)i_0d;         i_1 = i_0 + 1;         a = mem_cos[i_0];         b = mem_cos[i_1];         s = i_0d - i_0;          return Math_d.Lerp(a, b, s);     }     \/\/\/ &lt;summary&gt; \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. (return a + s * (b - a)) &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;a&quot;&gt; \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;b&quot;&gt; \u041a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;s&quot;&gt; \u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438. 0 = a, 1 = b, 0.5 = \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 a \u0438 b. &lt;\/param&gt;     public static double Lerp(double a, double b, double s)     {         return a + s * (b - a);     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u0447\u0438\u043d\u044b \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0412 HLSL \u044f\u0437\u044b\u043a\u0435 \u043d\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Sin \u0434\u043b\u044f double (\u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u0447\u043d\u043e) <\/li>\n<li> \u0412 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043c\u0430\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 <\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044b<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0420\u044f\u0434\u044b \u0422\u0435\u0439\u043b\u043e\u0440\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A2%D1%80%D0%B8%D0%B3%D0%BE%D0%BD%D0%BE%D0%BC%D0%B5%D1%82%D1%80%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B5_%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%B8#%D0%9E%D0%BF%D1%80%D0%B5%D0%B4%D0%B5%D0%BB%D0%B5%D0%BD%D0%B8%D0%B5_%D1%82%D1%80%D0%B8%D0%B3%D0%BE%D0%BD%D0%BE%D0%BC%D0%B5%D1%82%D1%80%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D1%85_%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D0%B9_%D1%87%D0%B5%D1%80%D0%B5%D0%B7_%D1%80%D1%8F%D0%B4%D1%8B\">(\u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u044f) <\/a> <\/li>\n<li> \u041f\u043e\u043b\u0438\u043d\u043e\u043c\u044b (<a href=\"https:\/\/gamedev.ru\/code\/forum\/?id=93064\">\u0430\u0432\u0442\u043e\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: \u00abasvp\u00bb<\/a>) <\/li>\n<li> \u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 Math.Sin \u0438 Math.Cos (\u0430\u0432\u0442\u043e\u0440: \u044f)<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b<\/h3>\n<p>  <\/p>\n<ul>\n<li> \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a Math.Sin <\/li>\n<li> \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a Math.Sin <\/li>\n<\/ul>\n<p>  <u>\u041a\u0440\u043e\u043c\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043c\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u043c \u0438\u0445 \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.<\/u><\/p>\n<h4>\u0420\u044f\u0434\u044b \u0422\u0435\u0439\u043b\u043e\u0440\u0430<\/h4>\n<p>  \u041f\u043b\u044e\u0441\u044b:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0441\u043e\u0447\u0430\u0439\u0448\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f Sin, \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 <u>\u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/u> Sin. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u043d\u0430 \u043f\u0440\u0435\u0442\u0435\u0440\u043f\u0435\u0432\u0430\u0435\u0442, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u0432 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0435). \u0412 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (double, float, decimal \u0438 \u0434\u0440\u0443\u0433\u0438\u0435).<\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043b\u044e\u0431\u043e\u0439 \u0443\u0433\u043e\u043b<\/b><\/p>\n<div class=\"spoiler_text\">\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 (\u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435), \u0438 \u0447\u0430\u0441\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0430\u0437\u043e\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.  <\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (4-10%)<\/b><\/p>\n<div class=\"spoiler_text\">\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u043b\u0430\u0441\u044c \u043a \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 Math.Sin, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 25 \u0440\u0430\u0437 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0433\u043e\u043b, \u0442\u0435\u043c \u043d\u0438\u0436\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0433\u043e\u043b \u0432\u0432\u0435\u0434\u0435\u043d \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0442\u043e\u0439 \u0436\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0438 Math.Sin.  <\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>  <i><b>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434 (\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c: 4%):<\/b><\/i><\/p>\n<p>  \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/wikimedia.org\/api\/rest_v1\/media\/math\/render\/svg\/c847dfe24de5ad14ebd936999a7183ba96d81717\" alt=\"image\"\/><\/p>\n<p>  <i><b>\u0414\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 (\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c: 10%): <\/b><\/i><\/p>\n<p>  \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u0435\u043f\u0435\u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432 \u0446\u0438\u043a\u043b\u0435 (a *= aa;), \u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0438 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u0432 (+, -, +, &#8230;) \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0438 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434: <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Sin(rad, steps)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>    \/\/ &lt;summary&gt; \u041c\u0430\u0441\u0441\u0438\u0432 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Fact &lt;\/summary&gt;     static double[] fact;      \/\/\/ &lt;summary&gt; \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0438\u043d\u0443\u0441 \u0443\u0433\u043b\u0430 \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u044f\u0434\u043e\u0432 \u0422\u0435\u0439\u043b\u043e\u0440\u0430.      \/\/\/ \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 rad, \u0442\u0435\u043c \u043d\u0438\u0436\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.      \/\/\/ \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u043a Math): 4% (fps) \u043f\u0440\u0438 steps = 17 &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445. \u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0443\u0433\u043e\u043b \u0434\u043e pi\/4. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;steps&quot;&gt; \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432: \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0414\u043b\u044f pi\/4 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 E-15 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e 8. &lt;\/param&gt;     public static double Sin(double rad, int steps)     {         double ret;         double a;   \/\/\u0423\u0433\u043e\u043b, \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c          double aa;  \/\/\u0423\u0433\u043e\u043b * \u0443\u0433\u043e\u043b         int i_f;    \/\/\u0418\u043d\u0434\u0435\u043a\u0441 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430         int sign;   \/\/\u0417\u043d\u0430\u043a (\u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u043e\u0442 - \u0434\u043e +, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 = +)          ret     = 0;         sign    = -1;         aa      = rad * rad;         a       = rad;         i_f     = 1;          \/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 \u0440\u044f\u0434\u044b \u0422\u0435\u0439\u043b\u043e\u0440\u0430         for (int n = 0; n &lt; steps; n++)         {             sign    *= -1;             ret     += sign * a \/ Fact(i_f);             a       *= aa;             i_f     += 2;         }          return ret;     }         \/\/\/ &lt;summary&gt; \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b (n!). \u0415\u0441\u043b\u0438 n &gt; fact.Length, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 -1. &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;n&quot;&gt; \u0427\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0435\u0441\u0442\u0438 \u0432 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b. &lt;\/param&gt;     public static double Fact(int n)     {         if (n &gt;= 0 && n &lt; fact.Length)         {             return fact[n];         }         else         {             Debug.Log(&quot;\u0412\u044b\u0445\u043e\u0434 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430. n = &quot; + n + &quot;, \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 = &quot; + fact.Length);             return -1;         }     }     \/\/\/ &lt;summary&gt; \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b. &lt;\/summary&gt;     static void Init_Fact()     {         int steps;          steps = 46;          fact = new double[steps];          fact[0] = 1;          for (int n = 1; n &lt; steps; n++)         {             fact[n] = fact[n - 1] * n;         }     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <i><b>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u0432\u0438\u0434 (\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c: 19%):<\/b><\/i><\/p>\n<p>  \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0447\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u0443\u0433\u043e\u043b, \u0442\u0435\u043c \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0421\u0430\u043c\u044b\u0439 \u043c\u0430\u043b\u044b\u0439 \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u0443\u0433\u043e\u043b = 0.25*PI, \u0442.\u0435. 45 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432. \u0421\u0447\u0438\u0442\u0430\u044f Sin \u0438 Cos \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 45 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0442 -1 \u0434\u043e 1 \u0434\u043b\u044f Sin (\u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 2 * PI). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043c \u043a\u0440\u0443\u0433 (2*PI) \u043d\u0430 8 \u0447\u0430\u0441\u0442\u0435\u0439 \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0443\u043a\u0430\u0436\u0435\u043c \u0441\u0432\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0441\u0438\u043d\u0443\u0441\u0430. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0441\u0447\u0435\u0442, \u043e\u0442\u043a\u0430\u0436\u0435\u043c\u0441\u044f \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 (%) (\u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u0430 \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u043e\u043d\u044b 45 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Sin_2(rad)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>    \/\/ &lt;summary&gt; \u041c\u0430\u0441\u0441\u0438\u0432 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Fact &lt;\/summary&gt;     static double[] fact;     \/\/\/ &lt;summary&gt; \u041d\u0430\u0434\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0434 Sin &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt;&lt;\/param&gt;     public static double Sin_2(double rad)     {         double rad_025;         int i;          \/\/rad = rad % PI2;    \/\/% - \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0440\u0435\u0437\u0443\u0440\u0441\u043e\u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u0415\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c, fps \u043f\u043e\u0434\u043d\u0438\u043c\u0435\u0442\u0441\u044f \u0441 90 \u0434\u043e 150 (\u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 100 000 \u0440\u0430\u0437 \u0432 \u043a\u0430\u0434\u0440)         \/\/rad_025 = rad % PI025;         i = (int)(rad \/ PI025);         rad_025 = rad - PI025 * i;          i = i & 7;  \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430 8 \u0447\u0430\u0441\u0442\u0435\u0439          \/\/\u0418\u0449\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0443\u0441\u043e\u0447\u043a\u0430 \u043a\u0440\u0443\u0433\u0430         switch (i)         {             case 0:                 return Sin(rad_025, 8);             case 1:                 return Cos(PI025 - rad_025, 8);             case 2:                 return Cos(rad_025, 8);             case 3:                 return Sin(PI025 - rad_025, 8);             case 4:                 return -Sin(rad_025, 8);             case 5:                 return -Cos(PI025 - rad_025, 8);             case 6:                 return -Cos(rad_025, 8);             case 7:                 return -Sin(PI025 - rad_025, 8);         }          return 0;     }     \/\/\/ &lt;summary&gt; \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0438\u043d\u0443\u0441 \u0443\u0433\u043b\u0430 \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u044f\u0434\u043e\u0432 \u0422\u0435\u0439\u043b\u043e\u0440\u0430.      \/\/\/ \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 rad, \u0442\u0435\u043c \u043d\u0438\u0436\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.      \/\/\/ \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u043a Math): 10% (fps) \u043f\u0440\u0438 steps = 17 &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445. \u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0443\u0433\u043e\u043b \u0434\u043e pi\/4. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;steps&quot;&gt; \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432: \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0414\u043b\u044f pi\/4 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 E-15 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e 8. &lt;\/param&gt;     public static double Sin(double rad, int steps)     {         double ret;         double a;   \/\/\u0423\u0433\u043e\u043b, \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c          double aa;  \/\/\u0423\u0433\u043e\u043b * \u0443\u0433\u043e\u043b         int i_f;    \/\/\u0418\u043d\u0434\u0435\u043a\u0441 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430         int sign;   \/\/\u0417\u043d\u0430\u043a (\u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u043e\u0442 - \u0434\u043e +, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 = +)          ret     = 0;         sign    = -1;         aa      = rad * rad;         a       = rad;         i_f     = 1;          \/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 \u0440\u044f\u0434\u044b \u0422\u0435\u0439\u043b\u043e\u0440\u0430         for (int n = 0; n &lt; steps; n++)         {             sign    *= -1;             ret     += sign * a \/ Fact(i_f);             a       *= aa;             i_f     += 2;         }          return ret;     }      \/\/\/ &lt;summary&gt; \u0420\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0441 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0441\u0438\u043d\u0443\u0441 \u0443\u0433\u043b\u0430 \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u044f\u0434\u043e\u0432 \u0422\u0435\u0439\u043b\u043e\u0440\u0430.      \/\/\/ \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 rad, \u0442\u0435\u043c \u043d\u0438\u0436\u0435 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.      \/\/\/ \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u043a Math): 10% (fps), 26% (test) \u043f\u0440\u0438 steps = 17 &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445. \u041b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0443\u0433\u043e\u043b \u0434\u043e pi\/4. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;steps&quot;&gt; \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432: \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0414\u043b\u044f pi\/4 \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 E-15 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e 8. &lt;\/param&gt;     public static double Cos(double rad, int steps)     {         double ret;         double a;         double aa;  \/\/\u0423\u0433\u043e\u043b * \u0443\u0433\u043e\u043b         int i_f;    \/\/\u0418\u043d\u0434\u0435\u043a\u0441 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430         int sign;   \/\/\u0417\u043d\u0430\u043a (\u043a\u043e\u043b\u0435\u0431\u043b\u0435\u0442\u0441\u044f \u043e\u0442 - \u0434\u043e +, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 = +)          ret     = 0;         sign    = -1;         aa      = rad * rad;         a       = 1;         i_f     = 0;          \/\/\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 \u0440\u044f\u0434\u044b \u0422\u0435\u0439\u043b\u043e\u0440\u0430         for (int n = 0; n &lt; steps; n++)         {             sign    *= -1;             ret     += sign * a \/ Fact(i_f);             a       *= aa;             i_f     += 2;         }          return ret;     }      \/\/\/ &lt;summary&gt; \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b (n!). \u0415\u0441\u043b\u0438 n &gt; fact.Length, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 -1. &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;n&quot;&gt; \u0427\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0435\u0441\u0442\u0438 \u0432 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b. &lt;\/param&gt;     public static double Fact(int n)     {         if (n &gt;= 0 && n &lt; fact.Length)         {             return fact[n];         }         else         {             Debug.Log(&quot;\u0412\u044b\u0445\u043e\u0434 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b\u0430. n = &quot; + n + &quot;, \u0434\u043b\u0438\u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 = &quot; + fact.Length);             return -1;         }     }      \/\/\/ &lt;summary&gt; \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0430\u043b. &lt;\/summary&gt;     static void Init_Fact()     {         int steps;          steps = 46;          fact = new double[steps];          fact[0] = 1;          for (int n = 1; n &lt; steps; n++)         {             fact[n] = fact[n - 1] * n;         }     }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u043e\u043b\u0438\u043d\u043e\u043c\u044b<\/h3>\n<p>  \u0421 \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430, \u0430\u0432\u0442\u043e\u0440\u0443 \u043d\u0443\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0438\u0441\u043a\u0430 Sin \u0434\u043b\u044f double \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 (\u043e\u0448\u0438\u0431\u043a\u0430 &lt; 0.000 001) \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (9-84%)<\/b><\/p>\n<div class=\"spoiler_text\">\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043a\u0438\u043d\u0443\u0442\u044b\u0439 \u043f\u043e\u043b\u0438\u043d\u043e\u043c \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432\u044b\u0434\u0430\u0432\u0430\u043b \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432 9% \u043e\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e Math.Sin, \u0447\u0442\u043e \u0432 10 \u0440\u0430\u0437 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u043a\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0434\u043e 84%, \u0447\u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0435\u0441\u043b\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0433\u043b\u0430\u0437\u0430 \u043d\u0430 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c.  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0438 \u043f\u0430\u043c\u044f\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u0415\u0441\u043b\u0438 \u0432\u0432\u0435\u0440\u0445\u0443 \u0438 \u0434\u0430\u043b\u0435\u0435 \u0432\u043d\u0438\u0437\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0442\u043e \u0442\u0443\u0442 \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0431\u044b\u043b\u0438 \u043b\u044e\u0431\u0435\u0437\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u044b \u0438 \u043f\u043e\u043c\u0435\u0449\u0435\u043d\u044b \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0443 \u0441\u0430\u043c\u0438\u043c \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442.   <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435 \u0447\u0435\u043c \u0443 Mathf.Sin (float)<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p>  0.84147<b>1<\/b> \u2014 Mathf.Sin(1)(\u0434\u0432\u0438\u0436\u043e\u043a Unity);<br \/>  0.841470984807897 \u2014 Math.Sin(1)(\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f C#);<br \/>  0.8414709<b>56802368<\/b> \u2014 sin(1)(GPU, \u044f\u0437\u044b\u043a hlsl);<br \/>  0.84147<b>1184637935<\/b> \u2014 <b>Sin_0(1)<\/b>.  <\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0435\u043b\u044c\u0437\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043a\u0430\u043a\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0430\u0432\u0442\u043e\u0440 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430.  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0417\u0430\u0447\u0435\u043c?<\/b><\/p>\n<div class=\"spoiler_text\">\u0417\u0430\u0447\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 \u0438 \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0442\u0430\u043a\u0430\u044f \u043d\u0438\u0437\u043a\u0430\u044f (\u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 double) \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c?   <\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>  <i><b>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434:<\/b><\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Sin_1(x)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>\/\/\/ &lt;summary&gt; \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u043a Math): 9% (fps)&lt;\/summary&gt; \/\/\/ &lt;param name=&quot;x&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u043e\u0442 -2*Pi \u0434\u043e 2*Pi &lt;\/param&gt; public static double Sin_1(double x) {     return         0.9999997192673006 * x - 0.1666657564532464 * Math.Pow(x, 3) +         0.008332803647181511 * Math.Pow(x, 5) - 0.00019830197237204295 * Math.Pow(x, 7) +         2.7444305061093514e-6 * Math.Pow(x, 9) - 2.442176561869478e-8 * Math.Pow(x, 11) +         1.407555708887347e-10 * Math.Pow(x, 13) - 4.240664814288337e-13 * Math.Pow(x, 15); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <i><b>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u0432\u0438\u0434:<\/b><\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Sin_0(rad)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>\/\/\/ &lt;summary&gt; \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c (\u043a Math): 83% (fps)&lt;\/summary&gt; \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u043e\u0442 -2*Pi \u0434\u043e 2*Pi &lt;\/param&gt; public static double Sin_0(double rad) {     double x;     double xx;     double ret;      xx = rad * rad;     x = rad;                      \/\/1     ret = 0.9999997192673006 * x;     x *= xx;                        \/\/3     ret -= 0.1666657564532464 * x;     x *= xx;                        \/\/5     ret += 0.008332803647181511 * x;     x *= xx;                        \/\/7     ret -= 0.00019830197237204295 * x;     x *= xx;                        \/\/9     ret += 2.7444305061093514e-6 * x;     x *= xx;                        \/\/11     ret -= 2.442176561869478e-8 * x;     x *= xx;                        \/\/13     ret += 1.407555708887347e-10 * x;     x *= xx;                        \/\/15     ret -= 4.240664814288337e-13 * x;      return ret; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044f<\/h3>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0434\u0432\u0443\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435. <br \/>  \u0417\u0430\u043f\u0438\u0441\u0438 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043d\u0430 mem_sin \u0438 mem_cos, \u0432 \u043d\u0438\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 Math.Sin \u0438 Math.Cos \u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043e\u0442 0 \u0434\u043e 0.25*PI. <\/p>\n<p>  \u041f\u0440\u0438\u043d\u0446\u0438\u043f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441 \u0443\u0433\u043b\u043e\u043c \u043e\u0442 0 \u0434\u043e 45 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0440\u044f\u0434\u043e\u0432 \u0422\u0435\u0439\u043b\u043e\u0440\u0430, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u2014 \u043c\u0435\u0436\u0434\u0443 \u043a\u0430\u043a\u0438\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0443\u0433\u043e\u043b \u2014 \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<p>  \u041f\u043b\u044e\u0441\u044b:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0441\u043e\u043a\u0430\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c (65%)<\/b><\/p>\n<div class=\"spoiler_text\">\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 65% \u043e\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 Math.Sin. \u0421\u0447\u0438\u0442\u0430\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c &gt;33% \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439.  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0441\u043e\u0447\u0430\u0439\u0448\u0430\u044f \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0434\u043a\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f:<br \/>  0.255835595715180 \u2014 Math.Sin;<br \/>  0.2558355957151<b>79<\/b> \u2014 <b>Sin_3<\/b>.  <\/div>\n<\/div>\n<\/li>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u044b\u0441\u0442\u0440\u0430\u044f \u043d\u043e\u0433\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u041b\u044e\u0431\u043b\u044e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432 \u043c\u0443\u043a\u0430\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043c\u043d\u043e\u0439 \u0438 \u043f\u0440\u0435\u0432\u0437\u043e\u0448\u043b\u0430 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f: \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c &gt; 33%, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435 1\u0435-14. \u0414\u0430\u043c \u0435\u0439 \u0433\u043e\u0440\u0434\u043e\u0435 \u0438\u043c\u044f \u2014 V\u0113l\u014dx Pes.  <\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:<\/p>\n<ul>\n<li>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0434\u0432\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430: \u0434\u043b\u044f sin \u0438 \u0434\u043b\u044f cos; \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0435\u0441\u0438\u0442 ~16\u043c\u0431 (16*2=32\u043c\u0431)  <\/div>\n<\/div>\n<\/li>\n<\/ul>\n<p>  <i><b>\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434:<\/b><\/i><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Sin_3(rad)<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>    const double PI025      = Math.PI \/ 4;     \/\/\/ &lt;summary&gt; 2^17 = 131072 (1 \u043c\u0431), \u043e\u0448\u0438\u0431\u043a\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 10000 (\u0441 \u043a\u043e\u043d\u0446\u0430), \u043f\u0440\u0438 2^21 = 22097152 (16 \u043c\u0431) \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 +-1 (\u0441 \u043a\u043e\u043d\u0446\u0430) (\u043f\u043e\u0447\u0442\u0438 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438) &lt;\/summary&gt;     const int length_mem    = 22097152;     const double step_rad   = PI025 \/ length_mem;     \/\/\/ &lt;summary&gt; \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e sin, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438. &lt;\/summary&gt;     static double[] mem_sin;     \/\/\/ &lt;summary&gt; \u041c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e cos, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438. &lt;\/summary&gt;     static double[] mem_cos;      \/\/\/ &lt;summary&gt; \u0418\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0440\u043e\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 sin, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432 \u0445\u043e\u0434\u0435 \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432. &lt;\/summary&gt;     public static void Initialise()     {         Ini_Mem_Sin();         Ini_Mem_Cos();     }     public static double Sin_3(double rad)     {         double rad_025;         int i;          i = (int)(rad \/ PI025);     \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u0447\u0430\u0441\u0442\u0438         rad_025 = rad - PI025 * i;  \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0442\u0441\u0442\u0443\u043f \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0447\u0430\u0441\u0442\u0438 (\u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445)         i = i & 7;                  \/\/\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0430 8          \/\/\u0418\u0449\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441 \u043a\u0443\u0441\u043e\u0447\u043a\u0430 \u043a\u0440\u0443\u0433\u0430         switch (i)         {             case 0:                 return Sin_Lerp(rad_025);             case 1:                 return Cos_Lerp(PI025 - rad_025);             case 2:                 return Cos_Lerp(rad_025);             case 3:                 return Sin_Lerp(PI025 - rad_025);             case 4:                 return -Sin_Lerp(rad_025);             case 5:                 return -Cos_Lerp(PI025 - rad_025);             case 6:                 return -Cos_Lerp(rad_025);             case 7:                 return -Sin_Lerp(PI025 - rad_025);         }          return 0;     }      \/\/\/ &lt;summary&gt; \u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 sin \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 &lt;\/summary&gt;     static void Ini_Mem_Sin()     {         double rad;         mem_sin = new double[length_mem];         for (int i = 0; i &lt; length_mem; i++)         {             rad = (i * PI025) \/ length_mem;             mem_sin[i] = Math.Sin(rad);         }     }     \/\/\/ &lt;summary&gt; \u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 cos \u0434\u043b\u044f \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438 &lt;\/summary&gt;     static void Ini_Mem_Cos()     {         double rad;         mem_cos = new double[length_mem];         for (int i = 0; i &lt; length_mem; i++)         {             rad = (i * PI025) \/ length_mem;             mem_cos[i] = Math.Cos(rad);         }     }     \/\/\/ &lt;summary&gt; \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 sin \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/param&gt;     static double Sin_Lerp(double rad)     {         int i_0;         int i_1;         double i_0d;         double percent;         double a;         double b;         double s;          percent = rad \/ PI025;         i_0d    = percent * length_mem;         i_0     = (int)i_0d;         i_1     = i_0 + 1;         a       = mem_sin[i_0];         b       = mem_sin[i_1];         s       = i_0d - i_0;          return Math_d.Lerp(a, b, s);     }     \/\/\/ &lt;summary&gt; \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 cos \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;rad&quot;&gt; \u0423\u0433\u043e\u043b \u0432 \u0440\u0430\u0434\u0438\u0430\u043d\u0430\u0445 \u043e\u0442 0 \u0434\u043e pi\/4. &lt;\/param&gt;     static double Cos_Lerp(double rad)     {         int i_0;         int i_1;         double i_0d;         double percent;         double a;         double b;         double s;          percent = rad \/ PI025;         i_0d = percent * length_mem;         i_0 = (int)i_0d;         i_1 = i_0 + 1;         a = mem_cos[i_0];         b = mem_cos[i_1];         s = i_0d - i_0;          return Math_d.Lerp(a, b, s);     }     \/\/\/ &lt;summary&gt; \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u0443\u044e \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u044e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. (return a + s * (b - a)) &lt;\/summary&gt;     \/\/\/ &lt;param name=&quot;a&quot;&gt; \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;b&quot;&gt; \u041a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. &lt;\/param&gt;     \/\/\/ &lt;param name=&quot;s&quot;&gt; \u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u044f\u0446\u0438\u0438. 0 = a, 1 = b, 0.5 = \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0430 \u043c\u0435\u0436\u0434\u0443 a \u0438 b. &lt;\/param&gt;     public static double Lerp(double a, double b, double s)     {         return a + s * (b - a);     } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/426355\/\"> https:\/\/habr.com\/post\/426355\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h3>\u041f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0435<\/h3>\n<p>  \u041c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0434\u0443\u0433\u0443 \u0441 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u044b \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. <\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440 \u043d\u0435 \u0441\u0442\u0430\u0432\u0438\u043b \u043f\u0435\u0440\u0435\u0434 \u0441\u043e\u0431\u043e\u0439 \u0446\u0435\u043b\u044c \u043f\u0440\u0435\u0432\u0437\u043e\u0439\u0442\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e System.Math.Sin() (C#) \u0438 \u0435\u0435 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-290757","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=290757"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290757\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}