Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-31 18:04:37


AMDG

Matthias Schabel <boost <at> schabel-family.org> writes:

> >
> > You're misusing dimensionless_quantity....
>
> Not sure what you mean - I need to preserve system information in
> dimensionless quantities to make the trig functions properly
> invertible : that is acos(cos(theta)) == theta should hold true...

/// cos of theta in radians
template<class Y>
typename dimensionless_quantity<*angle::radian*,Y>::type
cos(const quantity<angle::radian,Y>& theta)
{
    return std::cos(theta.value());
}

/// utility class to simplify construction of dimensionless quantities
template<*class System*,class Y>
struct dimensionless_quantity
{
    typedef quantity<typename dimensionless_unit<System>::type,Y> type;
};

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk