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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,791ecb084fdaba75 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-30 12:51:18 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!usc!nic-nac.CSU.net!charnel.ecst.csuchico.edu!olivea!decwrl!svc.portal.com!portal!cup.portal.com!R_Tim_Coslet From: R_Tim_Coslet@cup.portal.com Newsgroups: comp.lang.ada Subject: Re: Types with physical dimension Message-ID: <123813@cup.portal.com> Date: Thu, 29 Sep 94 19:06:39 PDT Organization: The Portal System (TM) References: <36bss8$79@gnat.cs.nyu.edu> Date: 1994-09-29T19:06:39-07:00 List-Id: >"What do Ada programmers do to guard against dimensional errors" > >Probably not much, because in practice, at least in my experience, such >errors are rare, although they are an obvious target for theoretical >discussions. When is 0 multiplied by 0 equal to 4 million? When a programmer dropped an equation from a data sheet directly into the code, without thinking that the equation used units of volts but the A/D converter supplying the numbers has some "arbitrary" unit scaling and is offset binary instead of twos complement. Example: 0V = 2048 A/D converter units. Therfore 0V * 0V = about 4 million. Admitedly not directly related to the current subject, but does illustrate a case of a problem with processing real world physical data without thinking the units and scaling thru... At least Ada reported constraint errors instead of just scrambling the result and giving a totally inexplicable wrong answer like Certain other languages would :-) R. Tim Coslet Usenet: R_Tim_Coslet@cup.portal.com technology, n. domesticated natural phenomena