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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM 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!postnews.google.com!j27g2000cwj.googlegroups.com!not-for-mail From: "frikk" Newsgroups: comp.lang.ada Subject: Re: Unsigned Integer Restraint Errors Date: 13 Mar 2007 08:31:33 -0700 Organization: http://groups.google.com Message-ID: <1173799893.510392.45910@j27g2000cwj.googlegroups.com> 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> NNTP-Posting-Host: 12.129.98.129 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1173799898 27570 127.0.0.1 (13 Mar 2007 15:31:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 13 Mar 2007 15:31:38 +0000 (UTC) In-Reply-To: <1173797935.875023.7590@p10g2000cwp.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 TRY0PX01 Complaints-To: groups-abuse@google.com Injection-Info: j27g2000cwj.googlegroups.com; posting-host=12.129.98.129; posting-account=192wHg0AAAAzciSzoZsEBI9bw5pVCopO Xref: g2news1.google.com comp.lang.ada:14511 Date: 2007-03-13T08:31:33-07:00 List-Id: 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); > > 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. > > Any suggestions? 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... But this would mean that the (1/2) is being converted to an Int - which would be 0. anything ^ 0 = 1, and 1+1 = 2. So there, I know why it is happening. But how else can I compute a square root? Blaine