From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc4f25d878383cc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-14 14:01:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!ppp-1-68.cvx6.telinco.NET!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: Dimensionality Checking (Ada 20XX) Date: Fri, 14 Dec 2001 22:01:23 -0000 Message-ID: <9vdsrj$emno3$1@ID-25716.news.dfncis.de> References: <11bf7180.0112070815.2625851b@posting.google.com> <9v0crt$bo2bi$1@ID-25716.news.dfncis.de> <9v37rs$cdmva$1@ID-25716.news.dfncis.de> <3c17210a.3970375@News.CIS.DFN.DE> <3C18DF39.9BB2F868@mail.chem.sc.edu> <3c19c13f.3311687@News.CIS.DFN.DE> NNTP-Posting-Host: ppp-1-68.cvx6.telinco.net (212.1.156.68) X-Trace: fu-berlin.de 1008367284 15425283 212.1.156.68 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Xref: archiver1.google.com comp.lang.ada:17932 Date: 2001-12-14T22:01:23+00:00 List-Id: Dmitry, you're an absolute gem! It's worth a thousand "well I reckon"s to actually produce the proof. I have been doing a bit of reading up on dimensionsal analysis, and from what I can tell from 'the texts', any and all exponentiations and logarithms are dimensionless, and their arguments must be dimensionless (of dimensions all 0). So, the expression Exp(X) is dimensionless, and X must be (checked to be) dimensionless. Ditto for Log(X). The same is also true for the trigonometric functions. I recall someone posting in this thread suggesting, in effect, that the same is also true for square root; I'd like this confirmed. So, may I first apologise for the confusion I seem to sow in my wake like a talented double-glazing salesman. Secondly, I suppose the standard package Ada.Numerics.Generic_Elementary_Functions could and should check (upon instantiation) that the generic parameter type Float_Type is either dimensionless or not unit-specific. Am I correct in assuming that the Cycle parameter must always be dimensionless? I have accepted the idea of units being applicable to floating point types, as well as fixed point types, with the concern that unit-specific floating point types are (more) liable to abuse. Am I right that Ada.Numerics.Float_Random.Uniformly_Distributed should not be unit-specific? As a slightly separate issue, is there any merit in the idea of adding standard packages that provide Log, Exp, sin, Cos, Tan, etc. for fixed point types? -- Best wishes, Nick Roberts