COMMON: Add a debugPrint function to Rational
svn-id: r52593
This commit is contained in:
parent
6eecc485d2
commit
df7158c0ee
2 changed files with 7 additions and 0 deletions
|
@ -22,6 +22,7 @@
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/rational.h"
|
||||
#include "common/util.h"
|
||||
#include "common/algorithm.h"
|
||||
|
@ -289,6 +290,10 @@ const Rational operator/(int left, const Rational &right) {
|
|||
return tmp;
|
||||
}
|
||||
|
||||
void Rational::debugPrint(int debuglevel, const char *caption) const {
|
||||
debug(debuglevel, "%s %d/%d", caption, _num, _denom);
|
||||
}
|
||||
|
||||
bool operator==(int left, const Rational &right) {
|
||||
return right == left;
|
||||
}
|
||||
|
|
|
@ -86,6 +86,8 @@ public:
|
|||
double toDouble() const;
|
||||
frac_t toFrac() const;
|
||||
|
||||
void debugPrint(int debuglevel = 0, const char *caption = "Rational:") const;
|
||||
|
||||
private:
|
||||
int _num;
|
||||
int _denom;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue