prefixes.hpp 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Boost.Units - A C++ library for zero-overhead dimensional analysis and
  2. // unit/quantity manipulation and conversion
  3. //
  4. // Copyright (C) 2003-2008 Matthias Christian Schabel
  5. // Copyright (C) 2007-2008 Steven Watanabe
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See
  8. // accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #ifndef BOOST_UNITS_SI_PREFIXES_HPP
  11. #define BOOST_UNITS_SI_PREFIXES_HPP
  12. #include <boost/units/static_constant.hpp>
  13. #include <boost/units/make_scaled_unit.hpp>
  14. #include <boost/units/systems/si/dimensionless.hpp>
  15. namespace boost {
  16. namespace units {
  17. namespace si {
  18. #define BOOST_UNITS_METRIC_PREFIX(exponent, name) \
  19. typedef make_scaled_unit<dimensionless, scale<10, static_rational<exponent> > >::type name ## _type;\
  20. BOOST_UNITS_STATIC_CONSTANT(name, name ## _type)
  21. BOOST_UNITS_METRIC_PREFIX(-24, yocto);
  22. BOOST_UNITS_METRIC_PREFIX(-21, zepto);
  23. BOOST_UNITS_METRIC_PREFIX(-18, atto);
  24. BOOST_UNITS_METRIC_PREFIX(-15, femto);
  25. BOOST_UNITS_METRIC_PREFIX(-12, pico);
  26. BOOST_UNITS_METRIC_PREFIX(-9, nano);
  27. BOOST_UNITS_METRIC_PREFIX(-6, micro);
  28. BOOST_UNITS_METRIC_PREFIX(-3, milli);
  29. BOOST_UNITS_METRIC_PREFIX(-2, centi);
  30. BOOST_UNITS_METRIC_PREFIX(-1, deci);
  31. BOOST_UNITS_METRIC_PREFIX(1, deka);
  32. BOOST_UNITS_METRIC_PREFIX(2, hecto);
  33. BOOST_UNITS_METRIC_PREFIX(3, kilo);
  34. BOOST_UNITS_METRIC_PREFIX(6, mega);
  35. BOOST_UNITS_METRIC_PREFIX(9, giga);
  36. BOOST_UNITS_METRIC_PREFIX(12, tera);
  37. BOOST_UNITS_METRIC_PREFIX(15, peta);
  38. BOOST_UNITS_METRIC_PREFIX(18, exa);
  39. BOOST_UNITS_METRIC_PREFIX(21, zetta);
  40. BOOST_UNITS_METRIC_PREFIX(24, yotta);
  41. /*BOOST_UNITS_STATIC_CONSTANT(yocto,long double) = (1e-24); ///< metric prefix for 1.0e-24
  42. BOOST_UNITS_STATIC_CONSTANT(zepto,long double) = (1e-21); ///< metric prefix for 1.0e-21
  43. BOOST_UNITS_STATIC_CONSTANT(atto,long double) = (1e-18); ///< metric prefix for 1.0e-18
  44. BOOST_UNITS_STATIC_CONSTANT(femto,long double) = (1e-15); ///< metric prefix for 1.0e-15
  45. BOOST_UNITS_STATIC_CONSTANT(pico,long double) = (1e-12); ///< metric prefix for 1.0e-12
  46. BOOST_UNITS_STATIC_CONSTANT(nano,long double) = (1e-9); ///< metric prefix for 1.0e-9
  47. BOOST_UNITS_STATIC_CONSTANT(micro,long double) = (1e-6); ///< metric prefix for 1.0e-6
  48. BOOST_UNITS_STATIC_CONSTANT(milli,long double) = (1e-3); ///< metric prefix for 1.0e-3
  49. BOOST_UNITS_STATIC_CONSTANT(centi,long double) = (1e-2); ///< metric prefix for 1.0e-2
  50. BOOST_UNITS_STATIC_CONSTANT(deci,long double) = (1e-1); ///< metric prefix for 1.0e-1
  51. BOOST_UNITS_STATIC_CONSTANT(deka,long double) = (1e1); ///< metric prefix for 1.0e+1
  52. BOOST_UNITS_STATIC_CONSTANT(hecto,long double) = (1e2); ///< metric prefix for 1.0e+2
  53. BOOST_UNITS_STATIC_CONSTANT(kilo,long double) = (1e3); ///< metric prefix for 1.0e+3
  54. BOOST_UNITS_STATIC_CONSTANT(mega,long double) = (1e6); ///< metric prefix for 1.0e+6
  55. BOOST_UNITS_STATIC_CONSTANT(giga,long double) = (1e9); ///< metric prefix for 1.0e+9
  56. BOOST_UNITS_STATIC_CONSTANT(tera,long double) = (1e12); ///< metric prefix for 1.0e+12
  57. BOOST_UNITS_STATIC_CONSTANT(peta,long double) = (1e15); ///< metric prefix for 1.0e+15
  58. BOOST_UNITS_STATIC_CONSTANT(exa,long double) = (1e18); ///< metric prefix for 1.0e+18
  59. BOOST_UNITS_STATIC_CONSTANT(zetta,long double) = (1e21); ///< metric prefix for 1.0e+21
  60. BOOST_UNITS_STATIC_CONSTANT(yotta,long double) = (1e24); ///< metric prefix for 1.0e+24 */
  61. } // namespace si
  62. } // namespace units
  63. } // namespace boost
  64. #endif // BOOST_UNITS_SI_PREFIXES_HPP