edrikL / gears

Automatically exported from code.google.com/p/gears
2 stars 3 forks source link

A minor bug on the primes.html in the sample. #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Please provide any additional information below.

The algorithm to compute the prime has a minor bug. The upper limit probe
should be open. See the diff for details.

sishen@sishen:~/public_html/p10n$ svn diff primes.html 
Index: primes.html
===================================================================
--- primes.html (revision 88)
+++ primes.html (working copy)
@@ -67,7 +67,7 @@
 function Generator() {
   function isPrime(probe) {
     if (probe % 2 == 0) return false;
-    for (var factor = 3; factor * factor < probe; factor += 2) {
+    for (var factor = 3; factor * factor <= probe; factor += 2) {
       if (probe % factor == 0) return false;
     }
     return true;

Original issue reported on code.google.com by YeDingd...@gmail.com on 26 Jun 2007 at 3:35

GoogleCodeExporter commented 9 years ago
Indeed!

Original comment by Scott.Hess on 26 Jun 2007 at 3:39

GoogleCodeExporter commented 9 years ago

Original comment by gears.te...@gmail.com on 26 Jun 2007 at 5:14

GoogleCodeExporter commented 9 years ago
QA: QA cannot test it. Marked as fixed in Gears v53. 
The owner please verify in Gears V53 and comment. (close or re-open)

Original comment by lusvit...@gmail.com on 10 Jul 2007 at 7:55

GoogleCodeExporter commented 9 years ago

Original comment by gears.te...@gmail.com on 10 Jul 2007 at 10:14

GoogleCodeExporter commented 9 years ago

Original comment by gears.te...@gmail.com on 10 Jul 2007 at 10:40

GoogleCodeExporter commented 9 years ago

Original comment by othman@gmail.com on 5 Sep 2007 at 7:33