Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] conversion_factor in the two directions
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-02-28 10:07:37


AMDG

alfC wrote:
>> that worked right away. What would be the drawback of using
>> DEFAULT_CONVERSION macro? loss of precision perhaps?
>>
>
> actually, the question is more profound, from the design of the
> library it seems that you were very careful not to make any
> transformation automatically because loss of precision.
>

The idea is that you can specify as many direct conversions as you
want, and the library will use the default one only if it can't find the
one it really wants. In fact, we use DEFAULT_CONVERSION
for most of the non-SI units.

> If that is the case I would like to follow your design principle. On
> the other hand, even if I want to work in atomic units (motivated by
> the order of magnitudes of the quantities) it is inevitable to output
> some of the results in SI. The question is does it make sense to have
> this transformation from Hartree to Joule with such an huge exponent.
>

It's probably okay. double can handle values up to about 10^300

> Following your design, would it be better to have a conversion from
> Hartree to some scaled unit of Joule (femtoJoule) instead, so all the
> machine number have small exponents?
>

I'm not a floating point expert, but if you're just doing the conversion
for output, it probably doesn't matter.

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net