Boost C++ Libraries: Ticket #11554: lexical_cast<string>(124.4) https://svn.boost.org/trac10/ticket/11554 <p> #include &lt;string&gt; #include &lt;iostream&gt; </p> <p> using std::cout; using std::endl; using std::string; </p> <p> int _tmain(int argc, _TCHAR* argv[]) { </p> <blockquote> <p> using boost::lexical_cast; </p> </blockquote> <blockquote> <p> string out = lexical_cast&lt;string&gt;(124.4); cout &lt;&lt; "out = " &lt;&lt; out &lt;&lt; endl; system("pause"); </p> </blockquote> <blockquote> <p> return 0; </p> </blockquote> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11554 Trac 1.4.3 John Maddock Tue, 18 Aug 2015 16:10:40 GMT component changed; owner set https://svn.boost.org/trac10/ticket/11554#comment:1 https://svn.boost.org/trac10/ticket/11554#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Antony Polukhin</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">lexical_cast</span> </li> </ul> Ticket John Maddock Tue, 18 Aug 2015 16:11:31 GMT <link>https://svn.boost.org/trac10/ticket/11554#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11554#comment:2</guid> <description> <p> What's the bug? </p> <p> You're aware that 124.4 has no exact binary representation and so you will not get "124.4" printed out? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Antony Polukhin</dc:creator> <pubDate>Fri, 25 Sep 2015 16:53:55 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11554#comment:3 https://svn.boost.org/trac10/ticket/11554#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> Floating point types have no exact representation. See <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5796" title="#5796: Bugs: Casting from float to string using &#34;lexical_cast&lt;string&gt;&#34; gives ... (closed: wontfix)">#5796</a> for more details and in-depth description. </p> Ticket