40 PLFLT t1, t2, tick_reasonable;
48 pldtfac( vmin, vmax, &factor, NULL );
50 *tick = *tick / factor;
57 t1 = (
PLFLT) log10(
ABS( vmax - vmin ) );
58 np = (
PLINT) floor( t1 );
63 if ( t1 > 0.7781512503 )
68 else if ( t1 > 0.4771212549 )
73 else if ( t1 > 0.1760912591 )
88 tick_reasonable = t2 * pow( 10.0, (
double) np );
91 *tick = t2 * pow( 10.0, (
double) np );
96 if ( *tick < 1.e-4 * tick_reasonable )
98 plexit(
"pldtik: magnitude of specified tick spacing is much too small" );
105 *nsubt =
ABS( *nsubt );
109 *tick = *tick * factor;
133 plbtime( &year, &month, &day, &hour, &min, &sec, vmin );
136 if ( diff < 3.0 * 60.0 )
143 plctime( year, month, day, hour, min, sec, start );
146 else if ( diff < 3.0 * 60.0 * 60.0 )
154 plctime( year, month, day, hour, min, sec, start );
157 else if ( diff < 3.0 * 60.0 * 60.0 * 24.0 )
160 *factor = 60.0 * 60.0;
166 plctime( year, month, day, hour, min, sec, start );
169 else if ( diff < 3.0 * 60.0 * 60.0 * 24.0 * 7.0 )
172 *factor = 60.0 * 60.0 * 24.0;
178 plctime( year, month, day, hour, min, sec, start );
181 else if ( diff < 3.0 * 60.0 * 60.0 * 24.0 * 365 )
184 *factor = 60.0 * 60.0 * 24.0 * 7.0;
190 plctime( year, month, day, hour, min, sec, start );
196 *factor = 60.0 * 60.0 * 24.0 * 365.25;
204 plctime( year, month, day, hour, min, sec, start );
248 #define MIN_FLTDIG 3 // disregarded if fractional part is 0
255 PLFLT chosen, notchosen, vmod, t0;
256 PLINT msd, notmsd, np, digmin, digfix;
269 chosen = (
ABS( vmax ) >=
ABS( vmin ) ) ? vmax : vmin;
270 notchosen = (
ABS( vmax ) >=
ABS( vmin ) ) ? vmin : vmax;
273 if (
ABS( chosen ) > 0. )
275 vmod =
ABS( chosen );
276 t0 = (
PLFLT) log10( vmod );
277 msd = (
PLINT) floor( t0 );
283 t0 = (
PLFLT) log10( vmod );
284 msd = (
PLINT) floor( t0 );
287 if (
ABS( notchosen ) > 0. )
311 if ( chosen < 0. || ( notchosen < 0. && ( notmsd == msd || msd <= 0 ) ) )
314 if ( digmin > digfix && !lf )
323 np = (
PLINT) floor( log10(
ABS( tick ) ) );
328 *prec =
MAX( -np, 0 );
334 if ( *mode == 0 && digmax > 0 && !lf )
338 if ( digmax - 2 - *prec < 0 )
345 *prec =
MAX(
MIN( *prec, digmax - msd - 1 ), 0 );