{"id":31533,"date":"2021-02-04T21:27:59","date_gmt":"2021-02-05T02:27:59","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=31533"},"modified":"2021-02-05T08:12:58","modified_gmt":"2021-02-05T13:12:58","slug":"swiftdtoa-v2","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2021\/02\/04\/swiftdtoa-v2\/","title":{"rendered":"SwiftDtoa v2"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/apple\/swift\/pull\/35299\">tbkka<\/a> (via <a href=\"https:\/\/twitter.com\/stephentyrone\/status\/1356294792473436160\">Steve Canon<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/apple\/swift\/pull\/35299\"><p>SwiftDtoa is the C\/C++ code used in the Swift runtime to produce the textual representations used by the <code>description<\/code> and <code>debugDescription<\/code> properties of the standard Swift floating-point types. This update includes a number of algorithmic improvements to SwiftDtoa to improve portability, reduce code size, and improve performance but does not change the actual output.<\/p><p>[&#8230;]<\/p><p>Parsing the decimal form will yield exactly the same binary floating-point value again.<\/p><p>[&#8230;]<\/p><p>Among all accurate forms, this form has the fewest significant digits. <\/p><p>[&#8230;]<\/p><p>Algorithms that can produce this &ldquo;optimal&rdquo; output have been known since at least 1990, when Steele and White published their Dragon4 algorithm. However, Dragon4 and other algorithms from that period relied on high-precision integer arithmetic, which made them slow. More recently, a surge of interest in this problem has produced dramatically better algorithms that can produce the same results using only fast fixed-precision arithmetic.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>tbkka (via Steve Canon): SwiftDtoa is the C\/C++ code used in the Swift runtime to produce the textual representations used by the description and debugDescription properties of the standard Swift floating-point types. This update includes a number of algorithmic improvements to SwiftDtoa to improve portability, reduce code size, and improve performance but does not change [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2021-02-05T02:28:02Z","apple_news_api_id":"8fb4cd6a-b926-45ce-baee-98823296ba85","apple_news_api_modified_at":"2021-02-05T13:13:02Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/Aj7TNarkmRc667piCMpa6hQ","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[289,669,46,138,71],"class_list":["post-31533","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-algorithm","tag-floating-point","tag-languagedesign","tag-optimization","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=31533"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31533\/revisions"}],"predecessor-version":[{"id":31534,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/31533\/revisions\/31534"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=31533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=31533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=31533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}