The R Project SVN R

Rev

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

Rev 73094 Rev 75182
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995-2017  The R Core Team
3
 *  Copyright (C) 1995-2018  The R Core Team
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 66... Line 66...
66
# define attribute_hidden
66
# define attribute_hidden
67
#endif
67
#endif
68
 
68
 
69
attribute_hidden
69
attribute_hidden
70
double R_pretty(double *lo, double *up, int *ndiv, int min_n,
70
double R_pretty(double *lo, double *up, int *ndiv, int min_n,
-
 
71
		double shrink_sml,
71
		double shrink_sml, double high_u_fact[],
72
		const double high_u_fact[],
-
 
73
		// (h, h5) = c(high.u.bias, u5.bias) in base::pretty.default()
72
		int eps_correction, int return_bounds)
74
		int eps_correction, int return_bounds)
73
{
75
{
74
/* From version 0.65 on, we had rounding_eps := 1e-5, before, r..eps = 0
76
/* From version 0.65 on, we had rounding_eps := 1e-5, before, r..eps = 0
75
 * then, 1e-7 was consistent with seq.default() and seq.int() till 2010-02-03,
77
 * then, 1e-7 was consistent with seq.default() and seq.int() till 2010-02-03,
76
 * where it was changed to 1e-10 for seq*(), and in 2017-08-14 for pretty(): */
78
 * where it was changed to 1e-10 for seq*(), and in 2017-08-14 for pretty(): */
Line 179... Line 181...
179
	*ndiv = min_n;
181
	*ndiv = min_n;
180
    }
182
    }
181
    else {
183
    else {
182
	*ndiv = k;
184
	*ndiv = k;
183
    }
185
    }
184
    if(return_bounds) { /* if()'s to ensure that result covers original range */
186
    if(return_bounds) {// used in pretty.default(), ensure result covers original range
185
	if(ns * unit < *lo) *lo = ns * unit;
187
	if(ns * unit < *lo) *lo = ns * unit;
186
	if(nu * unit > *up) *up = nu * unit;
188
	if(nu * unit > *up) *up = nu * unit;
187
    } else {
189
    } else { // used in graphics GEpretty()
188
	*lo = ns;
190
	*lo = ns;
189
	*up = nu;
191
	*up = nu;
190
    }
192
    }
191
#ifdef DEBUGpr
193
#ifdef DEBUGpr
192
    REprintf("\t ns=%.0f ==> lo=%g\n", ns, *lo);
194
    REprintf("\t ns=%.0f ==> lo=%g\n", ns, *lo);