+static double
+rank_rfraction (double c, double cc, double cc_1,
+ int i, double w)
+{
+ return rank_rank (c, cc, cc_1, i, w) / w ;
+}
+
+
+static double
+rank_percent (double c, double cc, double cc_1,
+ int i, double w)
+{
+ return rank_rank (c, cc, cc_1, i, w) * 100.0 / w ;
+}
+
+
+static double
+rank_proportion (double c, double cc, double cc_1,
+ int i, double w)
+{
+ const double r = rank_rank (c, cc, cc_1, i, w) ;
+
+ double f;
+
+ switch ( cmd.fraction )
+ {
+ case RANK_BLOM:
+ f = (r - 3.0/8.0) / (w + 0.25);
+ break;
+ case RANK_RANKIT:
+ f = (r - 0.5) / w ;
+ break;
+ case RANK_TUKEY:
+ f = (r - 1.0/3.0) / (w + 1.0/3.0);
+ break;
+ case RANK_VW:
+ f = r / ( w + 1.0);
+ break;
+ default:
+ NOT_REACHED ();
+ }
+
+
+ return (f > 0) ? f : SYSMIS;
+}
+
+static double
+rank_normal (double c, double cc, double cc_1,
+ int i, double w)
+{
+ double f = rank_proportion (c, cc, cc_1, i, w);
+
+ return gsl_cdf_ugaussian_Pinv (f);
+}
+
+static double
+rank_ntiles (double c, double cc, double cc_1,
+ int i, double w)
+{
+ double r = rank_rank (c, cc, cc_1, i, w);
+
+
+ return ( floor (( r * k_ntiles) / ( w + 1) ) + 1);
+}
+
+/* Expected value of the order statistics from an exponential distribution */
+static double
+ee (int j, double w_star)
+{
+ int k;
+ double sum = 0.0;
+
+ for (k = 1 ; k <= j; k++)
+ sum += 1.0 / ( w_star + 1 - k );
+
+ return sum;
+}
+
+
+static double
+rank_savage (double c, double cc, double cc_1,
+ int i UNUSED, double w)
+{
+ double int_part;
+ const int i_1 = floor (cc_1);
+ const int i_2 = floor (cc);
+
+ const double w_star = (modf (w, &int_part) == 0 ) ? w : floor (w) + 1;
+
+ const double g_1 = cc_1 - i_1;
+ const double g_2 = cc - i_2;
+
+ /* The second factor is infinite, when the first is zero.
+ Therefore, evaluate the second, only when the first is non-zero */
+ const double expr1 = (1 - g_1) ? (1 - g_1) * ee(i_1+1, w_star) : ( 1 - g_1);
+ const double expr2 = g_2 ? g_2 * ee (i_2+1, w_star) : g_2 ;
+
+ if ( i_1 == i_2 )
+ return ee (i_1 + 1, w_star) - 1;
+
+ if ( i_1 + 1 == i_2 )
+ return ( ( expr1 + expr2 )/c ) - 1;
+
+ if ( i_1 + 2 <= i_2 )