Skip to content
Snippets Groups Projects
Commit 5b9d164b authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

for small relative ranges, we need to write setcoord with full precision

parent e759c096
No related branches found
No related tags found
No related merge requests found
......@@ -335,9 +335,10 @@ void CAxis::calc_linticks(vector<double>& Tacks, int& ntpt, int& nt4t, double* t
void CAxis::calc_lintacks(vector<double>& Tacks, int& ntpt, double& dtack) const
{
if (inf >= sup)
double range = sup-inf;
if (range <= 0)
throw "BUG detected by calc_linticks: inf=" + S(inf) + " >= sup=" + S(sup);
double r = log10(sup - inf);
double r = log10(range);
int ir = (int)((r < 0) ? r - 1 : r);
double rd = r - ir; // fractional part of r
double rdr = pow(10., rd);
......@@ -360,11 +361,11 @@ void CAxis::calc_lintacks(vector<double>& Tacks, int& ntpt, double& dtack) const
dtack = .25 * pow(10., ir);
ntpt = 5;
}
double vsub = inf - (sup - inf) * 1.e-4;
double vsup = sup + (sup - inf) * 1.e-4;
Tacks.clear();
for (double d = dtack * (floor(inf/dtack)-1); d < dtack * (ceil(sup/dtack)+1); d += dtack)
if (vsub <= d && d <= vsup)
printf( "DEBUG (%g,%g) => (%g,%g) step %g\n",
inf, sup, dtack * (floor(inf/dtack)-1), dtack * (ceil(sup/dtack)+1), dtack);
for (double d = dtack * (floor(inf/dtack)-1); d <= dtack * (ceil(sup/dtack)+1); d += dtack)
if (inf-1e-4*range <= d && d <= sup+1e-4*range)
Tacks.push_back(d);
}
......
......@@ -196,7 +196,7 @@ namespace {
string ps_coord(const CAxis* A)
{
return str(format("%1i %12.4g %12.4g %cSetCoord\n")
return str(format("%1i %g %g %cSetCoord\n")
% A->logflag % A->inf % A->sup % A->name);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment