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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b2923d60cb81694b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Unsigned Integer Restraint Errors Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1173712032.183064.264340@8g2000cwh.googlegroups.com> <1173726806.656979.305660@8g2000cwh.googlegroups.com> <1173787790.826099.287610@s48g2000cws.googlegroups.com> <1173797935.875023.7590@p10g2000cwp.googlegroups.com> <1173799893.510392.45910@j27g2000cwj.googlegroups.com> Date: Tue, 13 Mar 2007 17:18:07 +0100 Message-ID: NNTP-Posting-Date: 13 Mar 2007 17:18:07 CET NNTP-Posting-Host: 9df5ca87.newsspool1.arcor-online.net X-Trace: DXC=gfBRmGo_9;n>jlK2>IgHGdic==]BZ:afn4Fo<]lROoRaFl8W>\BH3Yb@Z8ZjK:PimfDNcfSJ;bb[eFCTGGVUmh?dLK[5LiR>kgbd_gfQ:0k\Ii X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:14516 Date: 2007-03-13T17:18:07+01:00 List-Id: On 13 Mar 2007 08:31:33 -0700, frikk wrote: > On Mar 13, 10:58 am, "frikk" wrote: >> I have a bit of an unrelated (but kind of related) question: >> >> Are there any builtin square root functions? I thought this was >> working, but I don't think it is anymore: >> m := Integer(100**(0.5)+1); See A.5.1 Ada.Numerics.Elementary_Functions it has sqrt and ** with the right argument of Float. >> This always coming out to 2. I;m using this to computer a maximum loop >> value for finding primes. I'd like to loop from 2 to sqrt(n)/2 + 1. Actually, you don't need sqrt for this, and alternative could be do loop until the loop index I is such that I <= sqrt(n)/2+1 which is equivalent to I := 2; while 4*(I-1)*(I-1) <= n loop ... I := I + 1; end loop; > Actually I need to specify - I really used (1/2), not (0.5). I'm not > sure how that got in the code I posted... The code you provided is illegal. In Ada you cannot mix types. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de