Changeset: 9eadb74d71c5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9eadb74d71c5
Modified Files:
        gdk/gdk_aggr.c
Branch: Jul2017
Log Message:

Force evaluation order.
For some reason, the 32-bit version on Fedora didn't do it the way we wanted.


diffs (28 lines):

diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -2800,7 +2800,8 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e,
                                nils++;
                        } else {
                                /* round *down* to nearest integer */
-                               qindex = r + p - (BUN) (p + 0.5 - (p - r - 1) * 
quantile);
+                               double f = (p - r - 1) * quantile;
+                               qindex = r + p - (BUN) (p + 0.5 - f);
                                /* be a little paranoid about the index */
                                assert(qindex >= r && qindex <  p);
                                v = BUNtail(bi, qindex);
@@ -2855,11 +2856,13 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e,
                        v = nil;
                        nils++;
                } else {
+                       double f;
                        bi = bat_iterator(b);
                        /* round (p-r-1)*quantile *down* to nearest
                         * integer (i.e., 1.49 and 1.5 are rounded to
                         * 1, 1.51 is rounded to 2) */
-                       index = r + p - (BUN) (p + 0.5 - (p - r - 1) * 
quantile);
+                       f = (p - r - 1) * quantile;
+                       index = r + p - (BUN) (p + 0.5 - f);
                        if (ords)
                                index = ords[index] - b->hseqbase;
                        else
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to