TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Proportional Font
Show HTML Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Rick Duley <[log in to unmask]>
Reply To:
Rick Duley <[log in to unmask]>
Date:
Thu, 20 Jun 2002 10:15:16 +0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (42 lines)
Hi Teamers
I am working with a procedure which involves a nested loop.  The index
of the inner loop is defined as the square root of the current value of
the index of the outer loop like this:

Outer_Loop:
   for Outer in This_Value .. That_Value loop
   Inner_Loop:
      for Inner in Lower_Limit ..
                      Integer(Sqrt.(Float.Outer)) loop
         Blah;
         Blah;
         Blah;
      end loop Inner_Loop;
   end loop Outer_Loop;

Does Ada require evaluation of the upper limit at each iteration of the
inner loop or is the square root function (with the attendant coercions)
only called once?

Thanks in advance for the help
and I hope no-one's caught in the bushfires
Nasty things those

Cheers

---------------------------------------------------------

Rick Duley
School of Computing and Information Science
Edith Cowan University
2 Bradford St, Mt Lawley
Perth, Western Australia
tel: +61 8 9370 6619
fax: +61 8 9370 6100
mob: +61 040 910 6049                            /-_|\
                                                /     \
                                          perth *_.-._/
Experience is the worst of teachers                  v
          It gives you the exam
                        before it gives you the lecture

ATOM RSS1 RSS2