comp.lang.ada
 help / color / mirror / Atom feed
* Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
@ 2014-02-04 17:26 Anh Vo
  2014-02-04 17:44 ` adambeneschan
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Anh Vo @ 2014-02-04 17:26 UTC (permalink / raw)


The Kilogram constants defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) look different compared to others such as Meter, Second,... In addition, the values do not match with names in the comments on the right side. I would like to know why. By the way, the Meter, Kilogram and Second constant are repeated here for easy discussion.

   --  SI prefixes for Meter

   pragma Warnings (Off);
   --  Turn off the all the dimension warnings

   ym  : constant Length := 1.0E-24;  -- yocto
   zm  : constant Length := 1.0E-21;  -- zepto
   am  : constant Length := 1.0E-18;  -- atto
   fm  : constant Length := 1.0E-15;  -- femto
   pm  : constant Length := 1.0E-12;  -- pico
   nm  : constant Length := 1.0E-09;  -- nano
   Gm  : constant Length := 1.0E+09;  -- giga
   Tm  : constant Length := 1.0E+12;  -- tera
   Pem : constant Length := 1.0E+15;  -- peta
   Em  : constant Length := 1.0E+18;  -- exa
   Zem : constant Length := 1.0E+21;  -- zetta
   Yom : constant Length := 1.0E+24;  -- yotta

   --  SI prefixes for Kilogram

   yg  : constant Mass := 1.0E-27;  -- yocto
   zg  : constant Mass := 1.0E-24;  -- zepto
   ag  : constant Mass := 1.0E-21;  -- atto
   fg  : constant Mass := 1.0E-18;  -- femto
   pg  : constant Mass := 1.0E-15;  -- pico
   ng  : constant Mass := 1.0E-12;  -- nano
   Gg  : constant Mass := 1.0E+06;  -- giga
   Tg  : constant Mass := 1.0E+09;  -- tera
   Peg : constant Mass := 1.0E+13;  -- peta
   Eg  : constant Mass := 1.0E+15;  -- exa
   Zeg : constant Mass := 1.0E+18;  -- zetta
   Yog : constant Mass := 1.0E+21;  -- yotta

   --  SI prefixes for Second

   ys  : constant Time := 1.0E-24;  -- yocto
   zs  : constant Time := 1.0E-21;  -- zepto
   as  : constant Time := 1.0E-18;  -- atto
   fs  : constant Time := 1.0E-15;  -- femto
   ps  : constant Time := 1.0E-12;  -- pico
   ns  : constant Time := 1.0E-09;  -- nano
   Gs  : constant Time := 1.0E+09;  -- giga
   Ts  : constant Time := 1.0E+12;  -- tera
   Pes : constant Time := 1.0E+15;  -- peta
   Es  : constant Time := 1.0E+18;  -- exa
   Zes : constant Time := 1.0E+21;  -- zetta
   Yos : constant Time := 1.0E+24;  -- yotta
  
   --...


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 17:26 Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) Anh Vo
@ 2014-02-04 17:44 ` adambeneschan
  2014-02-04 18:10   ` G.B.
  2014-02-04 18:19 ` Ludovic Brenta
  2014-02-05  7:44 ` Yannick Duchêne (Hibou57)
  2 siblings, 1 reply; 9+ messages in thread
From: adambeneschan @ 2014-02-04 17:44 UTC (permalink / raw)


On Tuesday, February 4, 2014 9:26:05 AM UTC-8, Anh Vo wrote:
> The Kilogram constants defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) look different compared to others such as Meter, Second,... In addition, the values do not match with names in the comments on the right side. I would like to know why. By the way, the Meter, Kilogram and Second constant are repeated here for easy discussion.

"Kilo" is a prefix, so why is there a section on "SI prefixes for Kilogram" in the first place?  (Instead of "SI prefixes for Gram".)

                           -- Adam


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 17:44 ` adambeneschan
@ 2014-02-04 18:10   ` G.B.
  2014-02-04 18:16     ` adambeneschan
  0 siblings, 1 reply; 9+ messages in thread
From: G.B. @ 2014-02-04 18:10 UTC (permalink / raw)


On 04.02.14 18:44, adambeneschan@gmail.com wrote:
> On Tuesday, February 4, 2014 9:26:05 AM UTC-8, Anh Vo wrote:
>> The Kilogram constants defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) look different compared to others such as Meter, Second,... In addition, the values do not match with names in the comments on the right side. I would like to know why. By the way, the Meter, Kilogram and Second constant are repeated here for easy discussion.
>
> "Kilo" is a prefix, so why is there a section on "SI prefixes for Kilogram" in the first place?  (Instead of "SI prefixes for Gram".)

I guess "Kilogram" reflects MKS of the SI base units
(meters, kilograms, seconds); this explains the difference
of 3 in the exponent of 10, accounting for base unit's
weight of 1_000 grams.

GNAT changes the official SI prefix for micro-, which is µ,
to u. This seems in line with geeky use and with avoiding
plain text character π from the reference manual. (I understand
that the US Navy has lifted the former restriction on the
number of bits to be used for characters?)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 18:10   ` G.B.
@ 2014-02-04 18:16     ` adambeneschan
  2014-02-04 18:22       ` adambeneschan
  0 siblings, 1 reply; 9+ messages in thread
From: adambeneschan @ 2014-02-04 18:16 UTC (permalink / raw)


On Tuesday, February 4, 2014 10:10:34 AM UTC-8, G.B. wrote:

> > On Tuesday, February 4, 2014 9:26:05 AM UTC-8, Anh Vo wrote:
> 
> >> The Kilogram constants defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) look different compared to others such as Meter, Second,... In addition, the values do not match with names in the comments on the right side. I would like to know why. By the way, the Meter, Kilogram and Second constant are repeated here for easy discussion.
> 
> >
> 
> > "Kilo" is a prefix, so why is there a section on "SI prefixes for Kilogram" in the first place?  (Instead of "SI prefixes for Gram".)
> 
> I guess "Kilogram" reflects MKS of the SI base units
> (meters, kilograms, seconds); this explains the difference
> of 3 in the exponent of 10, accounting for base unit's
> weight of 1_000 grams.

OK, that would make sense.

                            -- Adam

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 17:26 Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) Anh Vo
  2014-02-04 17:44 ` adambeneschan
@ 2014-02-04 18:19 ` Ludovic Brenta
  2014-02-04 19:44   ` Anh Vo
  2014-02-05  7:44 ` Yannick Duchêne (Hibou57)
  2 siblings, 1 reply; 9+ messages in thread
From: Ludovic Brenta @ 2014-02-04 18:19 UTC (permalink / raw)


Anh Vo <anhvofrcaus@gmail.com> writes:
> The Kilogram constants defined in package System.Dim.Other_Prefixes
> (s-dmotpr.ads) look different compared to others such as Meter,
> Second,... In addition, the values do not match with names in the
> comments on the right side. I would like to know why. By the way, the
> Meter, Kilogram and Second constant are repeated here for easy
> discussion.

Because the base SI unit for weight is not gram, it is kilogram.  This
explains the difference in exponents.  Also, in s-dimmks.ads, note how
the gram is defined:

   ug  : constant Mass := 1.0E-09;  -- micro (u)
   mg  : constant Mass := 1.0E-06;  -- milli
   cg  : constant Mass := 1.0E-05;  -- centi
   dg  : constant Mass := 1.0E-04;  -- deci
   g   : constant Mass := 1.0E-03;  -- gram
   dag : constant Mass := 1.0E-02;  -- deka
   hg  : constant Mass := 1.0E-01;  -- hecto
   Meg : constant Mass := 1.0E+03;  -- mega


-- 
Ludovic Brenta.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 18:16     ` adambeneschan
@ 2014-02-04 18:22       ` adambeneschan
  0 siblings, 0 replies; 9+ messages in thread
From: adambeneschan @ 2014-02-04 18:22 UTC (permalink / raw)


On Tuesday, February 4, 2014 10:16:58 AM UTC-8, adambe...@gmail.com wrote:

> > I guess "Kilogram" reflects MKS of the SI base units
> > (meters, kilograms, seconds); this explains the difference
> > of 3 in the exponent of 10, accounting for base unit's
> > weight of 1_000 grams.
> 
> OK, that would make sense.

Actually, it's consistent with the declarations in s-dimmks.ads--I just checked.  

                          -- Adam


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 18:19 ` Ludovic Brenta
@ 2014-02-04 19:44   ` Anh Vo
  0 siblings, 0 replies; 9+ messages in thread
From: Anh Vo @ 2014-02-04 19:44 UTC (permalink / raw)


On Tuesday, February 4, 2014 10:19:27 AM UTC-8, Ludovic Brenta wrote:
> Anh Vo <anhvofrcaus@gmail.com> writes: 
> > The Kilogram constants defined in package System.Dim.Other_Prefixes 
> > (s-dmotpr.ads) look different compared to others such as Meter, 
> > Second,... In addition, the values do not match with names in the 
> > comments on the right side. I would like to know why. By the way, the 
> > Meter, Kilogram and Second constant are repeated here for easy 
> > discussion.
>  
> Because the base SI unit for weight is not gram, it is kilogram.  This 
> explains the difference in exponents.  Also, in s-dimmks.ads, note how 
> the gram is defined:
>  
>    ug  : constant Mass := 1.0E-09;  -- micro (u) 
>    mg  : constant Mass := 1.0E-06;  -- milli 
>    cg  : constant Mass := 1.0E-05;  -- centi 
>    dg  : constant Mass := 1.0E-04;  -- deci 
>    g   : constant Mass := 1.0E-03;  -- gram 
>    dag : constant Mass := 1.0E-02;  -- deka 
>    hg  : constant Mass := 1.0E-01;  -- hecto 
>    Meg : constant Mass := 1.0E+03;  -- mega 
 
Thank you for your explanation. 

A. Vo



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-04 17:26 Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) Anh Vo
  2014-02-04 17:44 ` adambeneschan
  2014-02-04 18:19 ` Ludovic Brenta
@ 2014-02-05  7:44 ` Yannick Duchêne (Hibou57)
  2014-02-05  9:30   ` AdaMagica
  2 siblings, 1 reply; 9+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2014-02-05  7:44 UTC (permalink / raw)


Le Tue, 04 Feb 2014 18:26:05 +0100, Anh Vo <anhvofrcaus@gmail.com> a écrit:

> The Kilogram constants defined in package System.Dim.Other_Prefixes  
> (s-dmotpr.ads) look different compared to others such as Meter,  
> Second,... In addition, the values do not match with names in the  
> comments on the right side. I would like to know why. By the way, the  
> Meter, Kilogram and Second constant are repeated here for easy  
> discussion.
>
>    --  SI prefixes for Meter
>
>    pragma Warnings (Off);
>    --  Turn off the all the dimension warnings
>
>    ym  : constant Length := 1.0E-24;  -- yocto
>    zm  : constant Length := 1.0E-21;  -- zepto
>    am  : constant Length := 1.0E-18;  -- atto
>    […]

Excuse me, is this GNAT specific? I can't find this in the RM. If this is  
in the RM, then I did not knew there was such a package in System.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: Epigrams on Programming — Alan J. — P. Yale University


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads)
  2014-02-05  7:44 ` Yannick Duchêne (Hibou57)
@ 2014-02-05  9:30   ` AdaMagica
  0 siblings, 0 replies; 9+ messages in thread
From: AdaMagica @ 2014-02-05  9:30 UTC (permalink / raw)


This is a GNAT specific use of Ada's new attribute feature. It's a quite ingenious way to program with SI unit checking. Search for "GNAT and Dimension Checking" in CLA for my original post. Alas there wasn't a lot of reaction. The method has substantially improved since, but still has some deficiencies.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-05  9:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-04 17:26 Kilogram constant defined in package System.Dim.Other_Prefixes (s-dmotpr.ads) Anh Vo
2014-02-04 17:44 ` adambeneschan
2014-02-04 18:10   ` G.B.
2014-02-04 18:16     ` adambeneschan
2014-02-04 18:22       ` adambeneschan
2014-02-04 18:19 ` Ludovic Brenta
2014-02-04 19:44   ` Anh Vo
2014-02-05  7:44 ` Yannick Duchêne (Hibou57)
2014-02-05  9:30   ` AdaMagica

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox