{"id":353255,"date":"2024-05-20T22:24:21","date_gmt":"2024-05-20T22:24:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353255"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353255","title":{"rendered":"<span>\u0422\u0435\u0445\u043d\u0438\u043a\u0443\u043c: \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0412\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0427\u0438\u0441\u043b\u0430 \u0438\u0437 \u0421\u0442\u0440\u043e\u0447\u043a\u0438<\/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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/621\/b0f\/660\/621b0f66024276c97bd5abe64f16a590.JPG\" width=\"1044\" height=\"401\"\/><\/figure>\n<p>\u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 UART \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u043e\u0432, \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0445 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0439, \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. <\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043b\u043e\u0433\u0438 \u0441 SD-\u043a\u0430\u0440\u0442\u044b. \u041d\u0430\u0434\u043e \u0432\u044b\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 CSV \u0441\u0442\u0440\u043e\u0447\u0435\u043a. <\/p>\n<p>\u0415\u0449\u0435 \u044d\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 NMEA 0183 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430\u0445, \u0447\u0442\u043e\u0431\u044b \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0448\u0438\u0440\u043e\u0442\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u0435\u043d \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0439 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u0435\u043a.<\/p>\n<h3>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>\u0414\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 (\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435) \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439<\/p>\n<pre><code class=\"cpp\">bool try_str2real(const char* const text, double* const double_value);<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043b\u0435\u0433\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0444\u0430\u0432\u0438\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0435: &#8216; &#8216;, &#8216;+&#8217;, &#8216;-&#8216;, 0 1 2 3 4 5 6 7 8 9, &#8216;e&#8217;, &#8216;E&#8217; &#8216;.&#8217; &#8216;\\n&#8217; &#8216;\\r&#8217;<\/p>\n<p>\u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0435\u0441\u0442 \u043a\u0435\u0439\u0441\u043e\u0432:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\"><strong>\u2116<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\"><strong>\u0412\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\"><strong>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u044d\u0442\u043e \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e?<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;.0&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">0.0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;+.&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;005047e+6&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">5047000000<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;-8115e957&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">INF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">5<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;2e0&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">6<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;4e+&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">7<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;.&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">8<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;12.5k&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">12500<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">9<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;100n&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">0.0000001<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0447\u0438\u0441\u0435\u043b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u044d\u0442\u043e \u0435\u0449\u0435 \u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u0431\u0435\u0437 Test-driven development (TDD) \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0440\u0435\u0430\u043b\u044c\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1rbEw8p8CMHzM5DJUYGxDX-BCQ8sZsp4jDMRsbifJD9k\/edit#gid=0\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442<\/a>.<\/p>\n<p>\u041f\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/leetcode.com\/problems\/valid-number\/description\/\" rel=\"noopener noreferrer nofollow\">LeetCode \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u0443\u0440\u043e\u0432\u043d\u044f hard<\/a>. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/689\/804\/4b6\/6898044b658da87f337dab2cf18211e4.JPG\" width=\"593\" height=\"413\"\/><\/figure>\n<p>\u0425\u043e\u0442\u044f \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0443\u0442 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u0412\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e \u0442\u043e\u0442 \u0440\u0435\u0434\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 LeetCode \u043c\u0435\u043b\u044c\u043a\u0430\u044e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 prod(\u0430).<\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<p><strong>\u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/strong>&#8212; \u044d\u0442\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d (\u043c\u0430\u0441\u0441\u0430, \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435, \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435).<\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <strong>sscanf<\/strong>() \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u0430\u044f \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f sscanf() \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 double \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0434\u0430 \u0435\u0449\u0451 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c  \u0432\u044b\u0434\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0412\u043e\u0442 \u043e\u0442\u0447\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sscanf().<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/159\/4da\/6cf\/1594da6cf7b559498c992d9cf590126d.png\" width=\"866\" height=\"722\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/159\/4da\/6cf\/1594da6cf7b559498c992d9cf590126d.png\"\/><\/figure>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0432 sscanf()<strong> <\/strong>\u043f\u043e\u0434\u0430\u0442\u044c \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e &#8216;\u0435&#8217;, \u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0443\u043f\u0430\u0434\u0435\u0442 \u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435!<\/p>\n<p>\u041d\u0443\u0436\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u043a\u0438. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 (DFS). \u0412\u043e\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/25b\/122\/1ed\/25b1221ed447399c64cd1d5890842c18.png\" width=\"1044\" height=\"401\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/25b\/122\/1ed\/25b1221ed447399c64cd1d5890842c18.png\"\/><\/figure>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u044d\u0442\u0443 \u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c 5 \u0438\u043b\u0438 6 \u0447\u0435\u0442\u043a\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">typedef enum{ PARSE_NUMBER_STATE_PARSE_SIGN=1, PARSE_NUMBER_STATE_PARSE_INTEGER=2, PARSE_NUMBER_STATE_PARSE_FRACTION=3, PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN=4, PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER=5, PARSE_NUMBER_STATE_DONE=6,  PARSE_NUMBER_STATE_UNDEF=0 }ParseNumberStates_t;<\/code><\/pre>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e-\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0438. \u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041e\u043d\u0430 \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438. <\/p>\n<pre><code class=\"cpp\"> typedef struct {     double value;     double mantissa;     double exponenta;     char cur_letter;     int8_t sign;     long double integer; \/*uint64_t integer *\/     uint32_t fraction_order;     double fraction ;     ParseNumberStates_t state;     bool spot_mantissa;     bool spot_exponent;     int8_t exponent_sign;     uint32_t exponent_integer; }Text2NumberFsm_t;  bool try_str2real(const char* const text, double* const double_value){     bool res = false;     uint32_t len = 0;     if(text){         len = strlen(text);         if(len){             if(double_value){                 res = true;             }         }     }      if(res) {         Text2NumberFsm_t Fsm;         res = text_2_number_init(&amp;Fsm);         uint32_t i = 0;         uint32_t ok = 0;         uint32_t err = 0;         LOG_DEBUG(STRING, \"ParseDoubleIn:%u:[%s]\", len, text);          for(i=0; i&lt;len; i++){             Fsm.cur_letter = text[i];             res = number_proc_one(&amp;Fsm);             if (res) {                 ok++;             } else {                 err++;                 LOG_ERROR(STRING,\"ProcErr: ch[%u]=%c \",i, text[i]);                 break;             }         }          if(0==err) {             Fsm.cur_letter ='\\n';             res = number_proc_one(&amp;Fsm);             if (res) {                 ok++;             } else {                 err++;             }         }         if (0==err) {             *double_value = Fsm.value;             res = true;         } else {             LOG_ERROR(STRING,\"len:%u ok:%u\",len, ok);             res = false;         }     }     return res; }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430<\/p>\n<pre><code class=\"cpp\">static bool number_proc_one(Text2NumberFsm_t* Node){     bool res = false;     LOG_DEBUG(STRING, \"Proc: %s\",NumberParserFsm2Str(Node));     if(Node) {         switch (Node->state) {             case PARSE_NUMBER_STATE_PARSE_SIGN:                 res = number_proc_parse_sign(Node); break;             case PARSE_NUMBER_STATE_PARSE_INTEGER:                 res = number_proc_parse_integer(Node); break;             case PARSE_NUMBER_STATE_PARSE_FRACTION:                 res = number_proc_parse_fracion(Node); break;             case    PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN:                 res = number_proc_parse_exponenta_sign(Node); break;             case    PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER:                 res = number_proc_parse_exponenta_integer(Node); break;             case PARSE_NUMBER_STATE_DONE:                 res = number_proc_done(Node); break;          default: res = false; break;         }      }     return res; }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">static bool text_2_number_init(Text2NumberFsm_t* Node){     bool res = false;     if (Node) {         Node->value = 0.0;         Node->sign = 1;         Node->integer = 0;         Node->exponent_integer = 0;         Node->fraction = 0.0;         Node->fraction_order = 1;         Node->spot_mantissa = false;         Node->spot_exponent = false;         Node->mantissa = 1.0;         Node->exponent_sign = 1;         Node->exponenta = 1.0;         Node->cur_letter ='\\0';         Node->state = PARSE_NUMBER_STATE_PARSE_SIGN;         res = true;     }     return res; }<\/code><\/pre>\n<p>\u0410 \u044d\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435<\/p>\n<pre><code class=\"cpp\">  bool  number_compose_result(Text2NumberFsm_t* Node){     bool res = false;     if(Node) {     if(Node->spot_mantissa) {             Node->value = ( (double)Node->sign ) * (((double) Node->integer) + Node->fraction);             LOG_DEBUG(STRING,\"Val:%f\",Node->value);             Node->state = PARSE_NUMBER_STATE_DONE;             res = true;         } else {             LOG_ERROR(STRING,\"NoMantissa\");     }     }     return res; }  static bool number_proc_parse_sign(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case 'E':     case 'e': {         Node->mantissa = 1.0;         Node->spot_mantissa = false;         Node->integer = 1;         Node->fraction = 0.0;         Node->state = PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN;         res = true;      }break;      case ' ': {         res = true;     }break;     case '+': {         Node->sign = 1;         Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;         res = true;     }break;     case '-': {         Node->sign =-1;         Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;         res = true;     }break;     case '0':  {         Node->sign =1;         Node->spot_mantissa=true;         Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;         res = true;     }break;     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9': {         uint8_t digit = 0;         Node->spot_mantissa = true;         res= try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         Node->integer *=10;         Node->integer += digit;          Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;     }break;     case '.': {     Node->fraction_order = 1;         Node->integer = 0;         Node->spot_mantissa = false;         Node->state = PARSE_NUMBER_STATE_PARSE_FRACTION;         res = true;     }break;     case '\\n':         res = false;         break;     case '\\r':         res = false;         break;     default:         res = false;         break;     }     return res; }  static bool number_mantissa_save(Text2NumberFsm_t* Node){     bool res = false;     if(Node) {         Node->mantissa = ( (double)Node->sign   ) * (((double) Node->integer) + Node->fraction);         LOG_DEBUG(STRING,\"Mantissa:%f\",Node->mantissa);         res = true;     }     return res; }  static bool number_proc_parse_integer(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case 'E':     case 'e': {         res = number_mantissa_save(Node);         Node->state =PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN;     }break;     case ' ': {         res = false;     }break;     case '.':{     Node->fraction_order=1;         Node->state = PARSE_NUMBER_STATE_PARSE_FRACTION;         res = true;     } break;     case '0':     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9': {         uint8_t digit = 0;         res= try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         LOG_PARN(STRING,\"ParseInt %u\", digit);         Node->integer *= 10;         Node->integer += digit;         Node->spot_mantissa = true;         res = true;     }break;      case '\\r':     case '\\n':{         res = number_compose_result(Node);     } break;       default:{         res = false;     } break;     }     return res; }   static bool number_proc_parse_exponenta_sign(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case '+': {         Node->exponent_sign = 1;         Node->state = PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;         res = true;     }break;      case '-': {         Node->exponent_sign = -1;         res = true;         Node->state= PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;     }        break;      case '0':{     Node->exponent_integer = 0;     Node->exponent_sign = 1;     Node->spot_exponent = true;     Node->state = PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;     res = true;     }break;     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9':{         uint8_t digit = 0;         res= try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         LOG_PARN(STRING,\"ParseExpInt %u\",digit);         Node->exponent_integer *=10;         Node->spot_exponent = true;         Node->exponent_integer += digit;         Node->state= PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;         res = true;     }break;      case '\\r':     case '\\n':{res = false;} break;     default: res = false; break;     }     return res; }  static bool number_exponenta_calc(Text2NumberFsm_t* Node){     bool res = false;     if(Node) {     if(Node->spot_exponent ){             int32_t rank = ((int32_t)Node->exponent_integer) * ((int32_t)Node->exponent_sign);             LOG_DEBUG(STRING,\"ExpRank %d\",rank);             double power = (double )rank;             LOG_DEBUG(STRING,\"power %f\",power);             if(rank &lt; 306) {                 if(-306 &lt; rank) {                     Node->exponenta = pow(10.0,power);                     LOG_DEBUG(STRING,\"Exponenta: %f\",Node->exponenta);                     res = true;                 } else {                 Node->exponenta = 0.0;                     LOG_ERROR(STRING,\"MathError:TooSmalExpPower %d\",rank);                     res = false;                 }             } else {                 LOG_ERROR(STRING,\"MathError:TooBigExpPower %d\",rank);                 res = false;             }     } else {     LOG_ERROR(STRING,\"NoExponents\");     }     }     return res ; }  static bool number_proc_parse_exponenta_integer(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case '0':     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9': {         uint8_t digit = 0;         res= try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         LOG_PARN(STRING,\"ParseExpInt %u\",digit);         Node->exponent_integer *=10;         Node->exponent_integer += digit;         Node->spot_exponent = true;         Node->state= PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;         res = true;     }break;      case '\\r':     case '\\n': {         res = number_exponenta_calc(Node);         if (res) {         if(Node->spot_mantissa) {                 double mantissa = 0.0;                 mantissa =((double)Node->sign)*(((double)Node->integer)+((double)Node->fraction));                 LOG_DEBUG(STRING,\"mantissa %f\", mantissa);                 Node->value = mantissa*(Node->exponenta);                 Node->state= PARSE_NUMBER_STATE_DONE;         }else {         LOG_DEBUG(STRING,\"NoMantissa\");         res = false;         }         }     }break;     default:         res = false;         break;     }     return res; }  bool number_compose_mantissa(Text2NumberFsm_t* Node){     bool res = false;     if(Node) {     Node->mantissa =((double)Node->sign)*(((double)Node->integer)+((double)Node->fraction));     res = true;     }     return res; }  static bool  number_proc_parse_fracion(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter){     case 'E':     case 'e':{     res = number_compose_mantissa(Node);     Node->state = PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN;     }break;     case ' ': {     LOG_ERROR(STRING,\"TornFlowErr!\");     res = false;     }break;     case '.': {     LOG_ERROR(STRING,\"DoubleDotErr!\");     res = false;}break;     case '0':     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9': {         uint8_t digit = 0;         res = try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         double fraction_digit =  (    (double)digit  ) \/ (   pow(10.0, (double) Node->fraction_order) );         LOG_DEBUG(STRING,\"+ %f\",fraction_digit);         Node->spot_mantissa= true;         Node->fraction += fraction_digit;          Node->fraction_order++;         res = true;     }break;     case '-':     case '+': {res = false;}break;      case '\\r':     case '\\n':{         res = number_compose_result(Node);     } break;      }     return res; }  static bool number_proc_done(Text2NumberFsm_t* Node){     bool res = false;     LOG_DEBUG(STRING, \"Proc: %s\",NumberParserFsm2Str(Node));     switch(Node->cur_letter){         case '\\n':         case '\\r':{             res = true;         } break;         default:{             res = false;         }break;     }     return res; } <\/code><\/pre>\n<p>\u042f \u043e\u0447\u0435\u043d\u044c \u0440\u0430\u0434, \u0447\u0442\u043e \u043d\u0430\u0448\u0435\u043b \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 <strong>LeetCode (65. Valid Number)<\/strong>. \u0422\u0430\u043c \u0443\u0436\u0435 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432. \u0418\u0445 \u0441\u0430\u0439\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u043c\u0431\u0438\u0442\u044c unit \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u043c\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438 \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043e\u043d\u043e \u0432\u044b\u0441\u0442\u043e\u044f\u043b\u043e! <\/p>\n<p>\u041c\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <strong>LeetCode<\/strong> \u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432\u0441\u0435\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0421\u0438!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ff1\/7ef\/24a\/ff17ef24a38d4e263637e12bf06d1914.JPG\" width=\"1811\" height=\"506\"\/><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0435\u0442\u0435 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u043e  \u043f\u0438\u0448\u0438\u0442\u0435, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0438\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.  <\/p>\n<h3>\u0412\u044b\u0432\u043e\u0434<\/h3>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u044b \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 (\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430) \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u0435\u043a, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 double. \u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0442\u0438\u043f double, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u044d\u0442\u0438\u043c \u0436\u0435 \u043a\u043e\u0434\u043e\u043c \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0438 uint8_t int8_t int32_t, uint64_t, float. \u041e\u0434\u0438\u043d \u043f\u0430\u0440\u0441\u0435\u0440 double \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c<\/strong>!<\/p>\n<p>\u041f\u043e\u0442\u043e\u043c, \u043a\u043e\u0434\u0430 \u0412\u044b \u043f\u0438\u0448\u0438\u0442\u0435 \u0441\u0432\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 double \u0447\u0438\u0441\u0435\u043b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438, \u0442\u043e \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u043e\u0432 (p ,n, u, m, k, M, G \u0438 \u0442. \u043f.). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 &#171;100n&#187; \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a 100e-9 = 0.0000001. \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f scanf \u0412\u0430\u043c \u0442\u0430\u043a\u043e\u0435 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u0442.  <\/p>\n<h3>\u0421\u043b\u043e\u0432\u0430\u0440\u044c<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\"><strong>\u0410\u043a\u0440\u043e\u043d\u0438\u043c<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u0420\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">DFA  <\/p>\n<\/td>\n<td>\n<p align=\"left\">Deterministic finite automaton<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">CSV<\/p>\n<\/td>\n<td>\n<p align=\"left\">Comma-separated values<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">NMEA <\/p>\n<\/td>\n<td>\n<p align=\"left\">National Marine Electronics Association<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"125\" width=\"125\">\n<p align=\"left\">TDD<\/p>\n<\/td>\n<td>\n<p align=\"left\">Test-driven development<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p><strong>Links<\/strong><\/p>\n<p><a href=\"https:\/\/leetcode.com\/problems\/valid-number\/description\/\" rel=\"noopener noreferrer nofollow\">https:\/\/leetcode.com\/problems\/valid-number\/description\/<\/a><\/p>\n<p><a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1rbEw8p8CMHzM5DJUYGxDX-BCQ8sZsp4jDMRsbifJD9k\/edit#gid=0\" rel=\"noopener noreferrer nofollow\">https:\/\/docs.google.com\/spreadsheets\/d\/1rbEw8p8CMHzM5DJUYGxDX-BCQ8sZsp4jDMRsbifJD9k\/edit#gid=0<\/a><\/p>\n<p><a href=\"https:\/\/www.onlinegdb.com\/\" rel=\"noopener noreferrer nofollow\">https:\/\/www.onlinegdb.com\/<\/a><\/p>\n<p><strong>\u0412\u043e\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f<\/strong><\/p>\n<p>&#8212;\u0412\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 <strong>LeetCode<\/strong> \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0431\u044b \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 embedded \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445? <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/757122\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u0412\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u0435\u043a?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">72.06% <\/span><span class=\"tm-article-poll__answer-label\">\u0434\u0430<\/span><span class=\"tm-article-poll__answer-votes\">49<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 72.06%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">27.94% <\/span><span class=\"tm-article-poll__answer-label\">\u043d\u0435\u0442<\/span><span class=\"tm-article-poll__answer-votes\">19<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 27.94%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 68 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 7 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. <\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/757122\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u0412\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \u0441\u0430\u0439\u0442\u0430 LeetCode?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">37.14% <\/span><span class=\"tm-article-poll__answer-label\">\u0434\u0430<\/span><span class=\"tm-article-poll__answer-votes\">26<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 37.14%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">62.86% <\/span><span class=\"tm-article-poll__answer-label\">\u043d\u0435\u0442<\/span><span class=\"tm-article-poll__answer-votes\">44<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 62.86%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 70 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 2 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/div>\n<p> \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\/757122\/\"> https:\/\/habr.com\/ru\/articles\/757122\/<\/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<figure class=\"full-width\"><\/figure>\n<p>\u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 UART \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0443 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u043e\u0432, \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0445 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0439, \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0439 \u0438 \u043f\u0440\u043e\u0447\u0435\u0433\u043e. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. <\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0447\u0430\u0441\u0442\u043e \u043d\u0430\u0434\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043b\u043e\u0433\u0438 \u0441 SD-\u043a\u0430\u0440\u0442\u044b. \u041d\u0430\u0434\u043e \u0432\u044b\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 CSV \u0441\u0442\u0440\u043e\u0447\u0435\u043a. <\/p>\n<p>\u0415\u0449\u0435 \u044d\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 NMEA 0183 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0441\u0442\u044c \u0432\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a\u0430\u0445, \u0447\u0442\u043e\u0431\u044b \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0448\u0438\u0440\u043e\u0442\u0443 \u0438 \u0434\u043e\u043b\u0433\u043e\u0442\u0443.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u0435\u043d \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0439 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u0439 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u0435\u043a.<\/p>\n<h3>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>\u0414\u0430\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 (\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435) \u0447\u0438\u0441\u043b\u043e \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0415\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u0430 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u043e\u0439<\/p>\n<pre><code class=\"cpp\">bool try_str2real(const char* const text, double* const double_value);<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043b\u0435\u0433\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0444\u0430\u0432\u0438\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0435: &#8216; &#8216;, &#8216;+&#8217;, &#8216;-&#8216;, 0 1 2 3 4 5 6 7 8 9, &#8216;e&#8217;, &#8216;E&#8217; &#8216;.&#8217; &#8216;\\n&#8217; &#8216;\\r&#8217;<\/p>\n<p>\u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0435\u0441\u0442 \u043a\u0435\u0439\u0441\u043e\u0432:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\"><strong>\u2116<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\"><strong>\u0412\u0445\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430<\/strong><\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\"><strong>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>\u044d\u0442\u043e \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e?<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">1<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;.0&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">0.0<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;+.&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">3<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;005047e+6&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">5047000000<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">4<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;-8115e957&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">INF<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">5<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;2e0&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">2<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">6<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;4e+&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">7<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;.&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043d\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">8<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;12.5k&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">12500<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"50\" width=\"50\">\n<p align=\"left\">9<\/p>\n<\/td>\n<td data-colwidth=\"169\" width=\"169\">\n<p align=\"left\">&#171;100n&#187;<\/p>\n<\/td>\n<td data-colwidth=\"221\" width=\"221\">\n<p align=\"left\">0.0000001<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0434\u0430<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0447\u0438\u0441\u0435\u043b \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u044d\u0442\u043e \u0435\u0449\u0435 \u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u0431\u0435\u0437 Test-driven development (TDD) \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0440\u0435\u0430\u043b\u044c\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0435\u0441\u0442-\u043a\u0435\u0439\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1rbEw8p8CMHzM5DJUYGxDX-BCQ8sZsp4jDMRsbifJD9k\/edit#gid=0\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u0443\u0442<\/a>.<\/p>\n<p>\u041f\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0441\u0430\u0439\u0442 <a href=\"https:\/\/leetcode.com\/problems\/valid-number\/description\/\" rel=\"noopener noreferrer nofollow\">LeetCode \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u0443\u0440\u043e\u0432\u043d\u044f hard<\/a>. <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0425\u043e\u0442\u044f \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0443\u0442 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e. \u0412\u043e\u043e\u0431\u0449\u0435 \u044d\u0442\u043e \u0442\u043e\u0442 \u0440\u0435\u0434\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 LeetCode \u043c\u0435\u043b\u044c\u043a\u0430\u044e\u0442 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438\u0437 prod(\u0430).<\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h3>\n<p><strong>\u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e<\/strong>&#8212; \u044d\u0442\u043e \u043f\u043e \u0441\u0443\u0442\u0438 \u0447\u0438\u0441\u043b\u043e \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0445 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0432\u0435\u043b\u0438\u0447\u0438\u043d (\u043c\u0430\u0441\u0441\u0430, \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435, \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0447\u0435\u0435).<\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 <strong>sscanf<\/strong>() \u043d\u0435\u043d\u0430\u0434\u0435\u0436\u043d\u0430\u044f \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c. \u0424\u0443\u043d\u043a\u0446\u0438\u044f sscanf() \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 double \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0434\u0430 \u0435\u0449\u0451 \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c  \u0432\u044b\u0434\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0412\u043e\u0442 \u043e\u0442\u0447\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sscanf().<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0432 sscanf()<strong> <\/strong>\u043f\u043e\u0434\u0430\u0442\u044c \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e &#8216;\u0435&#8217;, \u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438 \u0432\u043e\u0432\u0441\u0435 \u0443\u043f\u0430\u0434\u0435\u0442 \u0432 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435!<\/p>\n<p>\u041d\u0443\u0436\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u043a\u0438. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c\u0441\u044f \u0441\u043e \u0441\u0445\u0435\u043c\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 (DFS). \u0412\u043e\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0440\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u044d\u0442\u0443 \u0441\u0445\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c 5 \u0438\u043b\u0438 6 \u0447\u0435\u0442\u043a\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">typedef enum{ PARSE_NUMBER_STATE_PARSE_SIGN=1, PARSE_NUMBER_STATE_PARSE_INTEGER=2, PARSE_NUMBER_STATE_PARSE_FRACTION=3, PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN=4, PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER=5, PARSE_NUMBER_STATE_DONE=6,  PARSE_NUMBER_STATE_UNDEF=0 }ParseNumberStates_t;<\/code><\/pre>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e-\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043d\u043e\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u043b\u043e\u0433\u0438\u0438. \u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u041e\u043d\u0430 \u043f\u0440\u043e\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438. <\/p>\n<pre><code class=\"cpp\"> typedef struct {     double value;     double mantissa;     double exponenta;     char cur_letter;     int8_t sign;     long double integer; \/*uint64_t integer *\/     uint32_t fraction_order;     double fraction ;     ParseNumberStates_t state;     bool spot_mantissa;     bool spot_exponent;     int8_t exponent_sign;     uint32_t exponent_integer; }Text2NumberFsm_t;  bool try_str2real(const char* const text, double* const double_value){     bool res = false;     uint32_t len = 0;     if(text){         len = strlen(text);         if(len){             if(double_value){                 res = true;             }         }     }      if(res) {         Text2NumberFsm_t Fsm;         res = text_2_number_init(&amp;Fsm);         uint32_t i = 0;         uint32_t ok = 0;         uint32_t err = 0;         LOG_DEBUG(STRING, \"ParseDoubleIn:%u:[%s]\", len, text);          for(i=0; i&lt;len; i++){             Fsm.cur_letter = text[i];             res = number_proc_one(&amp;Fsm);             if (res) {                 ok++;             } else {                 err++;                 LOG_ERROR(STRING,\"ProcErr: ch[%u]=%c \",i, text[i]);                 break;             }         }          if(0==err) {             Fsm.cur_letter ='\\n';             res = number_proc_one(&amp;Fsm);             if (res) {                 ok++;             } else {                 err++;             }         }         if (0==err) {             *double_value = Fsm.value;             res = true;         } else {             LOG_ERROR(STRING,\"len:%u ok:%u\",len, ok);             res = false;         }     }     return res; }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u0438\u043c\u0432\u043e\u043b\u0430. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430<\/p>\n<pre><code class=\"cpp\">static bool number_proc_one(Text2NumberFsm_t* Node){     bool res = false;     LOG_DEBUG(STRING, \"Proc: %s\",NumberParserFsm2Str(Node));     if(Node) {         switch (Node->state) {             case PARSE_NUMBER_STATE_PARSE_SIGN:                 res = number_proc_parse_sign(Node); break;             case PARSE_NUMBER_STATE_PARSE_INTEGER:                 res = number_proc_parse_integer(Node); break;             case PARSE_NUMBER_STATE_PARSE_FRACTION:                 res = number_proc_parse_fracion(Node); break;             case    PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN:                 res = number_proc_parse_exponenta_sign(Node); break;             case    PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER:                 res = number_proc_parse_exponenta_integer(Node); break;             case PARSE_NUMBER_STATE_DONE:                 res = number_proc_done(Node); break;          default: res = false; break;         }      }     return res; }<\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430.<\/p>\n<pre><code class=\"cpp\">static bool text_2_number_init(Text2NumberFsm_t* Node){     bool res = false;     if (Node) {         Node->value = 0.0;         Node->sign = 1;         Node->integer = 0;         Node->exponent_integer = 0;         Node->fraction = 0.0;         Node->fraction_order = 1;         Node->spot_mantissa = false;         Node->spot_exponent = false;         Node->mantissa = 1.0;         Node->exponent_sign = 1;         Node->exponenta = 1.0;         Node->cur_letter ='\\0';         Node->state = PARSE_NUMBER_STATE_PARSE_SIGN;         res = true;     }     return res; }<\/code><\/pre>\n<p>\u0410 \u044d\u0442\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0443\u043c\u0435\u0449\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0435<\/p>\n<pre><code class=\"cpp\">  bool  number_compose_result(Text2NumberFsm_t* Node){     bool res = false;     if(Node) {     if(Node->spot_mantissa) {             Node->value = ( (double)Node->sign ) * (((double) Node->integer) + Node->fraction);             LOG_DEBUG(STRING,\"Val:%f\",Node->value);             Node->state = PARSE_NUMBER_STATE_DONE;             res = true;         } else {             LOG_ERROR(STRING,\"NoMantissa\");     }     }     return res; }  static bool number_proc_parse_sign(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case 'E':     case 'e': {         Node->mantissa = 1.0;         Node->spot_mantissa = false;         Node->integer = 1;         Node->fraction = 0.0;         Node->state = PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN;         res = true;      }break;      case ' ': {         res = true;     }break;     case '+': {         Node->sign = 1;         Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;         res = true;     }break;     case '-': {         Node->sign =-1;         Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;         res = true;     }break;     case '0':  {         Node->sign =1;         Node->spot_mantissa=true;         Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;         res = true;     }break;     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9': {         uint8_t digit = 0;         Node->spot_mantissa = true;         res= try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         Node->integer *=10;         Node->integer += digit;          Node->state = PARSE_NUMBER_STATE_PARSE_INTEGER;     }break;     case '.': {     Node->fraction_order = 1;         Node->integer = 0;         Node->spot_mantissa = false;         Node->state = PARSE_NUMBER_STATE_PARSE_FRACTION;         res = true;     }break;     case '\\n':         res = false;         break;     case '\\r':         res = false;         break;     default:         res = false;         break;     }     return res; }  static bool number_mantissa_save(Text2NumberFsm_t* Node){     bool res = false;     if(Node) {         Node->mantissa = ( (double)Node->sign   ) * (((double) Node->integer) + Node->fraction);         LOG_DEBUG(STRING,\"Mantissa:%f\",Node->mantissa);         res = true;     }     return res; }  static bool number_proc_parse_integer(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case 'E':     case 'e': {         res = number_mantissa_save(Node);         Node->state =PARSE_NUMBER_STATE_PARSE_EXPONENTA_SIGN;     }break;     case ' ': {         res = false;     }break;     case '.':{     Node->fraction_order=1;         Node->state = PARSE_NUMBER_STATE_PARSE_FRACTION;         res = true;     } break;     case '0':     case '1':     case '2':     case '3':     case '4':     case '5':     case '6':     case '7':     case '8':     case '9': {         uint8_t digit = 0;         res= try_hex_char_to_u8((uint8_t) Node->cur_letter, &amp;digit) ;         LOG_PARN(STRING,\"ParseInt %u\", digit);         Node->integer *= 10;         Node->integer += digit;         Node->spot_mantissa = true;         res = true;     }break;      case '\\r':     case '\\n':{         res = number_compose_result(Node);     } break;       default:{         res = false;     } break;     }     return res; }   static bool number_proc_parse_exponenta_sign(Text2NumberFsm_t* Node){     bool res = false;     switch(Node->cur_letter) {     case '+': {         Node->exponent_sign = 1;         Node->state = PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;         res = true;     }break;      case '-': {         Node->exponent_sign = -1;         res = true;         Node->state= PARSE_NUMBER_STATE_PARSE_EXPONENTA_INTEGER;     }        break;     <\/code><\/pre>\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-353255","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353255","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=353255"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353255\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}