{"id":348645,"date":"2023-06-11T21:00:31","date_gmt":"2023-06-11T21:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=348645"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=348645","title":{"rendered":"<span>\u0417\u0430\u0447\u0435\u043c \u0432 Switch SDK \u0442\u0440\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 sin?<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Gaijin \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u043c\u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u044b \u0438\u0433\u0440 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c Nintendo Switch, \u0442\u043e\u0433\u0434\u0430 \u0432\u043e\u0432\u0441\u044e \u0437\u0430\u0432\u043e\u0435\u0432\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043d\u043e\u0432\u044b\u0435 \u0440\u044b\u043d\u043a\u0438. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435. \u0410 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u043d\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u0432\u0438\u0436\u043a\u0430 \u0441 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439, \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u0438, \u0442\u043e \u0432\u0441\u0435 \u0433\u0440\u0430\u0431\u043b\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u0438 \u0431\u0435\u0440\u0435\u0436\u043d\u043e \u043d\u0430 \u043d\u0438\u0445 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0433\u0440\u044b, \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 middleware (\u0441\u0432\u044f\u0437\u043a\u0430 dagor engine + nxsdk + jam) \u0438 \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0441\u0442\u0430\u043b \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, build matrix, \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c\u0438, \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u043c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438. \u041d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 2018 \u0433\u043e\u0434\u0430, \u0432 \u0441\u0430\u043c\u043e\u043c switch sdk \u043d\u0435 \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0447\u0430\u0441\u0442\u044c posix \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0440\u043e\u0434\u0435 poll \u0438 send\/receive, \u0438 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, posix \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u0438\u043c. \u0414\u043e\u0448\u043b\u0438 \u0442\u043e\u0433\u0434\u0430 \u0440\u0443\u043a\u0438 \u0438 \u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438 \u0431\u044b\u043b\u0438 \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0432 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0447\u0430\u0441\u0442\u0438 \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 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 \u0441\u0431\u043e\u0440\u043a\u0438. \u0414\u043b\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0438, sdk \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 musl libc (<a href=\"https:\/\/www.musl-libc.org\/\" rel=\"noopener noreferrer nofollow\">https:\/\/www.musl-libc.org\/<\/a>), \u0432\u0441\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u0438\u043d\u043a\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a clang&#8217;\u043e\u043c \u043e\u0442 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e 9 \u0432\u0435\u0440\u0441\u0438\u0438 (2018 \u0433\u043e\u0434), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c \u0441\u0430\u043c\u043e\u0439 libc \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0438\u0437\u0430\u0441\u043c \u0438 \u0431\u043e\u043b\u0435 \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/27d\/d21\/f51\/27dd21f512e2cc96050c54b1eb2a15df.png\" alt=\"To sine or not to sine?\" title=\"To sine or not to sine?\" width=\"364\" height=\"300\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/27d\/d21\/f51\/27dd21f512e2cc96050c54b1eb2a15df.png\"\/><\/p>\n<div><figcaption>To sine or not to sine?<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<p>\u0421\u0432\u043e\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u043f\u0438\u0448\u0443 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0447\u0442\u043e \u043d\u0430 \u0434\u0432\u043e\u0440\u0435 \u0431\u044b\u043b 2018. \u041a\u043e\u0434 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0434\u0435\u0442\u0441\u043a\u0438\u0439, \u0433\u043e\u043d\u044f\u0435\u043c \u0441\u0438\u043d\u0443\u0441 (\u0432 \u0441\u0434\u043a \u0432\u0441\u044f \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u043b\u0435\u0436\u0430\u043b\u0430 \u0432 tr1) \u043f\u043e \u043a\u0440\u0443\u0433\u0443 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/p>\n<pre><code class=\"cpp\">static void nxsdk_sin(benchmark::State&amp; state) {     \/\/ Code inside this loop is measured repeatedly     float i = 0;     for( auto _ : state) {         float p = tr1::sin(p);          i += 0.1f;         benchmark::DoNotOptimize(p);     } } BENCHMARK(nxsdk_sin);<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b (\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f &#8212; \u043b\u0443\u0447\u0448\u0435)<\/p>\n<pre><code>-----------(\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0443\u0447\u0448\u0435)----------------------------- Benchmark            Time             CPU   Iterations ------------------------------------------------------ nxsdk_sin         8.68 ns         8.58 ns     74666667 &lt;&lt;&lt; https:\/\/git.musl-libc.org\/cgit\/musl\/tree\/src\/math\/sin.c nxsdk_sin_vec     8.35 ns         8.30 ns     75825003 &lt;&lt;&lt; sin(vec4f) dagor_sin         5.48 ns         5.47 ns    102504001 glibc_sin         8.28 ns         8.08 ns     77623654 &lt;&lt;&lt; https:\/\/github.com\/lattera\/glibc\/blob\/master\/sysdeps\/ieee754\/dbl-64\/s_sin.c <\/code><\/pre>\n<p>\u041f\u043e\u043a\u0430 \u0432\u0441\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e, \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f sin \u0432 musl \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0435 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0432 glibc, \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435. \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u043c -03 + -math:precise, \u0441\u0438\u043d\u0443\u0441 \u043e\u0442 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u0441\u0442\u0430\u043b \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 \u0442\u0440\u0435\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0442\u0443\u0442 \u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u043c\u043d\u044b\u0439, \u043b\u0438\u0431\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0432\u0440\u0435\u0442 \u0438 \u043b\u0443\u043d\u0430 \u043d\u0435 \u0432 \u0442\u043e\u0439 \u0444\u0430\u0437\u0435, \u043b\u0438\u0431\u043e \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043c\u043d\u0435 \u044d\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u044f \u0435\u043c\u0443 \u0442\u0430\u043a \u0438 \u043e\u0442\u0432\u0435\u0442\u0438\u043b &#8212; \u043c\u043e\u043b, \u0443 \u0442\u0435\u0431\u044f \u0431\u0435\u043d\u0447 \u0441\u043b\u043e\u043c\u0430\u043b\u0441\u044f, \u0438\u0434\u0438 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u044c, \u0438 \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0443\u0436\u0435 \u0432\u043c\u0435\u0441\u0442\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0444\u0443 \u0432\u0437\u044f\u0442\u044c\u0441\u044f \u0442\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0442\u043a\u0443\u0434\u0430 (\u043d\u0443 \u044d\u0442\u043e \u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0430\u043a \u0434\u0443\u043c\u0430\u043b). \u041e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u0432\u0438\u0434\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 glibc_sin \u0437\u0430 \u0441\u0447\u0435\u0442 \u0430\u0433\u0440\u0435\u0441\u0441\u0438\u0432\u043d\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 clang&#8217;a.<\/p>\n<pre><code>-----------(\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0443\u0447\u0448\u0435)----------------------------- Benchmark            Time             CPU   Iterations ------------------------------------------------------ nxsdk_sin         6.03 ns         6.00 ns     87625024 nxsdk_sin_vec     5.82 ns         5.78 ns     90022043 dagor_sin         5.38 ns         5.27 ns    104602002 glibc_sin         8.08 ns         8.05 ns     78214356<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 &#171;\u0434\u0440\u0443\u0433\u043e\u0439&#187; \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442 \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 -O3 + -math:fast, \u0442\u0443\u0442 \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0438\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 dagor_sin \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435 \u0441\u0438\u043d\u0443\u0441\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u0441 std::sin \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u043b\u0430 1e-6<\/p>\n<pre><code>-----------(\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0443\u0447\u0448\u0435)----------------------------- Benchmark            Time             CPU   Iterations ------------------------------------------------------ nxsdk_sin         4.03 ns         3.99 ns    132307692 nxsdk_sin_vec     4.09 ns         4.08 ns    131403251 dagor_sin         5.13 ns         5.10 ns    110400021 glibc_sin         7.43 ns         7.16 ns     79544722<\/code><\/pre>\n<p>\u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043b\u0435\u0437\u0442\u044c \u0432 \u0434\u0438\u0437\u0430\u0441\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0433\u0435\u043d\u0438\u0438 \u0438\u0437 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0438\u0445 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0445 \u0446\u0438\u0444\u0440 \u0432 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0435. <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0440\u0435\u0436\u0438\u043c\u0430 -01 (speed), \u044f \u0432\u044b\u043b\u043e\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043d\u0435 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u0438\u0437\u0430\u0441\u043c, \u043c\u0430\u043b\u043e \u043b\u0438 \u0442\u0430\u043c \u043a\u0430\u043a\u043e\u0435 IP \u0435\u0441\u0442\u044c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f sin \u0438\u0437 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 nx sdk, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u0438\u0430\u0441\u043e\u043c \u0434\u043b\u044f __sin_nx_502, (2018 \u0433\u043e\u0434, \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 sdk 4.0 \u0438 5.0) \u0432\u0438\u0434\u0438\u043c\u043e \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<details class=\"spoiler\">\n<summary>__sin_nx_502<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"assembly\">__sin_nx_502(double):         sub     sp, sp, #32                     stp     x29, x30, [sp, #16]              add     x29, sp, #16                    fmov    x8, d0         mov     w9, #8699         ubfx    x8, x8, #32, #31         movk    w9, #16361, lsl #16         cmp     w8, w9         b.hi    .ERIT1_3                \/\/ .ERITX_X -> .BBX_X arm         lsr     w9, w8, #20         cmp     w9, #996                       b.hi    .ERIT1_5         mov     x9, #4066750463515557888         mov     x10, #5147614374084476928         fmov    d1, x9         fmov    d2, x10         fmul    d1, d0, d1         fadd    d2, d0, d2         cmp     w8, #256, lsl #12              fcsel   d1, d1, d2, lo         str     d1, [sp]         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                     ret .ERIT1_3:         lsr     w8, w8, #20         cmp     w8, #2047                       b.lo    .ERIT1_6         fsub    d0, d0, d0         ldp     x29, x30, [sp, #16]             add     sp, sp, #32                     ret .ERIT1_5:         adrp    x8, .ERIT1_0         ... \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u043e\u0434         add     sp, sp, #32                    ret .ERIT1_6:         mov     x0, sp         bl      __rem_pio2_nx_502(double, double*) \/\/ \u0432\u044b\u0437\u043e\u0432 __rem_pio2         and     w8, w0, #0x3         ... \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u043e\u0434         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                      ret .ERIT1_10:         ldp     d1, d0, [sp]         ...         fadd    d2, d2, d3         fmov    d5, #0.50000000         ldr     d3, [x8, :lo12:.ERIT1_5]         ...         ldp     x29, x30, [sp, #16]             add     sp, sp, #32                     ret .ERIT1_11:         ldp     d0, d1, [sp]         bl      __cos_nx_502(double, double)  \/\/ \u0432\u044b\u0437\u043e\u0432 __\u0441os         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                    ret .ERIT1_12:         ldp     d0, d1, [sp]         bl      __cos_nx_502(double, double) \/\/ \u0432\u044b\u0437\u043e\u0432 __\u0441os         fneg    d0, d0         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                     ret <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0431\u0435\u0436\u0438\u043c\u0441\u044f \u043f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043a\u043e\u0434\u0430, \u0438 \u043e\u043da \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 musl &#8212; \u0432\u0438\u0434\u043d\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 __rem_pio2\/__cos<\/p>\n<pre><code class=\"cpp\">double sin(double x) {     double y[2];     uint32_t ix;     unsigned n;      \/* High word of x. *\/     GET_HIGH_WORD(ix, x);     ix &amp;= 0x7fffffff;      \/* |x| ~&lt; pi\/4 *\/     if (ix &lt;= 0x3fe921fb) {         if (ix &lt; 0x3e500000) {  \/* |x| &lt; 2**-26 *\/             \/* raise inexact if x != 0 and underflow if subnormal*\/             FORCE_EVAL(ix &lt; 0x00100000 ? x\/0x1p120f : x+0x1p120f);             return x;         }         return __sin(x, 0.0, 0);     }      \/* sin(Inf or NaN) is NaN *\/     if (ix >= 0x7ff00000)         return x - x;      \/* argument reduction needed *\/     n = __rem_pio2(x, y);     switch (n&amp;3) {     case 0: return  __sin(y[0], y[1], 1);     case 1: return  __cos(y[0], y[1]);     case 2: return -__sin(y[0], y[1], 1);     default:         return -__cos(y[0], y[1]);     } }<\/code><\/pre>\n<p>\u041d\u043e \u043a\u0430\u043a\u0438\u043c \u0431\u044b \u043d\u0438 \u0431\u044b\u043b \u0443\u043c\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u043e\u043d \u043d\u0435 \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0437\u0434\u0435\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435 10-15% \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0439. \u041a\u043e\u043f\u0430\u0435\u043c \u0433\u043b\u0443\u0431\u0436\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c -03 + -math:precise \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043d\u0430\u0433\u0435\u043d\u0435\u0440\u0438\u043b\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0430\u043b\u0438\u0430\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f __sin_dorf_nx_502, \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439, \u043c\u0430\u043b\u043e \u0438\u0444\u043e\u0444, \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<details class=\"spoiler\">\n<summary>__sin_dorf_nx_502<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"assembly\">__sin_dorf_nx_502(float):         push    {r4, r5, r6, r7, r8, r9, r10, r11, lr}         add     r11, sp, #28         sub     sp, sp, #4         ldr     r1, .EVRT0_0         mov     r4, r0         bl      __aeabi_fmul         and     r1, r4, #-2147483648         orr     r1, r1, #1056964608         bl      __aeabi_fadd         bl      __aeabi_f2uiz         mov     r9, r0         bl      __aeabi_ui2f         ldr     r8, .EVRT0_1         mov     r5, r0         mov     r1, r5         ldr     r0, [r8, #24]         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r4         bl      __aeabi_fsub         mov     r4, r0         ldr     r0, [r8, #28]         mov     r1, r5         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r4         bl      __aeabi_fsub         mov     r1, r0         mov     r7, r0         bl      __aeabi_fmul         mov     r5, r0         mov     r0, r7         mov     r1, r5         bl      __aeabi_fmul         mov     r6, r0         ldr     r0, [r8, #8]         ldm     r8, {r4, r10}         mov     r1, r5         str     r0, [sp]                         ldr     r0, [r8, #12]         bl      __aeabi_fmul         ldr     r1, [r8, #16]         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r5         bl      __aeabi_fmul         ldr     r1, [r8, #20]         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r6         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r7         bl      __aeabi_fadd         mov     r7, r0         mov     r0, r4         mov     r1, r5         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r10         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r5         bl      __aeabi_fmul         mov     r1, r0         ldr     r0, [sp]                         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r5         bl      __aeabi_fmul         mov     r1, #1065353216         bl      __aeabi_fadd         tst     r9, #1         moveq   r0, r7         tst     r9, #2         eorne   r0, r0, #-2147483648         sub     sp, r11, #28         pop     {r4, r5, r6, r7, r8, r9, r10, r11, lr}         bx      lr .EVRT0_0:         .long   1059256694              @ 0x3f22f976 .EVRT0_1:         .long   .KI_MergedGlobals         ... .KI_MergedGlobals: \/\/ \u0432\u043e\u0442 \u0442\u0443\u0442 \u0431\u043b\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u0430, \u043e\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0441\u044f \u0433\u0434\u0435\u0442\u043e \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445         .long   3132246419              @ float -0.001360224         .long   1026203702              @ float 0.04165669         .long   3204448223              @ float -0.4999990         .long   3108801646              @ float -1.950727E-4         .long   1007190850              @ float 0.008332075         .long   3190467233              @ float -0.1666665         .long   1070141402              @ float 1.570796 \/\/\/ \u0432\u043e\u0442 \u044d\u0442\u043e Pi\/2         .long   866263401               @ float 7.549790E-8 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044e \u0441\u0438\u043d\u0443\u0441\u0430 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u043e\u043b\u0438\u043d\u043e\u043c\u043e\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 \u043f\u0441\u0435\u0432\u0434\u043e \u043a\u043e\u0434\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043a\u043e\u0434 \u043d\u0438\u0436\u0435. \u0418 \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a.<\/p>\n<pre><code class=\"cpp\">float __sin_dorf_nx_502(float x) {     const float EVRT0_0 = 0.636618972f;     const float EVRT0_1 = 1.0f;      const float KI_MergedGlobals[8] = {         -0.001360224f,         0.04165669f,         -0.4999990f,         -1.950727E-4f,         0.008332075f,         -0.1666665f,         1.570796f, \/\/ PI \/ 2         7.549790E-8f     };      float result;      float temp = EVRT0_0 * x;     temp = temp + 1056964608.0f;      int intTemp = (int)temp;     float floatTemp = (float)intTemp;      float r5 = floatTemp;     floatTemp = r5 * KI_MergedGlobals[0];     float r4 = x - floatTemp;     floatTemp = r5 * KI_MergedGlobals[1];     r4 = r4 - floatTemp;      float r7 = r4 * r4;     floatTemp = r7 * KI_MergedGlobals[2];     floatTemp = floatTemp + KI_MergedGlobals[3];     floatTemp = floatTemp * r7;     floatTemp = floatTemp + KI_MergedGlobals[4];     floatTemp = floatTemp * r7;     floatTemp = floatTemp + KI_MergedGlobals[5];     floatTemp = floatTemp * r7;     floatTemp = floatTemp + EVRT0_1;      if (intTemp &amp; 1) {         floatTemp = floatTemp * r4;     } else {         floatTemp = -floatTemp * r4;     }      result = floatTemp;      return result; } <\/code><\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e \u0432\u044b \u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0435, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0441\u044d\u043c\u043f\u043b \u0441 -03 + -math:fast? \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0430\u043b\u0438\u0430\u0441 \u0435\u0449\u0435 \u043d\u0430 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u043b\u0438\u0437\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0433\u0440\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e<\/p>\n<details class=\"spoiler\">\n<summary>__sin_corf_nx_502<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"assembly\">__sin_corf_nx_502(float):         push    {r4, r5, r6, r7, r8, r9, r10, r11, lr}         add     r11, sp, #28         sub     sp, sp, #4         bl      __aeabi_f2d         ldr     r2, .DUIE0_0         ldr     r3, .DUIE0_1         mov     r5, r0         mov     r6, r1         bl      __aeabi_dmul         bl      __aeabi_d2iz         mov     r10, r0         bl      __aeabi_i2d         ldr     r3, .DUIE0_2         mov     r2, #1610612736         bl      __aeabi_dmul         mov     r2, r0         mov     r3, r1         mov     r0, r5         mov     r1, r6         bl      __aeabi_dadd         bl      __aeabi_d2f         ldr     r1, .DUIE0_3         mov     r7, r0         and     r0, r10, #255         ldr     r8, [r1]         ldr     r0, [r8, r0, lsl #2]         bl      __aeabi_f2d         mov     r3, #266338304         mov     r2, #0         str     r0, [sp]                       mov     r9, r1         orr     r3, r3, #-1342177280         bl      __aeabi_dmul         mov     r5, r0         mov     r0, r7         mov     r6, r1         bl      __aeabi_f2d         mov     r7, r0         mov     r4, r1         mov     r0, r5         mov     r1, r6         mov     r2, r7         mov     r3, r4         bl      __aeabi_dmul         mov     r5, r0         add     r0, r10, #64         mov     r6, r1         and     r0, r0, #255         ldr     r0, [r8, r0, lsl #2]         bl      __aeabi_f2d         mov     r2, r5         mov     r3, r6         bl      __aeabi_dadd         mov     r2, r7         mov     r3, r4         bl      __aeabi_dmul         ldr     r2, [sp]                        mov     r3, r9         bl      __aeabi_dadd         bl      __aeabi_d2f         sub     sp, r11, #28         pop     {r4, r5, r6, r7, r8, r9, r10, r11, lr}         bx      lr .DUIE0_0:         .long   1682373044              @ 0x6446f9b4 .DUIE0_1:         .long   1078222640              @ 0x40445f30 .DUIE0_2:         .long   3214483963              @ 0xbf9921fb .DUIE0_3:         .long   __sin_corf_duie_nx_502 <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u043e\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439, \u0438 \u0441\u0443\u0434\u044f \u043f\u043e \u043b\u043e\u0433\u0438\u043a\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u044d\u0442\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0441\u0438\u043d\u0443\u0441\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0411\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u0441\u0435\u0445, \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442.<\/p>\n<pre><code class=\"cpp\">float __sin_corf_nx_502(float x) {     const double DUIE0_0 = 1.4636916370976118;     const double DUIE0_1 = 3.141592653589793; \/\/ PI     const double DUIE0_2 = -0.0009424784718423055;      const float* DUIE0_3 = __sin_corf_duie_nx_502;      double temp = x * DUIE0_0;     temp = temp + DUIE0_1;      int intTemp = static_cast&lt;int>(temp);     float floatTemp = static_cast&lt;float>(intTemp);      float r5 = floatTemp;     floatTemp = r5 * DUIE0_2;     float r4 = x - floatTemp;      double r7 = r4 * r4;     floatTemp = static_cast&lt;float>(r7);      int index = intTemp &amp; 255;     float floatTemp2 = *(DUIE0_3 + index);      double r2 = floatTemp2;     double r3 = static_cast&lt;double>(intTemp >> 8);     double r0 = static_cast&lt;double>(r5);     double r1 = static_cast&lt;double>(r4);     r0 = r0 + r1;     r0 = r0 * r2;     r0 = r0 + r3;      float result = static_cast&lt;float>(r0);      return result; }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0449\u0435 \u043f\u043e\u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430\u0445 \u043d\u0430 \u0442\u0435\u043c\u0443 \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0438\u043d\u0443\u0441\u0430, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0435\u0449\u0435 \u0442\u0430\u043a\u0443\u044e \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u044e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bhaskara_I%27s_sine_approximation_formula\" rel=\"noopener noreferrer nofollow\">https:\/\/en.wikipedia.org\/wiki\/Bhaskara_I&#8217;s_sine_approximation_formula<\/a> \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u043f\u043e \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 0.001, \u0447\u0442\u043e \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<p>\u0418\u043b\u0438 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 <a href=\"https:\/\/www.researchgate.net\/publication\/2930018_Fast_Trigonometric_Functions_Using_Intel's_Sse2\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u044e \u041b\u0430\u0440\u0441\u0430 \u041d\u0438\u043b\u0430\u043d\u0434\u0430 (Lars Nyland, nVidia)<\/a>, \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 CUDA.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0438\u043d\u0443\u0441\u043e\u0432 \u0432 \u0434\u0432\u0438\u0436\u043a\u0435 Dagor \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u043e\u043d\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e  \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0430 \u0432\u0441\u0435\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445, <a href=\"https:\/\/github.com\/GaijinEntertainment\/vecmath\/blob\/master\/dag_vecMath_trig.h\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0443\u0442<\/a>. \u041d\u0435 \u0441\u043e\u0447\u0442\u0438\u0442\u0435 \u0437\u0430 \u0440\u0435\u043a\u043b\u0430\u043c\u0443, \u044f \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043c\u043e\u0436\u0435\u0442 \u043a\u043e\u043c\u0443 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f. \u0421\u0430\u043c\u044b\u0445 \u0434\u043e\u0431\u0440\u044b\u0445 \u043f\u0440\u0438\u0432\u0435\u0442\u043e\u0432 \u043c\u043e\u0438\u043c \u0431\u044b\u0432\u0448\u0438\u043c \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c.<\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434\u044b<\/h3>\n<p>\u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u044b \u043c\u044b \u0441 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u043d\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0434\u043a. \u0427\u0435\u0441\u0442\u044c \u0438 \u0445\u0432\u0430\u043b\u0430 \u044f\u043f\u043e\u043d\u0441\u043a\u0438\u043c \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c, \u043f\u043e\u0434\u0430\u0440\u0438\u0432\u0448\u0438\u043c \u043c\u0438\u0440\u0443 \u044d\u0442\u0443 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u0423 \u043c\u0435\u043d\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0432\u043e\u043f\u0440\u043e\u0441, \u043d\u0430\u0444\u0438\u0433\u0430 \u0442\u0440\u0438?<\/p>\n<p><strong>UPD<\/strong>: \u0432 \u043b\u0438\u0447\u043a\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u043e\u0432\u0430\u0440\u0438\u0449, \u0447\u0442\u043e \u0442\u0430\u043a \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 \u0438 \u043f\u0430\u043b\u0435\u043d\u044b\u0445 \u0441\u0434\u043a, \u0431\u0435\u0437 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430\u0441\u044c \u043f\u0435\u0440\u0432\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0431\u0438\u043b\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0439\u0442\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e\u043c\u043e\u0433\u0430\u043b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0443\u043a\u0440\u0430\u0434\u0435\u043d\u043d\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0438 \u043a\u043b\u044e\u0447\u0438. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u044f \u043d\u0435 \u043c\u043e\u0433\u0443, \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0432\u0435\u0440\u0438\u0442\u044c \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><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\/ru\/articles\/741184\/\"> https:\/\/habr.com\/ru\/articles\/741184\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Gaijin \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u043c\u043d\u0435 \u0434\u043e\u0432\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u044b \u0438\u0433\u0440 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c Nintendo Switch, \u0442\u043e\u0433\u0434\u0430 \u0432\u043e\u0432\u0441\u044e \u0437\u0430\u0432\u043e\u0435\u0432\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u043d\u043e\u0432\u044b\u0435 \u0440\u044b\u043d\u043a\u0438. \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u043f\u0435\u0440\u0432\u044b\u043c \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435. \u0410 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u043d\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u0432\u0438\u0436\u043a\u0430 \u0441 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439, \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u0438, \u0442\u043e \u0432\u0441\u0435 \u0433\u0440\u0430\u0431\u043b\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u0438 \u0431\u0435\u0440\u0435\u0436\u043d\u043e \u043d\u0430 \u043d\u0438\u0445 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u0432\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u0433\u0440\u044b, \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 middleware (\u0441\u0432\u044f\u0437\u043a\u0430 dagor engine + nxsdk + jam) \u0438 \u043a\u043e\u0434 \u043e\u0431\u0440\u0430\u0441\u0442\u0430\u043b \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, build matrix, \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c\u0438, \u043f\u0440\u043e\u0433\u043e\u043d\u043e\u043c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438. \u041d\u0430\u0434\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u0447\u0442\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 2018 \u0433\u043e\u0434\u0430, \u0432 \u0441\u0430\u043c\u043e\u043c switch sdk \u043d\u0435 \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0447\u0430\u0441\u0442\u044c posix \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0440\u043e\u0434\u0435 poll \u0438 send\/receive, \u0438 \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, posix \u043f\u0440\u043e\u0441\u043b\u043e\u0439\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u0438\u043c. \u0414\u043e\u0448\u043b\u0438 \u0442\u043e\u0433\u0434\u0430 \u0440\u0443\u043a\u0438 \u0438 \u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0438 \u0431\u044b\u043b\u0438 \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0432 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0447\u0430\u0441\u0442\u0438 \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 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0436\u0438\u043c\u0430\u0445 \u0441\u0431\u043e\u0440\u043a\u0438. \u0414\u043b\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0438, sdk \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u0440\u0435\u0437\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 musl libc (<a href=\"https:\/\/www.musl-libc.org\/\" rel=\"noopener noreferrer nofollow\">https:\/\/www.musl-libc.org\/<\/a>), \u0432\u0441\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u0438\u043d\u043a\u0443\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a clang&#8217;\u043e\u043c \u043e\u0442 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e 9 \u0432\u0435\u0440\u0441\u0438\u0438 (2018 \u0433\u043e\u0434), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c \u0441\u0430\u043c\u043e\u0439 libc \u0432 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0431\u044b\u043b\u043e, \u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u0438\u0437\u0430\u0441\u043c \u0438 \u0431\u043e\u043b\u0435 \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n<figure class=\"\">\n<div><figcaption>To sine or not to sine?<\/figcaption><\/div>\n<\/figure>\n<hr\/>\n<p>\u0421\u0432\u043e\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u043f\u0438\u0448\u0443 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u0447\u0442\u043e \u043d\u0430 \u0434\u0432\u043e\u0440\u0435 \u0431\u044b\u043b 2018. \u041a\u043e\u0434 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0434\u0435\u0442\u0441\u043a\u0438\u0439, \u0433\u043e\u043d\u044f\u0435\u043c \u0441\u0438\u043d\u0443\u0441 (\u0432 \u0441\u0434\u043a \u0432\u0441\u044f \u0442\u0440\u0438\u0433\u043e\u043d\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u043b\u0435\u0436\u0430\u043b\u0430 \u0432 tr1) \u043f\u043e \u043a\u0440\u0443\u0433\u0443 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/p>\n<pre><code class=\"cpp\">static void nxsdk_sin(benchmark::State&amp; state) {     \/\/ Code inside this loop is measured repeatedly     float i = 0;     for( auto _ : state) {         float p = tr1::sin(p);          i += 0.1f;         benchmark::DoNotOptimize(p);     } } BENCHMARK(nxsdk_sin);<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b (\u043c\u0435\u043d\u044c\u0448\u0435\u0435 \u0432\u0440\u0435\u043c\u044f &#8212; \u043b\u0443\u0447\u0448\u0435)<\/p>\n<pre><code>-----------(\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0443\u0447\u0448\u0435)----------------------------- Benchmark            Time             CPU   Iterations ------------------------------------------------------ nxsdk_sin         8.68 ns         8.58 ns     74666667 &lt;&lt;&lt; https:\/\/git.musl-libc.org\/cgit\/musl\/tree\/src\/math\/sin.c nxsdk_sin_vec     8.35 ns         8.30 ns     75825003 &lt;&lt;&lt; sin(vec4f) dagor_sin         5.48 ns         5.47 ns    102504001 glibc_sin         8.28 ns         8.08 ns     77623654 &lt;&lt;&lt; https:\/\/github.com\/lattera\/glibc\/blob\/master\/sysdeps\/ieee754\/dbl-64\/s_sin.c <\/code><\/pre>\n<p>\u041f\u043e\u043a\u0430 \u0432\u0441\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e, \u0444\u043e\u0440\u043c\u0443\u043b\u044b \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f sin \u0432 musl \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0435 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0432 glibc, \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435. \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u043c -03 + -math:precise, \u0441\u0438\u043d\u0443\u0441 \u043e\u0442 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u0441\u0442\u0430\u043b \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 \u0442\u0440\u0435\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0442\u0443\u0442 \u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0443\u043c\u043d\u044b\u0439, \u043b\u0438\u0431\u043e \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0432\u0440\u0435\u0442 \u0438 \u043b\u0443\u043d\u0430 \u043d\u0435 \u0432 \u0442\u043e\u0439 \u0444\u0430\u0437\u0435, \u043b\u0438\u0431\u043e \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0439 \u043a\u043e\u043b\u043b\u0435\u0433\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043c\u043d\u0435 \u044d\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u044f \u0435\u043c\u0443 \u0442\u0430\u043a \u0438 \u043e\u0442\u0432\u0435\u0442\u0438\u043b &#8212; \u043c\u043e\u043b, \u0443 \u0442\u0435\u0431\u044f \u0431\u0435\u043d\u0447 \u0441\u043b\u043e\u043c\u0430\u043b\u0441\u044f, \u0438\u0434\u0438 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u044c, \u0438 \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0434\u0435\u043d\u044c \u043c\u044b \u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0443\u0436\u0435 \u0432\u043c\u0435\u0441\u0442\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0444\u0443 \u0432\u0437\u044f\u0442\u044c\u0441\u044f \u0442\u0430\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0442\u043a\u0443\u0434\u0430 (\u043d\u0443 \u044d\u0442\u043e \u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0430\u043a \u0434\u0443\u043c\u0430\u043b). \u041e\u0436\u0438\u0434\u0430\u0435\u043c\u043e \u0432\u0438\u0434\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 glibc_sin \u0437\u0430 \u0441\u0447\u0435\u0442 \u0430\u0433\u0440\u0435\u0441\u0441\u0438\u0432\u043d\u044b\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439 clang&#8217;a.<\/p>\n<pre><code>-----------(\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0443\u0447\u0448\u0435)----------------------------- Benchmark            Time             CPU   Iterations ------------------------------------------------------ nxsdk_sin         6.03 ns         6.00 ns     87625024 nxsdk_sin_vec     5.82 ns         5.78 ns     90022043 dagor_sin         5.38 ns         5.27 ns    104602002 glibc_sin         8.08 ns         8.05 ns     78214356<\/code><\/pre>\n<p>\u0415\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 &#171;\u0434\u0440\u0443\u0433\u043e\u0439&#187; \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442 \u0431\u044b\u043b \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0441 \u0444\u043b\u0430\u0433\u0430\u043c\u0438 -O3 + -math:fast, \u0442\u0443\u0442 \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0438\u0432\u0438\u043b\u0441\u044f \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 dagor_sin \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c\u043e\u0439 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435 \u0441\u0438\u043d\u0443\u0441\u044b \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 \u0441 std::sin \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u043b\u0430 1e-6<\/p>\n<pre><code>-----------(\u043c\u0435\u043d\u044c\u0448\u0435 \u043b\u0443\u0447\u0448\u0435)----------------------------- Benchmark            Time             CPU   Iterations ------------------------------------------------------ nxsdk_sin         4.03 ns         3.99 ns    132307692 nxsdk_sin_vec     4.09 ns         4.08 ns    131403251 dagor_sin         5.13 ns         5.10 ns    110400021 glibc_sin         7.43 ns         7.16 ns     79544722<\/code><\/pre>\n<p>\u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043b\u0435\u0437\u0442\u044c \u0432 \u0434\u0438\u0437\u0430\u0441\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0433\u0435\u043d\u0438\u0438 \u0438\u0437 \u041d\u0438\u043d\u0442\u0435\u043d\u0434\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0438\u0445 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u044e\u0449\u0438\u0445 \u0446\u0438\u0444\u0440 \u0432 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0435. <\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0440\u0435\u0436\u0438\u043c\u0430 -01 (speed), \u044f \u0432\u044b\u043b\u043e\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0438 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043d\u0435 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0434\u0438\u0437\u0430\u0441\u043c, \u043c\u0430\u043b\u043e \u043b\u0438 \u0442\u0430\u043c \u043a\u0430\u043a\u043e\u0435 IP \u0435\u0441\u0442\u044c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f sin \u0438\u0437 \u043f\u043e\u0441\u0442\u0430\u0432\u043a\u0438 nx sdk, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u0438\u0430\u0441\u043e\u043c \u0434\u043b\u044f __sin_nx_502, (2018 \u0433\u043e\u0434, \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 sdk 4.0 \u0438 5.0) \u0432\u0438\u0434\u0438\u043c\u043e \u0438\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<details class=\"spoiler\">\n<summary>__sin_nx_502<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"assembly\">__sin_nx_502(double):         sub     sp, sp, #32                     stp     x29, x30, [sp, #16]              add     x29, sp, #16                    fmov    x8, d0         mov     w9, #8699         ubfx    x8, x8, #32, #31         movk    w9, #16361, lsl #16         cmp     w8, w9         b.hi    .ERIT1_3                \/\/ .ERITX_X -> .BBX_X arm         lsr     w9, w8, #20         cmp     w9, #996                       b.hi    .ERIT1_5         mov     x9, #4066750463515557888         mov     x10, #5147614374084476928         fmov    d1, x9         fmov    d2, x10         fmul    d1, d0, d1         fadd    d2, d0, d2         cmp     w8, #256, lsl #12              fcsel   d1, d1, d2, lo         str     d1, [sp]         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                     ret .ERIT1_3:         lsr     w8, w8, #20         cmp     w8, #2047                       b.lo    .ERIT1_6         fsub    d0, d0, d0         ldp     x29, x30, [sp, #16]             add     sp, sp, #32                     ret .ERIT1_5:         adrp    x8, .ERIT1_0         ... \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u043e\u0434         add     sp, sp, #32                    ret .ERIT1_6:         mov     x0, sp         bl      __rem_pio2_nx_502(double, double*) \/\/ \u0432\u044b\u0437\u043e\u0432 __rem_pio2         and     w8, w0, #0x3         ... \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u043e\u0434         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                      ret .ERIT1_10:         ldp     d1, d0, [sp]         ...         fadd    d2, d2, d3         fmov    d5, #0.50000000         ldr     d3, [x8, :lo12:.ERIT1_5]         ...         ldp     x29, x30, [sp, #16]             add     sp, sp, #32                     ret .ERIT1_11:         ldp     d0, d1, [sp]         bl      __cos_nx_502(double, double)  \/\/ \u0432\u044b\u0437\u043e\u0432 __\u0441os         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                    ret .ERIT1_12:         ldp     d0, d1, [sp]         bl      __cos_nx_502(double, double) \/\/ \u0432\u044b\u0437\u043e\u0432 __\u0441os         fneg    d0, d0         ldp     x29, x30, [sp, #16]              add     sp, sp, #32                     ret <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0440\u043e\u0431\u0435\u0436\u0438\u043c\u0441\u044f \u043f\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043a\u043e\u0434\u0430, \u0438 \u043e\u043da \u043f\u043e\u0447\u0442\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 musl &#8212; \u0432\u0438\u0434\u043d\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 __rem_pio2\/__cos<\/p>\n<pre><code class=\"cpp\">double sin(double x) {     double y[2];     uint32_t ix;     unsigned n;      \/* High word of x. *\/     GET_HIGH_WORD(ix, x);     ix &amp;= 0x7fffffff;      \/* |x| ~&lt; pi\/4 *\/     if (ix &lt;= 0x3fe921fb) {         if (ix &lt; 0x3e500000) {  \/* |x| &lt; 2**-26 *\/             \/* raise inexact if x != 0 and underflow if subnormal*\/             FORCE_EVAL(ix &lt; 0x00100000 ? x\/0x1p120f : x+0x1p120f);             return x;         }         return __sin(x, 0.0, 0);     }      \/* sin(Inf or NaN) is NaN *\/     if (ix >= 0x7ff00000)         return x - x;      \/* argument reduction needed *\/     n = __rem_pio2(x, y);     switch (n&amp;3) {     case 0: return  __sin(y[0], y[1], 1);     case 1: return  __cos(y[0], y[1]);     case 2: return -__sin(y[0], y[1], 1);     default:         return -__cos(y[0], y[1]);     } }<\/code><\/pre>\n<p>\u041d\u043e \u043a\u0430\u043a\u0438\u043c \u0431\u044b \u043d\u0438 \u0431\u044b\u043b \u0443\u043c\u043d\u044b\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u043e\u043d \u043d\u0435 \u0434\u0430\u0441\u0442 \u043d\u0430\u043c \u0437\u0434\u0435\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435 10-15% \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430, \u043a\u0430\u043a\u0438\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0439. \u041a\u043e\u043f\u0430\u0435\u043c \u0433\u043b\u0443\u0431\u0436\u0435, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c -03 + -math:precise \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043d\u0430\u0433\u0435\u043d\u0435\u0440\u0438\u043b\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0430\u043b\u0438\u0430\u0441 \u043d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f __sin_dorf_nx_502, \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0439, \u043c\u0430\u043b\u043e \u0438\u0444\u043e\u0444, \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<details class=\"spoiler\">\n<summary>__sin_dorf_nx_502<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"assembly\">__sin_dorf_nx_502(float):         push    {r4, r5, r6, r7, r8, r9, r10, r11, lr}         add     r11, sp, #28         sub     sp, sp, #4         ldr     r1, .EVRT0_0         mov     r4, r0         bl      __aeabi_fmul         and     r1, r4, #-2147483648         orr     r1, r1, #1056964608         bl      __aeabi_fadd         bl      __aeabi_f2uiz         mov     r9, r0         bl      __aeabi_ui2f         ldr     r8, .EVRT0_1         mov     r5, r0         mov     r1, r5         ldr     r0, [r8, #24]         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r4         bl      __aeabi_fsub         mov     r4, r0         ldr     r0, [r8, #28]         mov     r1, r5         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r4         bl      __aeabi_fsub         mov     r1, r0         mov     r7, r0         bl      __aeabi_fmul         mov     r5, r0         mov     r0, r7         mov     r1, r5         bl      __aeabi_fmul         mov     r6, r0         ldr     r0, [r8, #8]         ldm     r8, {r4, r10}         mov     r1, r5         str     r0, [sp]                         ldr     r0, [r8, #12]         bl      __aeabi_fmul         ldr     r1, [r8, #16]         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r5         bl      __aeabi_fmul         ldr     r1, [r8, #20]         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r6         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r7         bl      __aeabi_fadd         mov     r7, r0         mov     r0, r4         mov     r1, r5         bl      __aeabi_fmul         mov     r1, r0         mov     r0, r10         bl      __aeabi_fadd         mov     r1, r0         mov     r0, r5         bl      __aeabi_fmul         mov     r1, r0         ldr     r0, [sp]                         bl      __aeabi_fadd<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-348645","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348645","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=348645"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/348645\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}