diff options
Diffstat (limited to 'src/backend/optimizer/geqo/geqo_selection.c')
-rw-r--r-- | src/backend/optimizer/geqo/geqo_selection.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/optimizer/geqo/geqo_selection.c b/src/backend/optimizer/geqo/geqo_selection.c index 92b735cb282..32a3e83ae03 100644 --- a/src/backend/optimizer/geqo/geqo_selection.c +++ b/src/backend/optimizer/geqo/geqo_selection.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_selection.c,v 1.19 2005/06/14 14:21:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_selection.c,v 1.20 2005/10/15 02:49:19 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -86,13 +86,14 @@ linear(int pool_size, double bias) /* bias is y-intercept of linear /* * If geqo_rand() returns exactly 1.0 then we will get exactly max from - * this equation, whereas we need 0 <= index < max. Also it seems possible - * that roundoff error might deliver values slightly outside the range; - * in particular avoid passing a value slightly less than 0 to sqrt(). - * If we get a bad value just try again. + * this equation, whereas we need 0 <= index < max. Also it seems + * possible that roundoff error might deliver values slightly outside the + * range; in particular avoid passing a value slightly less than 0 to + * sqrt(). If we get a bad value just try again. */ - do { - double sqrtval; + do + { + double sqrtval; sqrtval = (bias * bias) - 4.0 * (bias - 1.0) * geqo_rand(); if (sqrtval > 0.0) |