comp.lang.ada
 help / color / mirror / Atom feed
From: R_Tim_Coslet@cup.portal.com
Subject: Re: Types with physical dimension
Date: Thu, 29 Sep 94 19:06:39 PDT
Date: 1994-09-29T19:06:39-07:00	[thread overview]
Message-ID: <123813@cup.portal.com> (raw)
In-Reply-To: 36bss8$79@gnat.cs.nyu.edu

>"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



  reply	other threads:[~1994-09-30  2:06 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-09-27 22:18 Types with physical dimension Paul Graham
1994-09-28 13:59 ` Robert Dewar
1994-09-30  2:06   ` R_Tim_Coslet [this message]
1994-10-03 17:31 ` Stephen A. Leake
1994-10-04 11:51   ` Robert I. Eachus
1994-10-04 19:45     ` Mark A Biggar
     [not found]       ` <CxBBx8.7L@irvine.com>
1994-10-13 22:15         ` gamache
1994-10-12  3:43     ` Matt Kennel
1994-10-04 14:56   ` Robert Dewar
1994-10-05 14:53     ` Bob Gilbert
1994-10-05  8:38   ` Jean-Pierre Rosen
1994-10-05 10:35     ` Stephen J Bevan
1994-10-05 13:17       ` Jean-Pierre Rosen
1994-10-05 15:48     ` Norman H. Cohen
  -- strict thread matches above, loose matches on Subject: below --
1994-09-28 10:55 Simtel20 Transfer
1994-09-28 18:56 ` Mark A Biggar
1994-10-04  2:06 ` lmiller
     [not found] <GRAHAM.94Sep27181841@canopus.clsi.com>
1994-09-28 17:36 ` William Brennan
1994-09-28 21:41 ` Tucker Taft
1994-09-29  4:11   ` Robert Dewar
1994-09-29 11:19     ` Peter Hermann
1994-09-30 10:17       ` Dr John Stockton
1994-10-03  4:37       ` Robert Dewar
1994-09-29 13:37     ` Tucker Taft
1994-10-03  4:40       ` Robert Dewar
1994-09-28 19:28 Paul Pukite
replies disabled

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