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-Thread: 103376,db88d0444fafe8eb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!news.tu-darmstadt.de!news.belwue.de!newsfeed.arcor.de!news.arcor.de!not-for-mail Date: Thu, 08 Sep 2005 12:27:50 +0200 From: Georg Bauhaus User-Agent: Debian Thunderbird 1.0.2 (X11/20050817) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Surprise in array concatenation References: <1125544603.561847.32140@g47g2000cwa.googlegroups.com> <14muavojz308w.1ouv7xin79rqu$.dlg@40tude.net> <4318486f$0$24154$9b4e6d93@newsread4.arcor-online.net> <43187a50$0$24162$9b4e6d93@newsread4.arcor-online.net> <11p5i525v2q5d$.17ayuwvqhazo1.dlg@40tude.net> <431a00cb$0$2113$9b4e6d93@newsread2.arcor-online.net> <9s72daxfzb4f.1k7noh1qr5qpg.dlg@40tude.net> <431c465d$0$24150$9b4e6d93@newsread4.arcor-online.net> <79fcfodixv3k$.1m7d28joczncs$.dlg@40tude.net> <431c8c35$0$2101$9b4e6d93@newsread2.arcor-online.net> <3ufj318nkubi.a5j4dbvaofhc.dlg@40tude.net> <431d82e3$0$24147$9b4e6d93@newsread4.arcor-online.net> <431dbabc$0$24153$9b4e6d93@newsread4.arcor-online.net> <1b8825x3b8wn3.24qm946raz3d$.dlg@40tude.net> <431f2f4f$0$2102$9b4e6d93@newsread2.arcor-online.net> <3sa7ilukre24.15c984skqvm9c$.dlg@40tude.net> In-Reply-To: <3sa7ilukre24.15c984skqvm9c$.dlg@40tude.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <432011f0$0$24147$9b4e6d93@newsread4.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 08 Sep 2005 12:26:56 MEST NNTP-Posting-Host: 32f0e789.newsread4.arcor-online.net X-Trace: DXC=^^eRV3Bn:R6::C@ZGckeZ1:ejgIfPPld4jW\KbG]kaM8ea\9g\;7Nm5DQ?joBllGd2hP3YJKgE\j Dmitry A. Kazakov wrote: >>Almost no real number can be represented in a computer. > OK, it is beaten to death. The fact is quite alive. > How else you could check if 1 really refers to the physical 1! Which physical 1? There is a written agreement on what represents 1 inside a computer, per computer. As I said, math declares the swamp away into which it is built. Computer descriptions do soemthing similar. I do not usually try to write programs using funny interpretations of bits, and assume you don't either. >>When are you interested in computing the value half-way between >>the ends of a (non-numeric) enumeration type, attempting to use >>A'Length / 2? > > > Iteration algorithms in numeric analysis. Sounds more like adding rectangles or points, when X runs along the axis of discrete non-numeric enumeration values. A plausible algorithm could be binary search when the indexed values grow or shrink as the non-numeric index values grow in position. >>Can there be an index type in Ada that isn't ordered? > > > Sure: > > type Unordered_Index is (A, B, C, D); > function "<" (Left, Right : Unordered_Index) > return Boolean is abstract; I was thinking of index types that are not ordered in Ada. See below. > 1. This is plain wrong. If L=U then (L+U)/2=L. As you say, "+" isn't predefined for enumeration types. As for M and (L+U)/2 I should have said, in Ada (and other PLs) if 0 <= A'Length <= 1, then (L+U)/2 can be 0 = M, and A'Length/2 = 0, always. > (For generalizations on unordered cases see "convex hull") I'm trying to see arrays, and possible improvements. If a convex hull offers something useful in arranging memory cells and copying some of them to a CPU or I/O register, fine. (As this is what happens in the end.) > 2. M could not be computed just because "+", "/", 2 aren't defined. Then of > course there could be no order; But in fact, Ada's enumeration types are ordered. Try to make this pass Ada compilation, type Unordered_Index is (A, B, C, D); for Unordered_Index use (A => 1, B => 3, C => 2, D => 4); What does the compiler say? > 3. Note that (1) is wrong for modular types. And? > Not surprisingly, they aren't > numbers, That's news. There are numbers congruent modulo some number. But you think these numbers aren't numbers? > but classes of equivalence (sets of numbers, infinite sets, BTW, > yet representable in the computer, how strange (:-)). One equivalence class is not the same as the set of numbers mapped to members of the equivalence class. "type X is mod 10;" implies a finite set of values. Try "a: X; a := 42;" In other words, 42 cannot belong to the set of values expressed by X. Belonging and congruence are not the same thing. For example, we cannot count an absolute number of items when there are at least as many items as the modulus. Here is a representation of DK's representation of the set of real numbers inside a computer: 2#1010010# It remains to be shown how computations with real numbers are useful. > here (modular types) Ada is again not very inconsistent. I'm glad to hear this.