comp.lang.ada
 help / color / mirror / Atom feed
From: "Pascal Obry" <p.obry@der.edf.fr>
Subject: Re: Announcing JGNAT public version 1.0p
Date: 2000/04/10
Date: 2000-04-10T08:45:01+00:00	[thread overview]
Message-ID: <8cs4ad$ft3$1@clnews.edf.fr> (raw)
In-Reply-To: 8ckscp$nv7$1@nnrp1.deja.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]


<hugin777@my-deja.com> a �crit dans le message :
8ckscp$nv7$1@nnrp1.deja.com...
> In article <38ECB0CC.3B2941E2@earthlink.net>,
>   Charles Hixson <charleshixsn@earthlink.net> wrote:

Ok, now I see the problem. You did not code the same algorithm :)

Look at markMultiplum in Java you have added a first test isPrime[i] and
this is not coded in Ada, most certainly this would reduce Ada time :)

>     // This better get inlined !!
>     // (Oh, well, the compiler won't read this, will it ? :-)
>     private static void markMultiplum(int divisor, boolean[] isPrime) {
>         for (int i = divisor+1; i < isPrime.length; i++) {
>             if (isPrime[i] && i % divisor == 0) isPrime[i] = false;
>         }


>     procedure MarkMultiplum (Divisor  : in     Integer;
>                              Is_Prime : in out BoolArray) is
>     begin
>         for i in Divisor+1 .. Is_Prime'Last loop
>             if i mod Divisor = 0 then Is_Prime (i) := false; end if;
>         end loop;
>     end MarkMultiplum;

Do you mind to try with

         for i in Divisor+1 .. Is_Prime'Last loop
             if Is_Prime (i) and then i mod Divisor = 0 then Is_Prime (i) :=
false; end if;
         end loop;

And anyway this algorithm is very far from being efficient...

Pascal.

--

--|------------------------------------------------------------
--| Pascal Obry                               Team-Ada Member |
--|                                                           |
--| EDF-DER-IPN-SID- T T I                                    |
--|                       Intranet: http://cln46gb            |
--| Bureau N-023            e-mail: p.obry@der.edf.fr         |
--| 1 Av G�n�ral de Gaulle  voice : +33-1-47.65.50.91         |
--| 92141 Clamart CEDEX     fax   : +33-1-47.65.50.07         |
--| FRANCE                                                    |
--|------------------------------------------------------------
--|
--|         http://perso.wanadoo.fr/pascal.obry
--|
--|   "The best way to travel is by means of imagination"







  parent reply	other threads:[~2000-04-10  0:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-28  0:00 Announcing JGNAT Professional version 1.0a Robert Dewar
2000-03-31  0:00 ` Announcing JGNAT public version 1.0p Robert Dewar
2000-04-01  0:00   ` John Merryweather Cooper
2000-04-02  0:00     ` Robert Dewar
2000-04-02  0:00       ` John Merryweather Cooper
2000-04-03  0:00         ` Robert Dewar
2000-04-02  0:00           ` John Merryweather Cooper
2000-04-03  0:00             ` Robert Dewar
2000-04-04  0:00               ` JGNAT help puh-leeze G
2000-04-04  0:00                 ` Geoff Bull
2000-04-06  0:00                   ` G
2000-04-06  0:00                     ` Geoff Bull
2000-04-04  0:00               ` Announcing JGNAT public version 1.0p Charles Hixson
2000-04-05  0:00                 ` Geoff Bull
2000-04-05  0:00                 ` David Botton
2000-04-06  0:00                   ` Charles Hixson
2000-04-07  0:00                     ` hugin777
2000-04-07  0:00                       ` Pascal Obry
2000-04-07  0:00                       ` Robert Dewar
2000-04-07  0:00                         ` Ted Dennison
2000-04-08  0:00                           ` Geoff Bull
2000-04-08  0:00                         ` hugin777
2000-04-09  0:00                           ` Optimizing flags Was: " Ken O. Burtch
2000-04-08  0:00                         ` Geoff Bull
2000-04-08  0:00                       ` Geoff Bull
2000-04-10  0:00                       ` Pascal Obry [this message]
2000-04-10  0:00                         ` hugin777
2000-04-10  0:00                           ` David Starner
2000-04-11  0:00                             ` Brian Rogoff
2000-04-11  0:00                               ` Tucker Taft
2000-04-11  0:00                                 ` Brian Rogoff
2000-04-11  0:00                               ` David Starner
2000-04-10  0:00                           ` Al Christians
2000-04-11  0:00                           ` Pascal Obry
2000-04-12  0:00                           ` Pascal Obry
2000-04-07  0:00                     ` Geoff Bull
2000-04-03  0:00             ` Robert Dewar
2000-04-04  0:00           ` ada_95
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox