Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-04-27 07:55:45

These are my (only slightly informed) opinions. I've heard Walter
Brown talk about angle in this context, which was a big influence.

Terje Slettebø <tslettebo_at_[hidden]> writes:

> Regarding this angle dimension, should it be treated like the other
> SI-dimensions? That is, say that you represent an SI quantity/unit
> with an integer vector giving the exponents:
> template<int kg,int m,int s,int A,int K,int mol,int cd,int angle>
> class quantity;
> If you multiply two quantities, you multiply the value and add the
> exponents, so quantity<0,1,0,0,0,0,0,0>(10) * quantity<0,1,0,0,0,0,0,0>(10)
> = quantity<0,2,0,0,0,0,0,0>(100) (m * m = m^2)
> Would this hold for angle, as well?

Yes. Angle is a dimensionless scalar (length/length). All its
exponents are zero.

> That is, does it make sense to say angle * angle = angle^2?

Probably not, but only because angle * angle doesn't make much
sense. Does that ever come up in real life?

> I understand that e.g. angle/s (angular velocity) makes sense, but
> should a library allow any combination with angle and the other
> dimensions?

Not arbitrarily:

    angle(pi/2) / mass(40); // OK
    angle(pi/2) + mass(40); // error

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at