
9 Jan
2009
9 Jan
'09
7:16 p.m.
Thanks!
Why does the the following simple code output "605mi h^-1" instead of "605 mi/h"? Why is the "^-1" at the end?
#include <iostream> #include
#include #include using namespace boost::units; using namespace std;
typedef us::mile_base_unit::unit_type mile_unit; typedef metric::hour_base_unit::unit_type hour_unit; typedef divide_typeof_helper
::type miles_per_hour; int main() { quantity
mph = 605.0 * miles_per_hour(); cout << mph << endl; return 0; }
The output code does not give special status to exponents of -1, but just treats them consistently. If you want specialized output, see examples/composite_output.cpp for an example. Matthias