From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Unsigned Integer Restraint Errors
Date: Tue, 13 Mar 2007 17:18:07 +0100
Date: 2007-03-13T17:18:07+01:00 [thread overview]
Message-ID: <fuqnh9incz49.1af4cywjgimq3.dlg@40tude.net> (raw)
In-Reply-To: 1173799893.510392.45910@j27g2000cwj.googlegroups.com
On 13 Mar 2007 08:31:33 -0700, frikk wrote:
> On Mar 13, 10:58 am, "frikk" <frik...@gmail.com> 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
next prev parent reply other threads:[~2007-03-13 16:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-12 15:07 Unsigned Integer Restraint Errors frikk
2007-03-12 16:27 ` Georg Bauhaus
2007-03-12 17:17 ` Adam Beneschan
2007-03-12 17:23 ` Adam Beneschan
2007-03-12 18:11 ` frikk
2007-03-12 20:00 ` frikk
2007-03-12 20:07 ` Adam Beneschan
2007-03-12 18:00 ` Dmitry A. Kazakov
2007-03-12 19:00 ` Martin Krischik
2007-03-12 21:13 ` Dmitry A. Kazakov
2007-03-12 19:13 ` frikk
2007-03-12 19:22 ` Randy Brukardt
2007-03-13 3:13 ` Jeffrey R. Carter
2007-03-13 3:00 ` Randy Brukardt
2007-03-13 12:09 ` frikk
2007-03-13 14:58 ` frikk
2007-03-13 15:31 ` frikk
2007-03-13 15:59 ` Robert A Duff
2007-03-13 16:18 ` Dmitry A. Kazakov [this message]
2007-03-13 16:21 ` Jeffrey R. Carter
2007-03-13 16:04 ` Adam Beneschan
2007-03-13 16:41 ` Adam Beneschan
2007-03-13 16:42 ` Adam Beneschan
2007-03-14 14:06 ` frikk
2007-03-13 17:23 ` Dmitry A. Kazakov
2007-03-13 17:31 ` Adam Beneschan
2007-03-14 0:54 ` Jeffrey R. Carter
2007-03-16 13:38 ` frikk
2007-03-13 16:16 ` Jeffrey R. Carter
2007-03-12 21:04 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox