Boost logo

Boost :

From: John Phillips (phillips_at_[hidden])
Date: 2006-06-08 18:04:17


Gerhard Wesp wrote:

> On Wed, Jun 07, 2006 at 10:04:20PM +0100, Reece Dunn wrote:
>
>
>>so, which value is correct? The one in Joules (sp?) or the one in
>
>
> Well, both are probably correct. :) Now I'm not a theoretical
> physicist, but I'm pretty sure that even there all but the most trivial
> calculations become cleaner once you use SI units. Seems as if I'd want
> to mildly encourage even those folks to use SI.
>
> As to your rounding error concerns, I can reassure you, multiplication
> and division is very well-behaved in floating point.

    Not attempting to sound snooty, but I am a theoretial physicist
(astrophysics and cosmology, to be complete) and you are incorrect in
thinking that SI units make everything simpler. The whole point of any
of the specialized unit systems is to reduce complexity.
    If I want to talk about the energy of a fast moving sub-atomic
particle using SI units, I have to carry around multiplicative factors
that hold the scales of the speed of light, the strength of the
electromagnetic interactions and the mass of the particle, among other
things. If I use eV based unts instead, some of these constants become
1, and so I never need to remember to write them, and I never have to
pay clock ticks in the calculation to compute them. In the inner loops
of intense calculations, losing those extra multiplications can make
hours or days of difference in how long the calculation takes to
complete. So, the code becomes both less likely to contain errors and
faster by using non-SI units. For research simulations, a restriction to
SI only is a game breaker for the library.
    Also, moving to a well chosen set of non-SI units can frequently
reduce the chance of round-off errors and make a calculation more
stable. In some cases, it can even change a calculation from floating
point to integer, and so remove all round off concerns.
    To go with that, most human beings are far more likely to be able to
interpret numbers in the range of about 0.01 to 100 instead of numbers
far away from one. I could calculate the age of the universe in seconds
(the SI unit of time), but it is far more menaingful to most people when
reported as ~14Gyr. (To get seconds from that, multiply by ~3.15*10^7.)

>
>
>>(3) it will have greater runtime penalties, especially if used in a loop;
>
> I fail to see this.
>
>
>>(4) can have inacuracies when dealing with large or small physical
>>constant-based values;
>
> Why/how? In what way different from non-SI?
>
>
>>(5) is bad if those constants are changing!
>
> Well... If the Lord decides to change the gravitational constant, I
> guess we're toast anyway.

    Very few physical constants are actually constant.
    First, most physical constants are measured values, so as our ability
to measure them improves, the accepted value changes. In some cases,
these changes are frequent enough and important enough that a system
without the ability to accomidate them is not useful.
    Second, and less intuitive, some physical constants change based on
the environment in which they are measured. For example, the strength of
the electromagnetic interaction is not actually constant, though in your
day to day life you never see it change. It depends on the energies of
the interacting particles. If you leave this out of a particle physics
calculation, you will be very wrong. The gravitational constant is also
expected to have an energy dependence (though it is harder to measure),
by the way.

>
>
>>(6) can penalize you if intervals come into play.
>
> I fail to see this, too.
>
> Regards
> -Gerhard

    For me, coming from my background, forcing SI units is a very bad
idea. I understand that many people can work their entire careers and
never run into any of these problems, but they are every day things for
me, so I would like to see a design that supports what I need to do.

                        John Phillips


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