QwtScaleDiv::range() gives back a wrong value for a logarithmic scale
Brought to you by:
rathmann
I have a logarithmic scale in y-Axis like this:
enableAxis( QwtPlot::yLeft, true ); setAxisTitle( QwtPlot::yLeft, QString("Pressure [%1]").arg("mbar") ); pyLogScale = new LogScaleEngine; setAxisScaleEngine( QwtPlot::yLeft, pyLogScale ); setAxisMaxMajor( QwtPlot::yLeft, 14 ); setAxisMaxMinor( QwtPlot::yLeft, 10 ); setAxisScale( QwtPlot::yLeft, 1e-10, 2000 ); setAxisAutoScale( QwtPlot::yLeft, false );
A QwtScaleDiv like this
QwtScaleDiv scaleDiv = this->axisScaleDiv( QwtPlot::yLeft );
qDebug() << scaleDiv.upperBound() << scaleDiv.lowerBound() << scaleDiv.range();
gives an output
2000 1E-10 2000
upperBound() is OK
lowerBound() is OK
range() is NOT OK
QwtScaleDiv::range() gives back a wrong value for a logarithmic scale
Anonymous
range is simply: upperBound() - lowerBound().
Then your situation is a combination of the limited significance of doubles and an inaccurate debug operator.