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,6d79efdb8dde2c5a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news.k-dsl.de!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: SPARK : third example for Roesetta - reviewers welcome Date: Sun, 15 Aug 2010 22:07:44 +0200 Organization: Ada At Home Message-ID: References: <589eea9a-0b14-4ae5-bf62-9abf4b33e7fb@i31g2000yqm.googlegroups.com> NNTP-Posting-Host: RZkTY5NyuNCeyE5VNfPAfQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.61 (Win32) Xref: g2news1.google.com comp.lang.ada:13360 Date: 2010-08-15T22:07:44+02:00 List-Id: Le Sun, 15 Aug 2010 20:42:27 +0200, Phil Thornley = a =C3=A9crit: > in http://www.sparksure.com/resources/Rosetta_Binary_Search.txt > else > -- Switch to lower half subrange. > Upper :=3D Position - 1; > Position :=3D (Lower + Upper) / 2; -- <<< > end if; >-- [...] >else > -- For "Middle <=3D Upper" in loop assertion. > -- Switch to upper half subrange. > Lower :=3D Position + 1; > Position :=3D (Lower + Upper) / 2; -- <<< > end if; Interesting to note: you moved =E2=80=9CPosition :=3D (Lower + Upper) / = 2;=E2=80=9D inside = logical branch, I suppose to ease prove, as the instruction is right in = a = context which makes its validity more obvious. This is indeed better tha= n = the idea of the factorization I used. This topic makes me think about the latter about the Middle variable = turned into a direct use of Position. May be I did "automatic useless = optimization" here. That is funny, because it happens I do the same (that is why I suppose I= = was not so good here due to a kind of "inappropriate automation").