#include <qlayout.h>
#include <qtabwidget.h>
+//#include <math.h>
+
using namespace std;
/*!
void VisuGUI_DeformedShapeDlg::setFactor(double theFactor)
{
- double i=0.1;
- if(theFactor!=0) {
- while (1) { // Calculate Step & Precission
- if ( int (theFactor/i) > 0)
- break;
- else {
- i = i*0.1;
- }
+ double step = 0.1;
+ if (fabs(theFactor) > numeric_limits<double>::epsilon()) {
+ int degree = int(log10(fabs(theFactor))) - 1;
+ if (fabs(theFactor) < 1) {
+ // as logarithm value is negative in this case
+ // and it is truncated to the bigger integer
+ degree -= 1;
}
+ step = pow(10, degree);
}
- ScalFact->setLineStep(i);
-
+ ScalFact->setLineStep(step);
ScalFact->setValue(theFactor);
}