comp.lang.ada
 help / color / mirror / Atom feed
From: David Kristola <David95037@See-My.Sig>
Subject: Re: Reuseable Scientific Types Package
Date: 2000/07/12
Date: 2000-07-12T00:00:00+00:00	[thread overview]
Message-ID: <01HW.B5917CD403727A5405DE478C@news.pacbell.net> (raw)
In-Reply-To: 396A373A.1B80329F@lmco.com

On Mon, 10 Jul 2000 13:51:06 -0700, Howard W. LUDWIG wrote
(in message <396A373A.1B80329F@lmco.com>):

> David Kristola wrote:
>> A third option...
>> 
>> I too needed types with units.  With a little bit of work, i created a
>> program to auto-generate a types package with appropriate operators for
>> all of the types needed (an extensive list, which caused the number of
>> operators to explode).

{snip}

> Bill Whitaker certainly realized this when he participated
> in revising IEEE-Std. 1226, a project that became known as
> P1446.  His work on the original 1226 used the Kristola
> approach, which he regarded as manageable at the time.
> By the time P1446 rolled around, it became clear to Bill
> that one could never set up enough types and operators,
> so he switched over to something closer to the Pat Rogers
> approach.  (Ref. the index page
> http://users.erols.com/whitaker/
> and see metric.sty that led to IEEE-Std.1226; as well as
> iss_418.htm and si_cmts.txt that describe the adjusted
> approach used in the update P1446, which never made it
> past the draft stage.)

I will take a look at the document, thanks!

I was not looking to make reusable software when i cam up
with the idea.  Reuse is not within our scope.  Our schedule
is very tight, and we are not being paid to produce a
reusable product.

I think the idea of having a code generator might be reusable.
A user could enter in the set of types she is interested in
and produce a types package with just those types.  Any
individual project is likely to be limited in the units that
are important.

{Snip}

>> type Unitless_Type is new Interfaces.IEEE_Float_32;
>> subtype Radians_Type is Unitless_Type;
>> --...
>> type Per_Seconds_Type is new Unitless_Type;
>> subtype Radians_Per_Seconds_Type is Per_Seconds_Type;
> 
> It is true that the radian is a dimensionless unit (meaning
> it has dimensions of 1, sometimes expressed in the non-reduced
> form m/m, based on its definition), but "per second" is
> certainly not "unitless", nor is "radians per second".
> Is the information given above simply incomplete and you
> are deriving all (including Meters_Type, etc.) of your unit
> types from "Unitless_Type", or am I missing something else?

I think you are missing something.  Per_Seconds_Type is a
*new* type based on Unitless_Type.  Any good compiler will
optimize away any machine code for a type convert from one
to the other, but you can't add them together without a
type convert.

{Snip}

>> I am also playing with some ideas for a possible language extension.
>> This is one area where more power could be added to the language.  Much
>> of the unit checking can be done at compile time.  How bad does something
>> like this look?
>> 
>> type Unitless_Type is digits 6 with (Meters, Kilograms, Seconds);
> 
> Don't forget the other 4 base units in SI (ampere, kelvin,
> mole, candela).  Also, there are people who, in spite of all
> the good reasons to use [only] SI, still use such abominations
> as feet and pounds; most throw in at least the multiples and
> submltiples of SI units such as kilometer and gram.  The best
> mechanism will allow for those as well.

I was just giving an example.  I would have used Klingon
units if i knew what they were.  The idea is to have a user
defined list of units that accompany the type.  I have not
spent as much time thinking about the idea as i would like.
It needs some more thought before i write up a description.
For instance, before this thread, i had not considered
fractional powers.



-- 
--djk, keeper of arcane lore & trivial fluff
Home: David95036 plus 1 at america on-line
Spam: goto.hades@welovespam.com





       reply	other threads:[~2000-07-12  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3963A48E.6A2AF132@gbr.msd.ray.com>
     [not found] ` <JpR85.123$R31.66951@nnrp2.sbc.net>
     [not found]   ` <39646F40.A8277C4E@linuxchip.demon.co.uk>
     [not found]     ` <01HW.B58C5C88023DF64C05DE478C@news.pacbell.net>
     [not found]       ` <396A373A.1B80329F@lmco.com>
2000-07-12  0:00         ` David Kristola [this message]
2000-07-12  0:00           ` Reuseable Scientific Types Package Brian Rogoff
2000-07-13  0:00             ` David Kristola
replies disabled

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