Subject: Re: [boost] [units] - learning to use
From: Janek Kozicki (janek_listy_at_[hidden])
Date: 2011-11-28 11:45:36
Matthias Schabel said: (by the date of Mon, 28 Nov 2011 08:01:31 -0800)
> > a += dd*exp(i*k*r)/r;
> I don't think you missed anything and I think that your second expression should work as expected. I would
> consider it a flaw in Boost.Units that this does not currently work and a flaw in C++ that getting a (relatively)
> simple mathematical concept like dimensional analysis to function in a library is as difficult as it is...
I am attaching error log for this single line change.
gcc version 4.4.5 (Debian 4.4.5-8)
that's what I currently use. But I can update if required, especially boost version :)
> The currently sanctioned approach to function arguments is to use templates to accept any unit of the
> appropriate dimension, but it does make more sense to allow implicit conversion in the special case
> of scaled units. The only issue is the danger of roundoff/truncation problems.
if orders of magnitude are greater than used precision (double, for
example) a warning could be emitted. But not a critical error, I think.
People should write their code to compile without warnings.
> > And those short names are carefully designed to not have any unit
> > name clashes.
> I guess we could have a header corresponding to each SI unit that contains predefined scaled units
> for each of the SI prefixes.
> I'll try to get you something to start with later today.
that will be great, thanks :)
-- Janek Kozicki http://janek.kozicki.pl/ |