Changeset View
Changeset View
Standalone View
Standalone View
kmplot/view.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | |||||
71 | #ifdef HAVE_IEEEFP_H | 71 | #ifdef HAVE_IEEEFP_H | ||
72 | #include <ieeefp.h> | 72 | #include <ieeefp.h> | ||
73 | #endif | 73 | #endif | ||
74 | 74 | | |||
75 | #if defined(Q_CC_MINGW) | 75 | #if defined(Q_CC_MINGW) | ||
76 | using namespace std; | 76 | using namespace std; | ||
77 | #endif | 77 | #endif | ||
78 | 78 | | |||
79 | //BEGIN nan & inf | | |||
80 | | ||||
81 | #if defined(__APPLE__) || defined(_MSC_VER) | | |||
82 | // work around an OSX <cmath> bug; is there a proper way to fix this? | | |||
83 | #ifndef isnan | | |||
84 | extern "C" int isnan(double); | | |||
85 | #endif | | |||
86 | #ifndef isinf | | |||
87 | extern "C" int isinf(double); | | |||
88 | #endif | | |||
89 | #endif | | |||
90 | | ||||
91 | | ||||
92 | #ifdef __osf__ | | |||
93 | #include <nan.h> | | |||
94 | #define isnan(x) IsNAN(x) | | |||
95 | #define isinf(x) IsINF(X) | | |||
96 | #endif | | |||
97 | | ||||
98 | #ifdef Q_OS_SOLARIS | | |||
99 | int isinf(double x) | | |||
100 | { | | |||
101 | return !finite(x) && x==x; | | |||
102 | } | | |||
103 | #endif | | |||
104 | // only msvc needs this (sometimes) | | |||
105 | #ifdef _MSC_VER | | |||
106 | #ifndef KDEWIN_VERSION | | |||
107 | int isinf(double x) | | |||
108 | { | | |||
109 | return !finite(x) && x==x; | | |||
110 | } | | |||
111 | #endif // KDEWIN_VERSION | | |||
112 | #endif //END _WIN32 | | |||
113 | //END nan & inf | | |||
114 | | ||||
115 | | ||||
116 | // does for real numbers what "%" does for integers | 79 | // does for real numbers what "%" does for integers | ||
117 | double realModulo( double x, double mod ) | 80 | double realModulo( double x, double mod ) | ||
118 | { | 81 | { | ||
119 | return x - floor(x/mod)*mod; | 82 | return x - floor(x/mod)*mod; | ||
120 | } | 83 | } | ||
121 | 84 | | |||
122 | 85 | | |||
123 | //BEGIN class View | 86 | //BEGIN class View | ||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | 261 | { | |||
300 | return; | 263 | return; | ||
301 | } | 264 | } | ||
302 | 265 | | |||
303 | 266 | | |||
304 | //BEGIN get X/Y range | 267 | //BEGIN get X/Y range | ||
305 | m_xmin = XParser::self()->eval( Settings::xMin() ); | 268 | m_xmin = XParser::self()->eval( Settings::xMin() ); | ||
306 | m_xmax = XParser::self()->eval( Settings::xMax() ); | 269 | m_xmax = XParser::self()->eval( Settings::xMax() ); | ||
307 | 270 | | |||
308 | if ( m_xmax <= m_xmin || !finite(m_xmin) || !finite(m_xmax) ) | 271 | if ( m_xmax <= m_xmin || !std::isfinite(m_xmin) || !std::isfinite(m_xmax) ) | ||
anthonyfieroni: As a suggest, first check for finite then make comparison. | |||||
309 | { | 272 | { | ||
310 | m_xmin = -8; | 273 | m_xmin = -8; | ||
311 | m_xmax = +8; | 274 | m_xmax = +8; | ||
312 | } | 275 | } | ||
313 | 276 | | |||
314 | m_ymin = XParser::self()->eval( Settings::yMin() ); | 277 | m_ymin = XParser::self()->eval( Settings::yMin() ); | ||
315 | m_ymax = XParser::self()->eval( Settings::yMax() ); | 278 | m_ymax = XParser::self()->eval( Settings::yMax() ); | ||
316 | if ( m_ymax <= m_ymin || !finite(m_ymin) || !finite(m_ymax) ) | 279 | if ( m_ymax <= m_ymin || !std::isfinite(m_ymin) || !std::isfinite(m_ymax) ) | ||
317 | { | 280 | { | ||
318 | m_ymin = -8; | 281 | m_ymin = -8; | ||
319 | m_ymax = +8; | 282 | m_ymax = +8; | ||
320 | } | 283 | } | ||
321 | //END get X/Y range | 284 | //END get X/Y range | ||
322 | 285 | | |||
323 | 286 | | |||
324 | //BEGIN calculate scaling matrices | 287 | //BEGIN calculate scaling matrices | ||
▲ Show 20 Lines • Show All 3949 Lines • Show Last 20 Lines |
As a suggest, first check for finite then make comparison.