Boost C++ Libraries: Ticket #11389: Bug: Unit precision is restricted to double when using conversion constants https://svn.boost.org/trac10/ticket/11389 <p> From BOOST_UNITS_DEFINE_BASE_UNIT_WITH_CONVERSIONS in boost/units/conversions.hpp: </p> <pre class="wiki">BOOST_UNITS_DEFINE_CONVERSION_FACTOR(namespace_::name_ ## _base_unit, unit, double, factor); \ </pre><p> Note the type of the conversion factor value is forced unconditionally to be double. </p> <p> It would be nice if the precision of this constant could be either made more flexible, or made as precise as possible with rounding to a lower-precision constant when lower-precision types are used. For example, using long double would allow higher-precision constants and conversions, but this isn't possible at present since even if a quantity&lt;T, long double&gt; is used, the conversions are still being restricted to double precision. </p> <p> Kind regards, Roger </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11389 Trac 1.4.3 Roger Leigh <rleigh@…> Wed, 10 Jun 2015 15:47:21 GMT <link>https://svn.boost.org/trac10/ticket/11389#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11389#comment:1</guid> <description> <p> One thought here would be to define the conversion constants in the same way as the math constants, giving the user separate float, double and long double values (or equivalents via the templates). This would then let the quantity template value type be used to select the constant of the appropriate precision during conversions. </p> </description> <category>Ticket</category> </item> </channel> </rss>