bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] [PATCH] remove unnecessary check in randist/sphere.c


From: Alexei Podtelezhnikov
Subject: [Bug-gsl] [PATCH] remove unnecessary check in randist/sphere.c
Date: Tue, 20 Apr 2004 19:55:25 -0700 (PDT)

The check s == 0.0 is not necessary and was probably intruduced as a 
result of code duplication. There will be no errors without it. Please 
consider.

--- randist/sphere.c.jj 2004-04-20 19:44:59.000000000 -0700
+++ randist/sphere.c    2004-04-20 19:46:39.000000000 -0700
@@ -81,7 +81,7 @@
       *y = -1 + 2 * gsl_rng_uniform (r);
       s = (*x) * (*x) + (*y) * (*y);
     }
-  while (s > 1.0 || s == 0.0);
+  while (s > 1.0);
 
   *z = -1 + 2 * s;              /* z uniformly distributed from -1 to 1 */
   a = 2 * sqrt (1 - s);         /* factor to adjust x,y so that x^2+y^2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]