You might want to take a look at the implementation of the CGS system - I believe centimeters are treated in the way you want... Matthais
In the following program, a quantity of fempto*second unit is printed as 0 fs (correctly) but a quantity of composed units composed meter over femptosecond is printed as P( m s^-1) I was expecting: m fs^-1
At first I though it was a bug, where the P is coming from? where the parenthesis is coming from?, but then I realized that P stands for Peta (10e15).
is there any workaround? For example an easy way to define fs_unit in some other way such that the f (fempto) keeps attached to the s (second).
Below is the example code
#include<boost/units/systems/si.hpp> #include<boost/units/make_scaled_unit.hpp> #include<iostream> using namespace boost::units; using namespace std; int main(){ typedef make_scaled_unit<si::time, scale<10, static_rational<-15> >
::type fs_unit; quantity<fs_unit> t(1.*si::second); quantity<si::length> l(1.*si::meter); quantity<divide_typeof_helper<si::length, fs_unit>::type > v = l/t; cout << t << endl; // prints 1e+15 fs cout << l << endl; // prints 1 m cout << v << endl; //prints 1e-15 P(m s^-1), notice the P return 0; }
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users