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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9742b7560760142d X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!out01a.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny02.POSTED!0e8a908a!not-for-mail From: Hyman Rosen User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: WG: SI Units - has Ada missed the boat? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Tue, 10 Jul 2007 01:26:08 GMT NNTP-Posting-Host: 68.237.114.64 X-Complaints-To: abuse@verizon.net X-Trace: trndny02 1184030768 68.237.114.64 (Mon, 09 Jul 2007 21:26:08 EDT) NNTP-Posting-Date: Mon, 09 Jul 2007 21:26:08 EDT Xref: g2news1.google.com comp.lang.ada:16441 Date: 2007-07-10T01:26:08+00:00 List-Id: Grein, Christoph (Fa. ESG) wrote: > I don't know C++ and so I do not know how it deals mit rad, Newton > Meters and Joule in > > Work [Joule] = Torque [Newton*Meter] * Angle [rad] > > Or sin x = x + x**3/3! + ... where x is in rad, sin x has dimension 1 > (not rad). > > Or Bq = 1/s, Hz = 1/s, but Bq /= Hz. Here's a description of implementing units using the Boost Metaprogramming Library. I expect that most C++ implementations will follow the rule that 90% of the way is enough, and not bother with radians or trying to distinguish between becquerel and hertz or Fahrenheit, Celsius, and Kelvin. But if someone wants to go the whole way, they can do it. It's just a matter of writing more complicated combining rules for the templates. And none of it has any runtime overhead at all - objects of dimensioned types take no more space than plain numbers.