From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: GNAT and Dimension Checking
Date: Sun, 1 Jul 2012 08:18:37 -0700 (PDT)
Date: 2012-07-01T08:18:37-07:00 [thread overview]
Message-ID: <ce070528-72d3-43ef-b659-19211801faa4@googlegroups.com> (raw)
In-Reply-To: <2afdc8e6-def0-4a00-8535-4db40165fc92@googlegroups.com>
Thanks for the chapter - I just overlooked it.
The documentation, though, is rather terse. It doesn't tell you the syntax of the aspect clauses nor anything else than the most basic things.
All in all it looks promising - it's a very clever way to use the new aspects.
What I found out:
G : constant acceleration := 127137.6 * km/(hour ** 2);
Put (Sqrt (G), Aft => 2, Exp => 0); Put_Line ("");
yields 3.13 m**(1/2).s**(-1), so it handles fractional powers (at least 1/2).
Math functions except sqrt need dimensionless parameters.
However, sin (t, t0) should be allowed as long as t and t0 have the same dimension. It is not. Also arctan (x, y) is only allowed for dimensionless parameters.
We'll see how it turns out when applied to more complicated formulae, especially with those where parts have fractional dimensions (in SI, there are no items with fractional units, but intermediate ones do).
CGS cannot do without fractions.
Perhaps with some refinement, this could be a theme for Ada 2020 :-)
------------------
PS: Anyone interested in dimensional arithmetics in Ada should have a look at:
Ada Europe Conference 2003
Christoph Grein, Dmitry A. Kazakov, Fraser Wilson
A Survey of Physical Unit Handling Techniques in Ada
The conference proceedings have appeared at Springer-Verlag:
© Springer-Verlag
Jean-Pierre Rosen, Alfred Strohmeier (Eds)
Reliable Software Technologies - Ada-Europe 2003
8th Ada-Europe International Conference on Reliable Software Technologies
Toulouse, France, June 16-20, 2003
Proceedings
Lecture Notes in Computer Science, Vol. 2655, Springer-Verlag, 2003
The proceedings are also available at Springer-Verlag's web site, but you need to be a subscriber in order to read the full texts:
http://link.springer.de/link/service/series/0558/tocs/t2655.htm
or
http://link.springer-ny.com/link/service/series/0558/tocs/t2655.htm
For a quick overview, see
http://www.christ-usch-grein.homepage.t-online.de/Ada/Dimension.html
where you can also find the full paper.
Have fun :-)
next prev parent reply other threads:[~2012-07-01 15:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-01 5:53 GNAT and Dimension Checking AdaMagica
2012-07-01 6:25 ` Nasser M. Abbasi
2012-07-01 10:44 ` yogeshwarsing
2012-07-02 20:42 ` Anh Vo
2012-07-02 20:58 ` Adam Beneschan
2012-07-02 21:51 ` Anh Vo
2012-07-01 15:18 ` AdaMagica [this message]
2012-07-01 15:47 ` yogeshwarsing
2012-07-06 10:47 ` AdaMagica
2012-07-08 1:50 ` Robert A Duff
2012-07-08 10:33 ` AdaMagica
2012-07-08 11:37 ` Dmitry A. Kazakov
2012-07-08 14:13 ` AdaMagica
2012-07-08 18:47 ` Jacob Sparre Andersen
2012-07-09 11:06 ` AdaMagica
2012-07-09 8:20 ` Martin
2012-07-09 11:19 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox