|
Boost : |
From: Andy Little (andy_at_[hidden])
Date: 2005-01-28 14:58:58
"Phil Richards" <news_at_[hidden]> wrote
On 2005-01-28, Sérgio Vale e Pace <svpace.forum_at_[hidden]> wrote:
> > Is there any current efford to develop that? the fractional exponents
> > solution has been presented in the Walter Brown´s paper. There is
> > already a requirement set for such library?
> > there is interest in such library?
Yes, but dimensional -analysis is only one part. The real issue is physical
quantities and units, which is a much more involved and messy subject. IMO
the niche is for those who need to deal with physical quantities on a day to
day basis. This involves dealing with units and angles, maths and matrices
etc, using the stronger type checking. (There is also a large amount of
disagreement on various issues, best resolved simply by use cases than
argument on boost... eg over angles.)
A familiar example of the problem of coding with physical quantities is
screen coordinates. These are in fact lengths, whereas in GUI's an int (or
double) pixel (or 'logical-coordinate') type is often used for drawing. Its
a paradigm shift and would have a major impact on code which is not
backward compatible. Then again, a few people seem to 'get it' ... ;-)
> I'm still recovering from the last discussion about a year or so ago...
> I still twitch when I hear "dimensional analysis" and "angle" in the
> same sentence.
FWIW angle is a value_type in my version. (IMO angle is not a dimension)
:-)
http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/angles.html
with (only in case of 'irrational' angles) implicit conversion( or 'decay')
to/from an arithmetic type. (Not documented above but available in the lib)
This allows it to work with arithmetic types, passing eg radians while
trapping errors involving attempted conversion of eg degrees... works well
IMO.
(BTW code tested on gcc3.3, VC7.1. I have done some work compatibility
issues with later gcc versions (eg gcc3.3). If interested email me privately
for patches)
> My solution did/does use the MPL (now, anyway), and has fractional
> powers, but so did at least one of the others.
I would ideally like to redo pqs using 'official boost' but currently dont
have time.
Firstly would be nice to have boost::mpl::rational_c completed (
"boost/mpl/math/rational_c.hpp"), which AFAIK is in progress.
Secondly return type deduction plays a major role. So another requirement
would be Arkadiy Vertleybs type deduction lib. With those components in
place things would be simpler.
> I'm using it in a "proper" (real-world) project, and it does what we
> need.
As do I ... I simply wouldnt go back to using doubles.
> maybe when the baby has grown up a bit :-)
I agree. In reality a 'useful' physical quantities library would be big.
This needs a lot of time and work to mature.
regards
Andy Little
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk