Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!ogicse!emory!hubcap!Steven From: zenith@ensmp.fr (Steven Ericsson Zenith) Newsgroups: comp.parallel Subject: Example - Errata errata... opps. Message-ID: <12909@hubcap.clemson.edu> Date: 4 Feb 91 18:47:39 GMT Sender: fpst@hubcap.clemson.edu Lines: 44 Approved: parallel@hubcap.clemson.edu Ah. Blush :-) This really will teach me to crow. Nick Carriero has kindly pointed out my deficient knowledge of C. It turns out that the program example I claimed deadlocks in it's Linda version - doesn't. My sincere apologies Nick and Dave. Nick says: First: Consider line 07. For 'me' in {2,3} limit is. (In C, assignment of a float to an int truncates the fractional part.) Second: Look at the for loop 09. For 'me' in {2,3}, the conditional fails, we skip the loop, returning 1. The tuples ("prime table", 2, 1) ("prime table", 3, 1) result. These will allow further is_prime() evals to execute. 01 is_prime(me) 02 int me; 03 { 04 int i, limit, ok; 05 double sqrt(); 06 07 limit = sqrt((double) me) + 1; 08 09 for (i = 2; i < limit; ++i) { 10 rd("primes", i, ? ok); 11 if (ok && (me%i == 0)) return 0; 12 } 13 return 1; 14 } The bounds error is there---it in fact results from an editing error. Steven -- Steven Ericsson Zenith * Email: zenith@ensmp.fr * Fax:(1)64.69.47.09 | Francais:(1)64.69.47.08 | Office:(1)64.69.48.52 Center for Research in Computer Science - Centre de Recherche en Informatique CRI - Ecole Nationale Superieure des Mines de Paris 35 rue Saint-Honore 77305 Fontainebleau France "All see beauty as beauty only because they see ugliness" LaoTzu