
Carlo Wood wrote:
On Thu, Jun 08, 2006 at 05:36:40PM -0500, David Greene wrote:
the library. Andy presented this example to justify kg's 0 power:
mass::kg m(1); // 1 kg == 1000 g acceleration::m_div_s2 a(1); // 1 meter per second squared force::N f = m * a;
The value of f should be 1000 Newtons right?
Of course, the value is 1 Newton. But this has nothing at all to do with kg having a prefix power of 0 or 3. The calculation can
The point is,
1 N = 1 kg * 1 m / 1 s / 1 s
The 1 comes from 10^0, hence 0 is needed.
10^0 N = 10^0 kg * 10^0 m / 10^0 s / 10^0 s
0 = 0 + 0 - 0 - 0
The calculation of the left-hand 0 is done with generic templates using '+' to add up exponents. How is it logical to make an exception here for kg?
If you'd force 'kg' to be 'g' internally, then you will have to apply the same trick to N that is now applied to kg, with the exception that then BOTH are internally not in S.I. units (mN and g, instead of N and kg). That is, you'd end up with:
3 = 3 + 0 - 0 - 0
and thus mN. But you still want to print N. I don't think it will get any better by using a prefix power of 3 for kg.
If you know that kg ==> 10^3g and that N = kg.m.s-2 then you have the information right there! Given that N is expressed in terms of kg, the library will know that the powers of each unit are: N = [ 3, 0, 0, 0 ] and that mN is: N = [ 0, -3, -3, -3 ] You don't need to treat kg as a special case here where the math is concerned, as per my unit system toy example. - Reece _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
participants (1)
-
Reece Dunn