Boost C++ Libraries: Ticket #10244: Erroneous conversion from double to boost::rational<int> https://svn.boost.org/trac10/ticket/10244 <p> The documentation discusses in detail why conversion from double is not supported, but the following code works fine: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/rational.hpp&gt; int main() { double d = 31.82; boost::rational&lt;int&gt; r = d; std::cout &lt;&lt; r &lt;&lt; std::endl; } </pre><p> With the following result "31/1". It just discards the fractional part. A double is implicitly converted to int and then the implicit constructor from int is used. </p> <p> Such conversion is really confusing. Make it explicitly declared as deleted. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10244 Trac 1.4.3