Boost logo

Boost-Commit :

From: steven_at_[hidden]
Date: 2008-05-22 00:50:55


Author: steven_watanabe
Date: 2008-05-22 00:50:54 EDT (Thu, 22 May 2008)
New Revision: 45637
URL: http://svn.boost.org/trac/boost/changeset/45637

Log:
Fixed cmath.hpp trig functions
Text files modified:
   sandbox/units/boost/units/cmath.hpp | 76 +++++++++++--------------
   sandbox/units/boost/units/detail/cmath_boost_1_35.hpp | 116 ----------------------------------------
   sandbox/units/boost/units/systems/si/base.hpp | 16 ++--
   3 files changed, 42 insertions(+), 166 deletions(-)

Modified: sandbox/units/boost/units/cmath.hpp
==============================================================================
--- sandbox/units/boost/units/cmath.hpp (original)
+++ sandbox/units/boost/units/cmath.hpp 2008-05-22 00:50:54 EDT (Thu, 22 May 2008)
@@ -525,6 +525,16 @@
     return quantity_type::from_value(sqrt(q.value()));
 }
 
+} // namespace units
+
+} // namespace boost
+
+#endif // (BOOST_VERSION <= 103500)
+
+namespace boost {
+
+namespace units {
+
 // trig functions with si argument/return types
 
 /// cos of theta in radians
@@ -532,7 +542,8 @@
 typename dimensionless_quantity<si::system,Y>::type
 cos(const quantity<si::plane_angle,Y>& theta)
 {
- return std::cos(theta.value());
+ using std::cos;
+ return cos(theta.value());
 }
 
 /// sin of theta in radians
@@ -540,7 +551,8 @@
 typename dimensionless_quantity<si::system,Y>::type
 sin(const quantity<si::plane_angle,Y>& theta)
 {
- return std::sin(theta.value());
+ using std::sin;
+ return sin(theta.value());
 }
 
 /// tan of theta in radians
@@ -548,7 +560,8 @@
 typename dimensionless_quantity<si::system,Y>::type
 tan(const quantity<si::plane_angle,Y>& theta)
 {
- return std::tan(theta.value());
+ using std::tan;
+ return tan(theta.value());
 }
 
 /// cos of theta in other angular units
@@ -575,66 +588,45 @@
     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)
+quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
+acos(const quantity<unit<dimensionless_type, homogeneous_system<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);
+ using std::acos;
+ return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(acos(val.value())*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)
+quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
+asin(const quantity<unit<dimensionless_type, homogeneous_system<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);
+ using std::asin;
+ return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(asin(val.value())*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)
+quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
+atan(const quantity<unit<dimensionless_type, homogeneous_system<System> >, Y>& val)
 {
- return quantity<unit<plane_angle_dimension,System>,Y>(std::atan(val)*si::radians);
+ using std::atan;
+ return quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>(atan(val.value())*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)
+template<class Y, class System>
+quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>
+atan2(const quantity<unit<dimensionless_type, homogeneous_system<System> >, Y>& y,
+ const quantity<unit<dimensionless_type, homogeneous_system<System> >, Y>& x)
 {
- return quantity<si::plane_angle,Y>(std::atan2(y,x)*si::radians);
+ using std::atan2;
+ return quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>(atan2(y.value(),x.value())*si::radians);
 }
 
 } // namespace units
 
 } // namespace boost
 
-#endif // (BOOST_VERSION <= 103500)
-
 #endif // BOOST_UNITS_CMATH_HPP

Modified: sandbox/units/boost/units/detail/cmath_boost_1_35.hpp
==============================================================================
--- sandbox/units/boost/units/detail/cmath_boost_1_35.hpp (original)
+++ sandbox/units/boost/units/detail/cmath_boost_1_35.hpp 2008-05-22 00:50:54 EDT (Thu, 22 May 2008)
@@ -514,122 +514,6 @@
     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)
-{
- using std::cos;
- return 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)
-{
- using std::sin;
- return 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)
-{
- using std::tan;
- return 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)
-{
- using std::acos;
- return quantity<si::plane_angle,Y>(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)
-{
- using std::acos;
- return quantity<unit<plane_angle_dimension,System>,Y>(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)
-{
- using std::asin;
- return quantity<si::plane_angle,Y>(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)
-{
- using std::asin;
- return quantity<unit<plane_angle_dimension,System>,Y>(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)
-{
- using std::atan;
- return quantity<si::plane_angle,Y>(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)
-{
- using std::atan;
- return quantity<unit<plane_angle_dimension,System>,Y>(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)
-{
- using std::atan2;
- return quantity<si::plane_angle,Y>(atan2(y,x)*si::radians);
-}
-
 } // namespace units
 
 } // namespace boost

Modified: sandbox/units/boost/units/systems/si/base.hpp
==============================================================================
--- sandbox/units/boost/units/systems/si/base.hpp (original)
+++ sandbox/units/boost/units/systems/si/base.hpp 2008-05-22 00:50:54 EDT (Thu, 22 May 2008)
@@ -36,14 +36,14 @@
 
 /// placeholder class defining si unit system
 typedef make_system<meter_base_unit,
- kilogram_base_unit,
- second_base_unit,
- ampere_base_unit,
- kelvin_base_unit,
- mole_base_unit,
- candela_base_unit,
- angle::radian_base_unit,
- angle::steradian_base_unit>::type system;
+ kilogram_base_unit,
+ second_base_unit,
+ ampere_base_unit,
+ kelvin_base_unit,
+ mole_base_unit,
+ candela_base_unit,
+ angle::radian_base_unit,
+ angle::steradian_base_unit>::type system;
 
 /// dimensionless si unit
 typedef unit<dimensionless_type,system> dimensionless;


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