From: "frikk" <frikker@gmail.com>
Subject: Re: Unsigned Integer Restraint Errors
Date: 14 Mar 2007 07:06:56 -0700
Date: 2007-03-14T07:06:56-07:00 [thread overview]
Message-ID: <1173881216.461609.273200@n59g2000hsh.googlegroups.com> (raw)
In-Reply-To: <1173804176.860500.227030@n33g2000cwc.googlegroups.com>
On Mar 13, 12:42 pm, "Adam Beneschan" <a...@irvine.com> wrote:
> On Mar 13, 9:41 am, "Adam Beneschan" <a...@irvine.com> wrote:
>
> > On Mar 13, 9:04 am, "Adam Beneschan" <a...@irvine.com> wrote:
>
> > > By the way, if I were going to write a loop that goes from 2 to
> > > sqrt(n)/2 + 1, I wouldn't use Sqrt like this:
>
> > > for I in 2 .. Integer(Float'Floor(Sqrt(Float(N))/2.0)) + 1 loop...
>
> > > but rather, I'd just write it something like this:
>
> > > I := 2;
> > > while (2 * I - 1) * (2 * I - 1) <= N loop -- I think I got this
> > > right
>
> > No, I didn't. Jeff did. I must have read (sqrt(n)+1)/2 or
> > something. Oops.
>
> Ooops again---I meant Dmitry, not Jeff. Wow, I'm off to a really good
> start today.
>
> -- Adam
It seems we're all a little bit fuzzy - I actually mean sqrt(n)+1 ...
why I put sqrt(n)/2+1 is beyond me.
Thank you for the great information everyone. I like the idea of
doing the integer arithmetic better than the square root anyway.
I ended up doing this:
I = 2;
while (I)*(I) <= N loop
... I = I+1;
Thanks!
Blaine
next prev parent reply other threads:[~2007-03-14 14:06 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
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 [this message]
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