Ticket #3360: units-bug.cc

File units-bug.cc, 682 bytes (added by sergio.pasra@…, 13 years ago)

A program showing the bug

Line 
1
2#include <boost/units/systems/si/io.hpp>
3#include <boost/units/systems/si/prefixes.hpp>
4#include <boost/units/base_units/metric/year.hpp>
5
6
7using namespace boost::units;
8using namespace boost::units::si;
9
10using std::cout;
11using std::endl;
12
13
14int main()
15{
16 typedef metric::year_base_unit::unit_type year_type;
17 quantity<year_type> t1(7.90e16 * si::seconds);
18 cout << "Using years: " << t1 << endl;
19 typedef scaled_base_unit<metric::year_base_unit, scale<10, static_rational<9> > > gigayear_base_unit;
20 typedef gigayear_base_unit::unit_type gyr_type;
21 quantity<gyr_type> t2(7.90e16 * si::seconds);
22 cout << "Using Gigayears: " << t2 << endl;
23 return 0;
24}