Boost C++ Libraries: Ticket #13583: quantities can be assigned from cmath sqrt result, but not initialized https://svn.boost.org/trac10/ticket/13583 <p> The cmath functions are very helpful in letting me perform math on quantities, but I ran across an inconsistency. Code like: </p> <pre class="wiki"> quantity&lt;wavenumber, float&gt; x, y; quantity&lt;wavenumber, float&gt; foo = sqrt(x*x + y*y); </pre><p> fails to compile (with an "error: conversion from..."). The workaround is to use an assignment instead: </p> <pre class="wiki"> quantity&lt;wavenumber, float&gt; foo; foo = sqrt(x*x + y*y); </pre><p> It seems odd to have this restriction (and it's certainly undocumented) so I suspect it is a bug. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13583 Trac 1.4.3 edaskel@… Wed, 30 May 2018 21:33:51 GMT attachment set https://svn.boost.org/trac10/ticket/13583 https://svn.boost.org/trac10/ticket/13583 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">repro.cpp</span> </li> </ul> <p> minimal test case </p> Ticket