// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /** \file \brief systems.cpp \details Test various non-si units Output: @verbatim @endverbatim **/ #define BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(namespace_,unit_name_,dimension_) \ namespace boost { \ namespace units { \ namespace namespace_ { \ typedef make_system::type unit_name_ ## system_; \ typedef unit unit_name_ ## _ ## dimension_; \ static constexpr unit_name_ ## _ ## dimension_ unit_name_ ## s; \ } \ } \ } \ #include #include #include #include #include #include #include #include // angle base units #include #include #include #include #include #include #include BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,arcminute,plane_angle) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,arcsecond,plane_angle) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,degree,plane_angle) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,gradian,plane_angle) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,radian,plane_angle) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,revolution,plane_angle) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(angle,steradian,solid_angle) // astronomical base units #include #include #include #include #include #include #include BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,astronomical_unit,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,light_second,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,light_minute,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,light_hour,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,light_day,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,light_year,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(astronomical,parsec,length) // imperial base units #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,thou,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,inch,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,foot,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,yard,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,furlong,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,mile,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,league,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,grain,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,drachm,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,ounce,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,pound,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,stone,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,quarter,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,hundredweight,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,ton,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,fluid_ounce,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,gill,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,pint,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,quart,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(imperial,gallon,volume) // metric base units #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,angstrom,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,fermi,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,micron,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,nautical_mile,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,ton,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,day,time) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,hour,time) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,minute,time) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,year,time) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,knot,velocity) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,are,area) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,barn,area) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,hectare,area) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,liter,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,atmosphere,pressure) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,bar,pressure) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,mmHg,pressure) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(metric,torr,pressure) // us base units #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,mil,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,inch,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,foot,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,yard,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,mile,length) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,grain,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,dram,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,ounce,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,pound,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,hundredweight,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,ton,mass) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,minim,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,fluid_dram,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,teaspoon,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,tablespoon,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,fluid_ounce,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,gill,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,cup,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,pint,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,quart,volume) BOOST_UNITS_DEFINE_SINGLE_UNIT_SYSTEM(us,gallon,volume) int main(void) { using namespace boost::units; { using namespace boost::units::angle; std::cout << "Testing angle base units..." << std::endl; quantity as(1.0*arcseconds); quantity am(1.0*arcminutes); quantity d(1.0*degrees); quantity g(1.0*gradians); quantity r(1.0*radians); quantity rev(1.0*revolutions); std::cout << as << " = " << quantity(as) << std::endl << am << " = " << quantity(am) << std::endl << d << " = " << quantity(d) << std::endl << g << " = " << quantity(g) << std::endl << r << " = " << quantity(r) << std::endl << rev << " = " << quantity(rev) << std::endl << std::endl; std::cout << rev << "/" << as << " = " << quantity(rev/as) << std::endl << rev << "/" << am << " = " << quantity(rev/am) << std::endl << rev << "/" << d << " = " << quantity(rev/d) << std::endl << rev << "/" << g << " = " << quantity(rev/g) << std::endl << rev << "/" << r << " = " << quantity(rev/r) << std::endl << std::endl; // conversions only work with exponent of +/- 1 in scaled_base_unit? std::cout << as << " = " << quantity(as) << std::endl << am << " = " << quantity(am) << std::endl << d << " = " << quantity(d) << std::endl << rev << " = " << quantity(rev) << std::endl << std::endl; // conversions only work with exponent of +/- 1 in scaled_base_unit? see arcsecond.hpp std::cout << as << " = " << quantity(as) << std::endl << am << " = " << quantity(am) << std::endl << d << " = " << quantity(d) << std::endl << rev << " = " << quantity(rev) << std::endl << std::endl; std::cout << as << " = " << quantity(as) << std::endl << am << " = " << quantity(am) << std::endl << d << " = " << quantity(d) << std::endl << rev << " = " << quantity(rev) << std::endl << std::endl; std::cout << as << " = " << quantity(as) << std::endl << am << " = " << quantity(am) << std::endl << d << " = " << quantity(d) << std::endl << rev << " = " << quantity(rev) << std::endl << std::endl; quantity sa1(1.0*steradians); std::cout << sa1 << std::endl << std::endl; } { using namespace boost::units::astronomical; std::cout << "Testing astronomical base units..." << std::endl; quantity ls(1.0*light_seconds); quantity lm(1.0*light_minutes); quantity au(1.0*astronomical_units); quantity lh(1.0*light_hours); quantity ld(1.0*light_days); quantity ly(1.0*light_years); quantity ps(1.0*parsecs); std::cout << ls << " = " << quantity(ls) << std::endl << lm << " = " << quantity(lm) << std::endl << au << " = " << quantity(au) << std::endl << lh << " = " << quantity(lh) << std::endl << ld << " = " << quantity(ld) << std::endl << ly << " = " << quantity(ly) << std::endl << ps << " = " << quantity(ps) << std::endl << std::endl; std::cout << ly << "/" << ls << " = " << quantity(ly/ls) << std::endl << ly << "/" << lm << " = " << quantity(ly/lm) << std::endl << ly << "/" << au << " = " << quantity(ly/au) << std::endl << ly << "/" << lh << " = " << quantity(ly/ld) << std::endl << ly << "/" << ld << " = " << quantity(ly/lh) << std::endl << ly << "/" << ps << " = " << quantity(ly/ps) << std::endl << std::endl; std::cout << ls << " = " << quantity(ls) << std::endl << lm << " = " << quantity(lm) << std::endl << lh << " = " << quantity(lh) << std::endl << ld << " = " << quantity(ld) << std::endl << ly << " = " << quantity(ly) << std::endl << std::endl; std::cout << ls << " = " << quantity(ls) << std::endl << lm << " = " << quantity(lm) << std::endl << lh << " = " << quantity(lh) << std::endl << ld << " = " << quantity(ld) << std::endl << ly << " = " << quantity(ly) << std::endl << std::endl; std::cout << ls << " = " << quantity(ls) << std::endl << lm << " = " << quantity(lm) << std::endl << lh << " = " << quantity(lh) << std::endl << ld << " = " << quantity(ld) << std::endl << ly << " = " << quantity(ly) << std::endl << std::endl; std::cout << ls << " = " << quantity(ls) << std::endl << lm << " = " << quantity(lm) << std::endl << lh << " = " << quantity(lh) << std::endl << ld << " = " << quantity(ld) << std::endl << ly << " = " << quantity(ly) << std::endl << std::endl; std::cout << ls << " = " << quantity(ls) << std::endl << lm << " = " << quantity(lm) << std::endl << lh << " = " << quantity(ld) << std::endl << ld << " = " << quantity(lh) << std::endl << ly << " = " << quantity(ly) << std::endl << std::endl; } { using namespace boost::units::imperial; std::cout << "Testing imperial base units..." << std::endl; quantity iml1(1.0*thous); quantity iml2(1.0*inchs); quantity iml3(1.0*foots); quantity iml4(1.0*yards); quantity iml5(1.0*furlongs); quantity iml6(1.0*miles); quantity iml7(1.0*leagues); std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml7 << "/" << iml1 << " = " << quantity(iml7/iml1) << std::endl << iml7 << "/" << iml2 << " = " << quantity(iml7/iml2) << std::endl << iml7 << "/" << iml3 << " = " << quantity(iml7/iml3) << std::endl << iml7 << "/" << iml4 << " = " << quantity(iml7/iml4) << std::endl << iml7 << "/" << iml5 << " = " << quantity(iml7/iml5) << std::endl << iml7 << "/" << iml6 << " = " << quantity(iml7/iml6) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << iml6 << " = " << quantity(iml6) << std::endl << iml7 << " = " << quantity(iml7) << std::endl << std::endl; quantity imm1(1.0*grains); quantity imm2(1.0*drachms); quantity imm3(1.0*ounces); quantity imm4(1.0*pounds); quantity imm5(1.0*stones); quantity imm6(1.0*quarters); quantity imm7(1.0*hundredweights); quantity imm8(1.0*tons); std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm8 << "/" << imm1 << " = " << quantity(imm8/imm1) << std::endl << imm8 << "/" << imm2 << " = " << quantity(imm8/imm2) << std::endl << imm8 << "/" << imm3 << " = " << quantity(imm8/imm3) << std::endl << imm8 << "/" << imm4 << " = " << quantity(imm8/imm4) << std::endl << imm8 << "/" << imm5 << " = " << quantity(imm8/imm5) << std::endl << imm8 << "/" << imm6 << " = " << quantity(imm8/imm6) << std::endl << imm8 << "/" << imm7 << " = " << quantity(imm8/imm7) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << imm7 << " = " << quantity(imm7) << std::endl << imm8 << " = " << quantity(imm8) << std::endl << std::endl; quantity imv1(1.0*fluid_ounces); quantity imv2(1.0*gills); quantity imv3(1.0*pints); quantity imv4(1.0*quarts); quantity imv5(1.0*gallons); std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << std::endl; std::cout << imv5 << "/" << imv1 << " = " << quantity(imv5/imv1) << std::endl << imv5 << "/" << imv2 << " = " << quantity(imv5/imv2) << std::endl << imv5 << "/" << imv3 << " = " << quantity(imv5/imv3) << std::endl << imv5 << "/" << imv4 << " = " << quantity(imv5/imv4) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << std::endl; } { using namespace boost::units::metric; std::cout << "Testing metric base units..." << std::endl; quantity ml1(1.0*fermis); quantity ml2(1.0*angstroms); quantity ml3(1.0*microns); quantity ml4(1.0*nautical_miles); std::cout << ml1 << " = " << quantity(ml1) << std::endl << ml2 << " = " << quantity(ml2) << std::endl << ml3 << " = " << quantity(ml3) << std::endl << ml4 << " = " << quantity(ml4) << std::endl << std::endl; std::cout << ml4 << "/" << ml1 << " = " << quantity(ml4/ml1) << std::endl << ml4 << "/" << ml2 << " = " << quantity(ml4/ml2) << std::endl << ml4 << "/" << ml3 << " = " << quantity(ml4/ml3) << std::endl << std::endl; std::cout << ml1 << " = " << quantity(ml1) << std::endl << ml2 << " = " << quantity(ml2) << std::endl << ml3 << " = " << quantity(ml3) << std::endl << ml4 << " = " << quantity(ml4) << std::endl << std::endl; std::cout << ml1 << " = " << quantity(ml1) << std::endl << ml2 << " = " << quantity(ml2) << std::endl << ml3 << " = " << quantity(ml3) << std::endl << ml4 << " = " << quantity(ml4) << std::endl << std::endl; std::cout << ml1 << " = " << quantity(ml1) << std::endl << ml2 << " = " << quantity(ml2) << std::endl << ml3 << " = " << quantity(ml3) << std::endl << ml4 << " = " << quantity(ml4) << std::endl << std::endl; std::cout << ml1 << " = " << quantity(ml1) << std::endl << ml2 << " = " << quantity(ml2) << std::endl << ml3 << " = " << quantity(ml3) << std::endl << ml4 << " = " << quantity(ml4) << std::endl << std::endl; quantity mm1(1.0*tons); std::cout << mm1 << " = " << quantity(mm1) << std::endl //<< quantity(mm1) << std::endl // this should work... << std::endl; quantity mt1(1.0*minutes); quantity mt2(1.0*hours); quantity mt3(1.0*days); quantity mt4(1.0*years); std::cout << mt1 << " = " << quantity(mt1) << std::endl << mt2 << " = " << quantity(mt2) << std::endl << mt3 << " = " << quantity(mt3) << std::endl << mt4 << " = " << quantity(mt4) << std::endl << std::endl; std::cout << mt4 << "/" << mt1 << " = " << quantity(mt4/mt1) << std::endl << mt4 << "/" << mt2 << " = " << quantity(mt4/mt2) << std::endl << mt4 << "/" << mt3 << " = " << quantity(mt4/mt3) << std::endl << std::endl; std::cout << mt1 << " = " << quantity(mt1) << std::endl << mt2 << " = " << quantity(mt2) << std::endl << mt3 << " = " << quantity(mt3) << std::endl << mt4 << " = " << quantity(mt4) << std::endl << std::endl; std::cout << mt1 << " = " << quantity(mt1) << std::endl << mt2 << " = " << quantity(mt2) << std::endl << mt3 << " = " << quantity(mt3) << std::endl << mt4 << " = " << quantity(mt4) << std::endl << std::endl; std::cout << mt1 << " = " << quantity(mt1) << std::endl << mt2 << " = " << quantity(mt2) << std::endl << mt3 << " = " << quantity(mt3) << std::endl << mt4 << " = " << quantity(mt4) << std::endl << std::endl; std::cout << mt1 << " = " << quantity(mt1) << std::endl << mt2 << " = " << quantity(mt2) << std::endl << mt3 << " = " << quantity(mt3) << std::endl << mt4 << " = " << quantity(mt4) << std::endl << std::endl; quantity ms1(1.0*knots); std::cout << ms1 << " = " << quantity(ms1) << std::endl << std::endl; quantity ma1(1.0*barns); quantity ma2(1.0*ares); quantity ma3(1.0*hectares); std::cout << ma1 << " = " << quantity(ma1) << std::endl << ma2 << " = " << quantity(ma2) << std::endl << ma3 << " = " << quantity(ma3) << std::endl << std::endl; std::cout << ma3 << "/" << ma1 << " = " << quantity(ma3/ma1) << std::endl << ma3 << "/" << ma2 << " = " << quantity(ma3/ma2) << std::endl << std::endl; std::cout << ma1 << " = " << quantity(ma1) << std::endl << ma2 << " = " << quantity(ma2) << std::endl << ma3 << " = " << quantity(ma3) << std::endl << std::endl; std::cout << ma1 << " = " << quantity(ma1) << std::endl << ma2 << " = " << quantity(ma2) << std::endl << ma3 << " = " << quantity(ma3) << std::endl << std::endl; std::cout << ma1 << " = " << quantity(ma1) << std::endl << ma2 << " = " << quantity(ma2) << std::endl << ma3 << " = " << quantity(ma3) << std::endl << std::endl; quantity mv1(1.0*liters); std::cout << mv1 << " = " << quantity(mv1) << std::endl << std::endl; quantity mp1(1.0*mmHgs); quantity mp2(1.0*torrs); quantity mp3(1.0*bars); quantity mp4(1.0*atmospheres); std::cout << mp1 << " = " << quantity(mp1) << std::endl << mp2 << " = " << quantity(mp2) << std::endl << mp3 << " = " << quantity(mp3) << std::endl << mp4 << " = " << quantity(mp4) << std::endl << std::endl; std::cout << mp4 << "/" << mp1 << " = " << quantity(mp4/mp1) << std::endl << mp4 << "/" << mp2 << " = " << quantity(mp4/mp2) << std::endl << mp4 << "/" << mp3 << " = " << quantity(mp4/mp3) << std::endl << std::endl; std::cout << mp1 << " = " << quantity(mp1) << std::endl << mp2 << " = " << quantity(mp2) << std::endl << mp3 << " = " << quantity(mp3) << std::endl << mp4 << " = " << quantity(mp4) << std::endl << std::endl; std::cout << mp1 << " = " << quantity(mp1) << std::endl << mp2 << " = " << quantity(mp2) << std::endl << mp3 << " = " << quantity(mp3) << std::endl << mp4 << " = " << quantity(mp4) << std::endl << std::endl; std::cout << mp1 << " = " << quantity(mp1) << std::endl << mp2 << " = " << quantity(mp2) << std::endl << mp3 << " = " << quantity(mp3) << std::endl << mp4 << " = " << quantity(mp4) << std::endl << std::endl; std::cout << mp1 << " = " << quantity(mp1) << std::endl << mp2 << " = " << quantity(mp2) << std::endl << mp3 << " = " << quantity(mp3) << std::endl << mp4 << " = " << quantity(mp4) << std::endl << std::endl; } { using namespace boost::units::us; std::cout << "Testing U.S. customary base units..." << std::endl; quantity iml1(1.0*mils); quantity iml2(1.0*inchs); quantity iml3(1.0*foots); quantity iml4(1.0*yards); quantity iml5(1.0*miles); std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << std::endl; std::cout << iml5 << "/" << iml1 << " = " << quantity(iml5/iml1) << std::endl << iml5 << "/" << iml2 << " = " << quantity(iml5/iml2) << std::endl << iml5 << "/" << iml3 << " = " << quantity(iml5/iml3) << std::endl << iml5 << "/" << iml4 << " = " << quantity(iml5/iml4) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << std::endl; std::cout << iml1 << " = " << quantity(iml1) << std::endl << iml2 << " = " << quantity(iml2) << std::endl << iml3 << " = " << quantity(iml3) << std::endl << iml4 << " = " << quantity(iml4) << std::endl << iml5 << " = " << quantity(iml5) << std::endl << std::endl; quantity imm1(1.0*grains); quantity imm2(1.0*drams); quantity imm3(1.0*ounces); quantity imm4(1.0*pounds); quantity imm5(1.0*hundredweights); quantity imm6(1.0*tons); std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; std::cout << imm6 << "/" << imm1 << " = " << quantity(imm6/imm1) << std::endl << imm6 << "/" << imm2 << " = " << quantity(imm6/imm2) << std::endl << imm6 << "/" << imm3 << " = " << quantity(imm6/imm3) << std::endl << imm6 << "/" << imm4 << " = " << quantity(imm6/imm4) << std::endl << imm6 << "/" << imm5 << " = " << quantity(imm6/imm5) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; std::cout << imm1 << " = " << quantity(imm1) << std::endl << imm2 << " = " << quantity(imm2) << std::endl << imm3 << " = " << quantity(imm3) << std::endl << imm4 << " = " << quantity(imm4) << std::endl << imm5 << " = " << quantity(imm5) << std::endl << imm6 << " = " << quantity(imm6) << std::endl << std::endl; quantity imv1(1.0*minims); quantity imv2(1.0*fluid_drams); quantity imv3(1.0*teaspoons); quantity imv4(1.0*tablespoons); quantity imv5(1.0*fluid_ounces); quantity imv6(1.0*gills); quantity imv7(1.0*cups); quantity imv8(1.0*pints); quantity imv9(1.0*quarts); quantity imv10(1.0*gallons); std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv10 << "/" << imv1 << " = " << quantity(imv10/imv1) << std::endl << imv10 << "/" << imv2 << " = " << quantity(imv10/imv2) << std::endl << imv10 << "/" << imv3 << " = " << quantity(imv10/imv3) << std::endl << imv10 << "/" << imv4 << " = " << quantity(imv10/imv4) << std::endl << imv10 << "/" << imv5 << " = " << quantity(imv10/imv5) << std::endl << imv10 << "/" << imv6 << " = " << quantity(imv10/imv6) << std::endl << imv10 << "/" << imv7 << " = " << quantity(imv10/imv7) << std::endl << imv10 << "/" << imv8 << " = " << quantity(imv10/imv8) << std::endl << imv10 << "/" << imv9 << " = " << quantity(imv10/imv9) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; std::cout << imv1 << " = " << quantity(imv1) << std::endl << imv2 << " = " << quantity(imv2) << std::endl << imv3 << " = " << quantity(imv3) << std::endl << imv4 << " = " << quantity(imv4) << std::endl << imv5 << " = " << quantity(imv5) << std::endl << imv6 << " = " << quantity(imv6) << std::endl << imv7 << " = " << quantity(imv7) << std::endl << imv8 << " = " << quantity(imv8) << std::endl << imv9 << " = " << quantity(imv9) << std::endl << imv10 << " = " << quantity(imv10) << std::endl << std::endl; } return 0; }