Boost logo

Boost-Commit :

From: boost_at_[hidden]
Date: 2008-05-19 15:58:46


Author: matthiasschabel
Date: 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
New Revision: 45559
URL: http://svn.boost.org/trac/boost/changeset/45559

Log:
add old pre-Boost.Math cmath headers to support previous versions of Boost (BOOST_VERSION <= 103500)
Added:
   sandbox/units/boost/units/detail/cmath_boost_1_35.hpp (contents, props changed)
   sandbox/units/boost/units/detail/cmath_gnu_impl_boost_1_35.hpp (contents, props changed)
   sandbox/units/boost/units/detail/cmath_msvc_impl_boost_1_35.hpp (contents, props changed)
   sandbox/units/boost/units/detail/cmath_mwcw_impl_boost_1_35.hpp (contents, props changed)
Text files modified:
   sandbox/units/boost/units/cmath.hpp | 8 ++++++++
   sandbox/units/boost/units/detail/cmath_impl.hpp | 14 +++++++++++---
   2 files changed, 19 insertions(+), 3 deletions(-)

Modified: sandbox/units/boost/units/cmath.hpp
==============================================================================
--- sandbox/units/boost/units/cmath.hpp (original)
+++ sandbox/units/boost/units/cmath.hpp 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
@@ -11,6 +11,12 @@
 #ifndef BOOST_UNITS_CMATH_HPP
 #define BOOST_UNITS_CMATH_HPP
 
+#include <boost/version.hpp>
+
+#if (BOOST_VERSION <= 103500)
+ #include <boost/units/detail/cmath_boost_1_35.hpp>
+#else
+
 #include <cmath>
 #include <cstdlib>
 
@@ -629,4 +635,6 @@
 
 } // namespace boost
 
+#endif // (BOOST_VERSION <= 103500)
+
 #endif // BOOST_UNITS_CMATH_HPP

Added: sandbox/units/boost/units/detail/cmath_boost_1_35.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/detail/cmath_boost_1_35.hpp 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
@@ -0,0 +1,627 @@
+// 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)
+
+#ifndef BOOST_UNITS_CMATH_BOOST_1_35_HPP
+#define BOOST_UNITS_CMATH_BOOST_1_35_HPP
+
+#include <cmath>
+#include <cstdlib>
+
+#include <boost/units/dimensionless_quantity.hpp>
+#include <boost/units/pow.hpp>
+#include <boost/units/quantity.hpp>
+#include <boost/units/detail/cmath_impl.hpp>
+
+#include <boost/units/systems/si/plane_angle.hpp>
+
+/// \file
+/// \brief Overloads of functions in \<cmath\> for quantities
+///
+/// \detailed Only functions for which a dimensionally-correct result type
+/// can be determined are overloaded. All functions work with dimensionless
+/// quantities.
+
+// BOOST_PREVENT_MACRO_SUBSTITUTION is needed on certain compilers that define
+// some <cmath> functions as macros; it is used for all functions even though it
+// isn't necessary -- I didn't want to think :)
+//
+// the form using namespace detail; return(f(x)); is used
+// to enable ADL for UDTs
+
+namespace boost {
+
+namespace units {
+
+template<class Unit,class Y>
+inline
+bool
+isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+ return isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isinf BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+ return isinf BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isnan BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+ return isnan BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+ return isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+ return isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+ return isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isless BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+ return isless BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+ return islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+ return islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
+}
+
+template<class Unit,class Y>
+inline
+bool
+isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+ return isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value());
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+abs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(abs BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+ceil BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(ceil BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+copysign BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(copysign BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+fabs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(fabs BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+floor BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(floor BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+fdim BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(fdim BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+template<class Unit1,class Unit2,class Unit3,class Y>
+inline
+typename add_typeof_helper<
+ typename multiply_typeof_helper<quantity<Unit1,Y>,
+ quantity<Unit2,Y> >::type,
+ quantity<Unit3,Y> >::type
+fma BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit1,Y>& q1,
+ const quantity<Unit2,Y>& q2,
+ const quantity<Unit3,Y>& q3)
+{
+ using namespace detail;
+
+ typedef quantity<Unit1,Y> type1;
+ typedef quantity<Unit2,Y> type2;
+ typedef quantity<Unit3,Y> type3;
+
+ typedef typename multiply_typeof_helper<type1,type2>::type prod_type;
+ typedef typename add_typeof_helper<prod_type,type3>::type quantity_type;
+
+ return quantity_type::from_value(fma BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value(),q3.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+fmax BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(fmax BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+fmin BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(fmin BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+template<class Unit,class Y>
+inline
+int
+fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ return fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
+}
+
+template<class Unit,class Y>
+inline
+typename root_typeof_helper<
+ typename add_typeof_helper<
+ typename power_typeof_helper<quantity<Unit,Y>,
+ static_rational<2> >::type,
+ typename power_typeof_helper<quantity<Unit,Y>,
+ static_rational<2> >::type>::type,
+ static_rational<2> >::type
+hypot BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,const quantity<Unit,Y>& q2)
+{
+ using ::hypot;
+
+ typedef quantity<Unit,Y> type1;
+
+ typedef typename power_typeof_helper<type1,static_rational<2> >::type pow_type;
+ typedef typename add_typeof_helper<pow_type,pow_type>::type add_type;
+ typedef typename root_typeof_helper<add_type,static_rational<2> >::type quantity_type;
+
+ return quantity_type::from_value(hypot BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+// does ISO C++ support long long? g++ claims not
+//template<class Unit,class Y>
+//inline
+//quantity<Unit,long long>
+//llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+//{
+// using namespace detail;
+//
+// typedef quantity<Unit,long long> quantity_type;
+//
+// return quantity_type::from_value(llrint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+//}
+
+// does ISO C++ support long long? g++ claims not
+//template<class Unit,class Y>
+//inline
+//quantity<Unit,long long>
+//llround BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+//{
+// using namespace detail;
+//
+// typedef quantity<Unit,long long> quantity_type;
+//
+// return quantity_type::from_value(llround BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+//}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y> nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y> nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
+ const quantity<Unit,Y>& q2)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (q1.value(),q2.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+rint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(rint BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+round BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(round BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+bool
+signbit BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ return signbit BOOST_PREVENT_MACRO_SUBSTITUTION (q.value());
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit,Y>
+trunc BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
+{
+ using namespace detail;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(trunc BOOST_PREVENT_MACRO_SUBSTITUTION (q.value()));
+}
+
+template<class Unit,class Y>
+inline
+quantity<Unit, Y>
+fmod(const quantity<Unit,Y>& q1, const quantity<Unit,Y>& q2)
+{
+ using std::fmod;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(fmod(q1.value(), q2.value()));
+}
+
+template<class Unit, class Y>
+inline
+quantity<Unit, Y>
+modf(const quantity<Unit, Y>& q1, quantity<Unit, Y>* q2)
+{
+ using std::modf;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(modf(q1.value(), &quantity_cast<Y&>(*q2)));
+}
+
+template<class Unit, class Y, class Int>
+inline
+quantity<Unit, Y>
+frexp(const quantity<Unit, Y>& q,Int* ex)
+{
+ using std::frexp;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(frexp(q.value(),ex));
+}
+
+/// For non-dimensionless quantities, integral and rational powers
+/// and roots can be computed by @c pow<Ex> and @c root<Rt> respectively.
+template<class S, class Y>
+inline
+quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
+pow(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q1,
+ const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q2)
+{
+ using std::pow;
+
+ typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S),Y> quantity_type;
+
+ return quantity_type::from_value(pow(q1.value(), q2.value()));
+}
+
+template<class S, class Y>
+inline
+quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
+exp(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
+{
+ using std::exp;
+
+ typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;
+
+ return quantity_type::from_value(exp(q.value()));
+}
+
+template<class Unit, class Y, class Int>
+inline
+quantity<Unit, Y>
+ldexp(const quantity<Unit, Y>& q,const Int& ex)
+{
+ using std::ldexp;
+
+ typedef quantity<Unit,Y> quantity_type;
+
+ return quantity_type::from_value(ldexp(q.value(), ex));
+}
+
+template<class S, class Y>
+inline
+quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
+log(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
+{
+ using std::log;
+
+ typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;
+
+ return quantity_type::from_value(log(q.value()));
+}
+
+template<class S, class Y>
+inline
+quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
+log10(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
+{
+ using std::log10;
+
+ typedef quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y> quantity_type;
+
+ return quantity_type::from_value(log10(q.value()));
+}
+
+template<class Unit,class Y>
+inline
+typename root_typeof_helper<
+ quantity<Unit,Y>,
+ static_rational<2>
+ >::type
+sqrt(const quantity<Unit,Y>& q)
+{
+ using std::sqrt;
+
+ typedef typename root_typeof_helper<
+ quantity<Unit,Y>,
+ static_rational<2>
+ >::type quantity_type;
+
+ return quantity_type::from_value(sqrt(q.value()));
+}
+
+// trig functions with si argument/return types
+
+/// cos of theta in radians
+template<class Y>
+typename dimensionless_quantity<si::system,Y>::type
+cos(const quantity<si::plane_angle,Y>& theta)
+{
+ return std::cos(theta.value());
+}
+
+/// sin of theta in radians
+template<class Y>
+typename dimensionless_quantity<si::system,Y>::type
+sin(const quantity<si::plane_angle,Y>& theta)
+{
+ return std::sin(theta.value());
+}
+
+/// tan of theta in radians
+template<class Y>
+typename dimensionless_quantity<si::system,Y>::type
+tan(const quantity<si::plane_angle,Y>& theta)
+{
+ return std::tan(theta.value());
+}
+
+/// cos of theta in other angular units
+template<class System,class Y>
+typename dimensionless_quantity<System,Y>::type
+cos(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
+{
+ return cos(quantity<si::plane_angle,Y>(theta));
+}
+
+/// sin of theta in other angular units
+template<class System,class Y>
+typename dimensionless_quantity<System,Y>::type
+sin(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
+{
+ return sin(quantity<si::plane_angle,Y>(theta));
+}
+
+/// tan of theta in other angular units
+template<class System,class Y>
+typename dimensionless_quantity<System,Y>::type
+tan(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
+{
+ return tan(quantity<si::plane_angle,Y>(theta));
+}
+
+/// acos of @c value_type returning angle in radians
+template<class Y>
+quantity<si::plane_angle,Y>
+acos(const Y& val)
+{
+ return quantity<si::plane_angle,Y>(std::acos(val)*si::radians);
+}
+
+/// acos of dimensionless quantity returning angle in same system
+template<class Y,class System>
+quantity<unit<plane_angle_dimension,System>,Y>
+acos(const quantity<unit<dimensionless_type,System>,Y>& val)
+{
+ return quantity<unit<plane_angle_dimension,System>,Y>(std::acos(val)*si::radians);
+}
+
+/// asin of @c value_type returning angle in radians
+template<class Y>
+quantity<si::plane_angle,Y>
+asin(const Y& val)
+{
+ return quantity<si::plane_angle,Y>(std::asin(val)*si::radians);
+}
+
+/// asin of dimensionless quantity returning angle in same system
+template<class Y,class System>
+quantity<unit<plane_angle_dimension,System>,Y>
+asin(const quantity<unit<dimensionless_type,System>,Y>& val)
+{
+ return quantity<unit<plane_angle_dimension,System>,Y>(std::asin(val)*si::radians);
+}
+
+/// atan of @c value_type returning angle in radians
+template<class Y>
+quantity<si::plane_angle,Y>
+atan(const Y& val)
+{
+ return quantity<si::plane_angle,Y>(std::atan(val)*si::radians);
+}
+
+/// atan of dimensionless quantity returning angle in same system
+template<class Y,class System>
+quantity<unit<plane_angle_dimension,System>,Y>
+atan(const quantity<unit<dimensionless_type,System>,Y>& val)
+{
+ return quantity<unit<plane_angle_dimension,System>,Y>(std::atan(val)*si::radians);
+}
+
+/// atan2 of @c value_type returning angle in radians
+template<class Y>
+quantity<si::plane_angle,Y>
+atan2(const Y& y,const Y& x)
+{
+ return quantity<si::plane_angle,Y>(std::atan2(y,x)*si::radians);
+}
+
+} // namespace units
+
+} // namespace boost
+
+#endif // BOOST_UNITS_CMATH_BOOST_1_35_HPP

Added: sandbox/units/boost/units/detail/cmath_gnu_impl_boost_1_35.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/detail/cmath_gnu_impl_boost_1_35.hpp 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
@@ -0,0 +1,212 @@
+// mcs::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)
+
+#ifndef BOOST_UNITS_CMATH_GNU_IMPL_BOOST_1_35_HPP
+#define BOOST_UNITS_CMATH_GNU_IMPL_BOOST_1_35_HPP
+
+#if (__GNUC__ && __cplusplus && __GNUC__ >= 3)
+
+#include <cmath>
+
+namespace boost {
+
+namespace units {
+
+namespace detail {
+
+template<class Y>
+inline bool isfinite(const Y& val)
+{
+ return std::isfinite(val);
+}
+
+template<class Y>
+inline bool isinf(const Y& val)
+{
+ return std::isinf(val);
+}
+
+template<class Y>
+inline bool isnan(const Y& val)
+{
+ return std::isnan(val);
+}
+
+template<class Y>
+inline bool isnormal(const Y& val)
+{
+ return std::isnormal(val);
+}
+
+template<class Y>
+inline bool isgreater(const Y& v1,const Y& v2)
+{
+ return __builtin_isgreater(v1,v2);
+}
+
+template<class Y>
+inline bool isgreaterequal(const Y& v1,const Y& v2)
+{
+ return __builtin_isgreaterequal(v1,v2);
+}
+
+template<class Y>
+inline bool isless(const Y& v1,const Y& v2)
+{
+ return __builtin_isless(v1,v2);
+}
+
+template<class Y>
+inline bool islessequal(const Y& v1,const Y& v2)
+{
+ return __builtin_islessequal(v1,v2);
+}
+
+template<class Y>
+inline bool islessgreater(const Y& v1,const Y& v2)
+{
+ return __builtin_islessgreater(v1,v2);
+}
+
+template<class Y>
+inline bool isunordered(const Y& v1,const Y& v2)
+{
+ return __builtin_isunordered(v1,v2);
+}
+
+template<class Y>
+inline Y abs(const Y& val)
+{
+ return std::abs(val);
+}
+
+template<class Y>
+inline Y ceil(const Y& val)
+{
+ return __builtin_ceil(val);
+}
+
+template<class Y>
+inline Y copysign(const Y& v1,const Y& v2)
+{
+ return __builtin_copysign(v1,v2);
+}
+
+template<class Y>
+inline Y fabs(const Y& val)
+{
+ return __builtin_fabs(val);
+}
+
+template<class Y>
+inline Y floor(const Y& val)
+{
+ return __builtin_floor(val);
+}
+
+template<class Y>
+inline Y fdim(const Y& v1,const Y& v2)
+{
+ return __builtin_fdim(v1,v2);
+}
+
+template<class Y>
+inline Y fma(const Y& v1,const Y& v2,const Y& v3)
+{
+ return __builtin_fma(v1,v2,v3);
+}
+
+template<class Y>
+inline Y fmax(const Y& v1,const Y& v2)
+{
+ return __builtin_fmax(v1,v2);
+}
+
+template<class Y>
+inline Y fmin(const Y& v1,const Y& v2)
+{
+ return __builtin_fmin(v1,v2);
+}
+
+template<class Y>
+inline int fpclassify(const Y& val)
+{
+ return std::fpclassify(val);
+}
+
+template<class Y>
+inline Y hypot(const Y& v1,const Y& v2)
+{
+ return __builtin_hypot(v1,v2);
+}
+
+//template<class Y>
+//inline long long llrint(const Y& val)
+//{
+// return __builtin_llrint(val);
+//}
+//
+//template<class Y>
+//inline long long llround(const Y& val)
+//{
+// return __builtin_llround(val);
+//}
+
+template<class Y>
+inline Y nearbyint(const Y& val)
+{
+ return __builtin_nearbyint(val);
+}
+
+template<class Y>
+inline Y nextafter(const Y& v1,const Y& v2)
+{
+ return __builtin_nextafter(v1,v2);
+}
+
+template<class Y>
+inline Y nexttoward(const Y& v1,const Y& v2)
+{
+ return __builtin_nexttoward(v1,v2);
+}
+
+template<class Y>
+inline Y rint(const Y& val)
+{
+ return __builtin_rint(val);
+}
+
+template<class Y>
+inline Y round(const Y& val)
+{
+ return __builtin_round(val);
+}
+
+template<class Y>
+inline bool signbit(const Y& val)
+{
+ return __builtin_signbit(val);
+}
+
+template<class Y>
+inline Y trunc(const Y& val)
+{
+ return __builtin_trunc(val);
+}
+
+} // namespace detail
+
+} // namespace units
+
+} // namespace boost
+
+#endif // __GNUC__
+
+#endif // BOOST_UNITS_CMATH_GNU_IMPL_BOOST_1_35_HPP

Modified: sandbox/units/boost/units/detail/cmath_impl.hpp
==============================================================================
--- sandbox/units/boost/units/detail/cmath_impl.hpp (original)
+++ sandbox/units/boost/units/detail/cmath_impl.hpp 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
@@ -11,8 +11,16 @@
 #ifndef BOOST_UNITS_CMATH_IMPL_HPP
 #define BOOST_UNITS_CMATH_IMPL_HPP
 
-#include <boost/units/detail/cmath_gnu_impl.hpp>
-#include <boost/units/detail/cmath_mwcw_impl.hpp>
-#include <boost/units/detail/cmath_msvc_impl.hpp>
+#include <boost/version.hpp>
+
+#if (BOOST_VERSION <= 103500)
+ #include <boost/units/detail/cmath_gnu_impl_boost_1_35.hpp>
+ #include <boost/units/detail/cmath_mwcw_impl_boost_1_35.hpp>
+ #include <boost/units/detail/cmath_msvc_impl_boost_1_35.hpp>
+#else
+ #include <boost/units/detail/cmath_gnu_impl.hpp>
+ #include <boost/units/detail/cmath_mwcw_impl.hpp>
+ #include <boost/units/detail/cmath_msvc_impl.hpp>
+#endif // (BOOST_VERSION <= 103500)
 
 #endif // BOOST_UNITS_CMATH_IMPL_HPP

Added: sandbox/units/boost/units/detail/cmath_msvc_impl_boost_1_35.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/detail/cmath_msvc_impl_boost_1_35.hpp 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
@@ -0,0 +1,349 @@
+// mcs::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)
+
+#ifndef BOOST_UNITS_CMATH_MSVC_IMPL_BOOST_1_35_HPP
+#define BOOST_UNITS_CMATH_MSVC_IMPL_BOOST_1_35_HPP
+
+#include <boost/config.hpp>
+
+#if defined(BOOST_MSVC) || (defined(__COMO__) && defined(_MSC_VER))
+
+#include <cfloat>
+#include <cmath>
+
+#include <boost/static_warning.hpp>
+#include <boost/mpl/bool.hpp>
+
+namespace boost {
+
+namespace units {
+
+namespace detail {
+
+template<class Y>
+inline bool isfinite(const Y& val)
+{
+ return _finite(val) != 0;
+}
+
+template<class Y>
+inline bool isinf(const Y& val)
+{
+ return !isfinite(val) && !isnan(val);
+}
+
+template<class Y>
+inline bool isnan(const Y& val)
+{
+ return _isnan(val) != 0;
+}
+
+template<class Y>
+inline bool isnormal(const Y& val)
+{
+ int class_ = _fpclass(val);
+ return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
+}
+
+template<class Y>
+inline bool isgreater(const Y& v1,const Y& v2)
+{
+ if(_fpclass(v1) == _FPCLASS_SNAN || _fpclass(v2) == _FPCLASS_SNAN) return false;
+ else return v1 > v2;
+}
+
+template<class Y>
+inline bool isgreaterequal(const Y& v1,const Y& v2)
+{
+ if(_fpclass(v1) == _FPCLASS_SNAN || _fpclass(v2) == _FPCLASS_SNAN) return false;
+ else return v1 >= v2;
+}
+
+template<class Y>
+inline bool isless(const Y& v1,const Y& v2)
+{
+ if(::_fpclass(v1) == _FPCLASS_SNAN || ::_fpclass(v2) == _FPCLASS_SNAN) return false;
+ else return v1 < v2;
+}
+
+template<class Y>
+inline bool islessequal(const Y& v1,const Y& v2)
+{
+ if(::_fpclass(v1) == _FPCLASS_SNAN || ::_fpclass(v2) == _FPCLASS_SNAN) return false;
+ else return v1 <= v2;
+}
+
+template<class Y>
+inline bool islessgreater(const Y& v1,const Y& v2)
+{
+ if(::_fpclass(v1) == _FPCLASS_SNAN || ::_fpclass(v2) == _FPCLASS_SNAN) return false;
+ else return v1 < v2 || v1 > v2;
+}
+
+template<class Y>
+inline bool isunordered(const Y& v1,const Y& v2)
+{
+ return isnan(v1) || isnan(v2);
+}
+
+template<class Y>
+inline Y abs(const Y& val)
+{
+ return ::abs(val);
+}
+
+template<class Y>
+inline Y ceil(const Y& val)
+{
+ return ::ceil(val);
+}
+
+template<class Y>
+inline Y copysign(const Y& v1,const Y& v2)
+{
+ return ::_copysign(v1,v2);
+}
+
+#if _MSC_VER == 1400
+// unavailable on MSVC 7.1
+template<>
+inline long double copysign(const long double& v1,const long double& v2)
+{
+ return ::_copysignl(v1,v2);
+}
+#endif
+
+template<class Y>
+inline Y fabs(const Y& val)
+{
+ return ::fabs(val);
+}
+
+template<class Y>
+inline Y floor(const Y& val)
+{
+ return ::floor(val);
+}
+
+template<class Y>
+inline Y fdim(const Y& v1,const Y& v2)
+{
+ if(isnan(v1)) return v1;
+ else if(isnan(v2)) return v2;
+ else if(v1 > v2) return(v1 - v2);
+ else return(Y(0));
+}
+
+template<class T>
+struct fma_issue_warning {
+ enum { value = false };
+};
+
+template<class Y>
+inline Y fma(const Y& v1,const Y& v2,const Y& v3)
+{
+ //this implementation does *not* meet the
+ //requirement of infinite intermediate precision
+ BOOST_STATIC_WARNING((fma_issue_warning<Y>::value));
+
+ return v1 * v2 + v3;
+}
+
+template<class Y>
+inline Y fmax(const Y& v1,const Y& v2)
+{
+ return __max(v1,v2);
+}
+
+template<class Y>
+inline Y fmin(const Y& v1,const Y& v2)
+{
+ return __min(v1,v2);
+}
+
+template<class Y>
+inline int fpclassify(const Y& val)
+{
+ return ::_fpclass(val);
+}
+
+template<class Y>
+inline Y hypot(const Y& v1,const Y& v2)
+{
+ return ::_hypot(v1,v2);
+}
+
+namespace hypotf_impl {
+
+struct convertible_from_float
+{
+ convertible_from_float(const float&) {}
+};
+
+typedef char no;
+
+struct yes { no dummy[2]; };
+
+struct hypot_result {};
+
+hypot_result hypotf(const convertible_from_float&, const convertible_from_float&);
+hypot_result _hypotf(const convertible_from_float&, const convertible_from_float&);
+
+no has_hypot(hypot_result);
+
+yes has_hypot(float);
+
+template<class Float>
+inline float do_hypot_(const Float& v1,const Float& v2, mpl::true_)
+{
+ return ::_hypotf(v1,v2);
+}
+
+template<class Float>
+inline float do_hypot_(const Float& v1,const Float& v2, mpl::false_)
+{
+ return static_cast<float>(::_hypot(v1,v2));
+}
+
+template<class Float>
+inline float do_hypot(const Float& v1,const Float& v2, mpl::true_)
+{
+ return ::_hypotf(v1,v2);
+}
+
+template<class Float>
+inline float do_hypot(const Float& v1,const Float& v2, mpl::false_)
+{
+ mpl::bool_<(sizeof(hypotf_impl::has_hypot(_hypotf(v1, v2)))==sizeof(hypotf_impl::yes))> condition;
+ return hypotf_impl::do_hypot_(v1,v2, condition);
+}
+
+}
+
+template<>
+inline float hypot(const float& v1,const float& v2)
+{
+ using namespace hypotf_impl;
+ mpl::bool_<(sizeof(hypotf_impl::has_hypot(hypotf(v1, v2)))==sizeof(hypotf_impl::yes))> condition;
+ return hypotf_impl::do_hypot(v1,v2,condition);
+}
+
+//template<class Y>
+//inline long long llrint(const Y& val)
+//{
+// return static_cast<long long>(rint(val));
+//}
+//
+//template<class Y>
+//inline long long llround(const Y& val)
+//{
+// return static_cast<long long>(round(val));
+//}
+
+template<class Y>
+inline Y nearbyint(const Y& val)
+{
+ //this is not really correct.
+ //the result should be according to the
+ //current rounding mode.
+ return round(val);
+}
+
+template<class Y>
+inline Y nextafter(const Y& v1,const Y& v2)
+{
+ return ::_nextafter(v1,v2);
+}
+
+template<class Y>
+inline Y nexttoward(const Y& v1,const Y& v2)
+{
+ //the only diference between nextafter and
+ //nexttoward is the types of the operands
+ return ::_nextafter(v1,v2);
+}
+
+template<class Y>
+inline Y rint(const Y& val)
+{
+ //I don't feel like trying to figure out
+ //how to raise a floating pointer exception
+ return nearbyint(val);
+}
+
+template<class Y>
+inline Y round(const Y& val)
+{
+ if(isnan(val)) return val;
+ if(val == 0) return val;
+ if(val > 0)
+ {
+ Y result1(val + .5);
+ if(result1 != std::numeric_limits<Y>::infinity()) return std::floor(result1);
+ Y result2(val - .5);
+ Y result3(std::ceil(result2));
+ if(result3 == result2)
+ if(result3 == val) return val;
+ else return std::ceil(val);
+ else return result3;
+ }
+ else
+ {
+ Y result1(val - .5);
+ if(result1 != -std::numeric_limits<Y>::infinity()) return std::ceil(result1);
+ Y result2(val + .5);
+ Y result3(std::floor(result2));
+ if(result3 == result2)
+ if(result3 == val) return val;
+ else return std::floor(val);
+ else return result3;
+ }
+}
+
+template<class Y>
+inline bool signbit(const Y& val)
+{
+ switch(fpclassify(val))
+ {
+ case _FPCLASS_SNAN:
+ case _FPCLASS_QNAN:
+ //whatever.
+
+ case _FPCLASS_NINF:
+ case _FPCLASS_NN:
+ case _FPCLASS_ND:
+ case _FPCLASS_NZ: return(true);
+
+ case _FPCLASS_PZ:
+ case _FPCLASS_PD:
+ case _FPCLASS_PN:
+ case _FPCLASS_PINF: return(false);
+
+ }
+ return(false);
+}
+
+template<class Y>
+inline Y trunc(const Y& val)
+{
+ if(val > 0) return std::floor(val);
+ else if(val < 0) return std::ceil(val);
+ else return val;
+}
+
+} // namespace detail
+
+} // namespace units
+
+} // namespace boost
+
+#endif // __MSVC__
+
+#endif // BOOST_UNITS_CMATH_MSVC_IMPL_BOOST_1_35_HPP

Added: sandbox/units/boost/units/detail/cmath_mwcw_impl_boost_1_35.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/detail/cmath_mwcw_impl_boost_1_35.hpp 2008-05-19 15:58:45 EDT (Mon, 19 May 2008)
@@ -0,0 +1,218 @@
+// mcs::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)
+
+#ifndef BOOST_UNITS_CMATH_MWCW_IMPL_BOOST_1_35_HPP
+#define BOOST_UNITS_CMATH_MWCW_IMPL_BOOST_1_35_HPP
+
+#if __MWERKS__
+
+#include <cmath>
+
+// BOOST_PREVENT_MACRO_SUBSTITUTION is used for all functions even though it
+// isn't necessary -- I didn't want to think :)
+
+// the form using namespace detail; return(f(x)); is used
+// to enable ADL for UDTs
+
+namespace boost {
+
+namespace units {
+
+namespace detail {
+
+template<class Y>
+inline bool isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return isfinite(val);
+}
+
+template<class Y>
+inline bool isinf BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return isinf(val);
+}
+
+template<class Y>
+inline bool isnan BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return isnan(val);
+}
+
+template<class Y>
+inline bool isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return isnormal(val);
+}
+
+template<class Y>
+inline bool isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return ::isgreater(v1,v2);
+}
+
+template<class Y>
+inline bool isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return ::isgreaterequal(v1,v2);
+}
+
+template<class Y>
+inline bool isless BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return ::isless(v1,v2);
+}
+
+template<class Y>
+inline bool islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return ::islessequal(v1,v2);
+}
+
+template<class Y>
+inline bool islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return ::islessgreater(v1,v2);
+}
+
+template<class Y>
+inline bool isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return ::isunordered(v1,v2);
+}
+
+template<class Y>
+inline Y abs BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::abs(val);
+}
+
+template<class Y>
+inline Y ceil BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::ceil(val);
+}
+
+template<class Y>
+inline Y copysign BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::copysign(v1,v2);
+}
+
+template<class Y>
+inline Y fabs BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::fabs(val);
+}
+
+template<class Y>
+inline Y floor BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::floor(val);
+}
+
+template<class Y>
+inline Y fdim BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::fdim(v1,v2);
+}
+
+template<class Y>
+inline Y fma BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2,const Y& v3)
+{
+ return std::fma(v1,v2,v3);
+}
+
+template<class Y>
+inline Y fmax BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::fmax(v1,v2);
+}
+
+template<class Y>
+inline Y fmin BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::fmin(v1,v2);
+}
+
+template<class Y>
+inline int fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return fpclassify(val);
+}
+
+template<class Y>
+inline Y hypot BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::hypot(v1,v2);
+}
+
+//template<class Y>
+//inline long long llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+//{
+// return std::llrint(val);
+//}
+//
+//template<class Y>
+//inline long long llround BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+//{
+// return std::llround(val);
+//}
+
+template<class Y>
+inline Y nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::nearbyint(val);
+}
+
+template<class Y>
+inline Y nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::nextafter(v1,v2);
+}
+
+template<class Y>
+inline Y nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& v1,const Y& v2)
+{
+ return std::nexttoward(v1,v2);
+}
+
+template<class Y>
+inline Y rint BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::rint(val);
+}
+
+template<class Y>
+inline Y round BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::round(val);
+}
+
+template<class Y>
+inline bool signbit BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return signbit(val);
+}
+
+template<class Y>
+inline Y trunc BOOST_PREVENT_MACRO_SUBSTITUTION (const Y& val)
+{
+ return std::trunc(val);
+}
+
+} // namespace detail
+
+} // namespace units
+
+} // namespace boost
+
+#endif // __MWERKS__
+
+#endif // BOOST_UNITS_CMATH_MWCW_IMPL_BOOST_1_35_HPP


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk