The R Project SVN R

Rev

Rev 64249 | Rev 64656 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64249 Rev 64252
Line 657... Line 657...
657
	    if (!R_FINITE(ds)) {
657
	    if (!R_FINITE(ds)) {
658
		if (ds > INT_MAX) int_ok = FALSE;
658
		if (ds > INT_MAX) int_ok = FALSE;
659
		cnt++;
659
		cnt++;
660
	    } else if ((R_xlen_t) ds != 0) cnt++;
660
	    } else if ((R_xlen_t) ds != 0) cnt++;
661
#else
661
#else
662
	    if (R_FINITE(ds) && ds > INT_MAX) 
662
	    if (R_FINITE(ds) && ds > INT_MAX) int_ok = FALSE;
663
		int_ok = FALSE;
-
 
664
	    // FIXME: what about non-finite values?
-
 
665
	    if ((R_xlen_t) ds != 0) cnt++;
663
	    if (!R_FINITE(ds) || (R_xlen_t) ds != 0) cnt++;
666
#endif
664
#endif
667
	}
665
	}
668
	if (int_ok) {
666
	if (int_ok) {
669
	    indx = allocVector(INTSXP, cnt);
667
	    indx = allocVector(INTSXP, cnt);
670
	    for (i = 0, cnt = 0; i < ns; i++) {
668
	    for (i = 0, cnt = 0; i < ns; i++) {
Line 675... Line 673...
675
		if (ia != 0) INTEGER(indx)[cnt++] = ia;
673
		if (ia != 0) INTEGER(indx)[cnt++] = ia;
676
	    }
674
	    }
677
	} else {
675
	} else {
678
	    indx = allocVector(REALSXP, cnt);
676
	    indx = allocVector(REALSXP, cnt);
679
	    for (i = 0, cnt = 0; i < ns; i++) {
677
	    for (i = 0, cnt = 0; i < ns; i++) {
680
		// FIXME: what about non-finite values?
-
 
681
		R_xlen_t ia = (R_xlen_t) REAL(s)[i];
678
		double ds = REAL(s)[i];
682
		if (ia != 0) REAL(indx)[cnt++] = REAL(s)[i];
679
		if (!R_FINITE(ds) || (R_xlen_t) ds != 0) REAL(indx)[cnt++] = ds;
683
	    }
680
	    }
684
	}
681
	}
685
	return indx;
682
	return indx;
686
    }
683
    }
687
    return R_NilValue;
684
    return R_NilValue;