The R Project SVN R

Rev

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

Rev 73166 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) 2001-2017  The R Core Team.
3
 *  Copyright (C) 2001-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 2355... Line 2355...
2355
		    2, /* do eps_correction in any case */
2355
		    2, /* do eps_correction in any case */
2356
		    0 /* return (ns,nu) in  (lo,up) */);
2356
		    0 /* return (ns,nu) in  (lo,up) */);
2357
    // The following is ugly since it kind of happens already in R_pretty(..):
2357
    // The following is ugly since it kind of happens already in R_pretty(..):
2358
#define rounding_eps 1e-10 /* <- compatible to seq*(); was 1e-7 till 2017-08-14 */
2358
#define rounding_eps 1e-10 /* <- compatible to seq*(); was 1e-7 till 2017-08-14 */
2359
    if(nu >= ns + 1) {
2359
    if(nu >= ns + 1) {
-
 
2360
	int mod = 0;
2360
	if(               ns * unit < *lo - rounding_eps*unit)
2361
	if(               ns * unit < *lo - rounding_eps*unit) { ns++; mod++; }
2361
	    ns++;
-
 
2362
	if(nu > ns + 1 && nu * unit > *up + rounding_eps*unit)
2362
	if(nu > ns + 1 && nu * unit > *up + rounding_eps*unit) { nu--; mod++; }
2363
	    nu--;
-
 
2364
	*ndiv = (int)(nu - ns);
2363
	if(mod) *ndiv = (int)(nu - ns);
2365
    }
2364
    }
2366
    *lo = ns * unit;
2365
    *lo = ns * unit;
2367
    *up = nu * unit;
2366
    *up = nu * unit;
2368
#ifdef non_working_ALTERNATIVE
2367
#ifdef non_working_ALTERNATIVE
2369
    if(ns * unit > *lo)
2368
    if(ns * unit > *lo)