[R] make check and postscript output in R 1.7.1

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Jun 17 23:18:22 CEST 2003


Don MacQueen <macq at llnl.gov> writes:

> I'm sorry, I neglected to provide version information.
> 
> In fact, I see the same result from make check on two different
> systems: Solaris 2.7 and OS X 10.2.6.
> 
> The "-0.00" values in reg-plot.ps.save are the kinds of values I saw
> in postscript files generated by R 1.7.0, i.e., prior to the fix of
> PR#3132.
> 
> In particular, in his r-help message on 2003-5-29 on the topic
> "Postscript query: plotting long vectors", Peter Dalgaard noted "If
> you want to use rlineto, you need to round *before* differencing."
> Values like "-0.00" could result from rounding *after* differencing,
> could they not?

No, I don't think so. However, differencing after rounding (to two
digits) plus slightly odd formatting routines might do it. You have
the source... The logic is this:

static void PostScriptRLineTo(FILE *fp, double x0, double y0,
                              double x1, double y1)
{
    double x = rround(x1, 2) - rround(x0, 2),
        y = rround(y1, 2) - rround(y0, 2);

    if(x == 0) fprintf(fp, "0"); else fprintf(fp, "%.2f", x);
    if(y == 0) fprintf(fp, " 0"); else fprintf(fp, " %.2f", y);
    fprintf(fp, " l\n");
}

and it would seem that on some machines, rround(.,2) is not a perfect
step function, in that you can have two numbers rounded to slightly
different values.

(I see the same effect on Solaris 9, gcc 2.95.3 BTW. So you're not the
only one forgetting to platform test. It's just that our Sun is so
terribly slooooow...)
-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list