Skip to content
Snippets Groups Projects
Commit 1d441a52 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

Bug 1668: printNumber() no longer prints to stdout, but uses LOG_DEBUG_STR()....

Bug 1668: printNumber() no longer prints to stdout, but uses LOG_DEBUG_STR(). Hence, there's no output anymore that needs to be verified
parent 530a26c0
No related branches found
No related tags found
No related merge requests found
...@@ -78,32 +78,30 @@ using namespace std; ...@@ -78,32 +78,30 @@ using namespace std;
smallestDenormal_u.mask += 1; \ smallestDenormal_u.mask += 1; \
T smallestDenormal(smallestDenormal_u.value); T smallestDenormal(smallestDenormal_u.value);
#define printNumber(os, x) \ #define printNumber(x) \
{ int p(2*sizeof(x)+1); \ { int p(2*sizeof(x)+1); \
union_t u = { x }; \ union_t u = { x }; \
/* test output verification requires NaNs to be signed, */ \ LOG_DEBUG_STR(setprecision(p) << left << setw(17) << #x << " = " \
/* even though the sign of NaN is platform dependent. */ \ << setw(p+6) << x << " (" << hex << showbase \
if (Numeric::isNan(x)) u.mask |= negmask; \ << setw(p+1) << u.mask << dec << ")"); \
os << setprecision(p) << left << setw(17) << #x << " = " \
<< setw(p+6) << x << " (" << hex << showbase << setw(p+1) \
<< u.mask << dec << ")" << endl; \
} }
#define showNumbers(T) \ #define showNumbers(T) \
{ LOG_INFO("showNumbers("#T")"); \ { LOG_INFO("showNumbers("#T")"); \
printNumber(cout, zero); \ printNumber(zero); \
printNumber(cout, one); \ printNumber(one); \
printNumber(cout, two); \ printNumber(two); \
printNumber(cout, negativeZero); \ printNumber(negativeZero); \
printNumber(cout, nan); \ printNumber(nan); \
printNumber(cout, nan1); \ printNumber(nan1); \
printNumber(cout, nan2); \ printNumber(nan2); \
printNumber(cout, nan3); \ printNumber(nan3); \
printNumber(cout, nan4); \ printNumber(nan4); \
printNumber(cout, nan5); \ printNumber(nan5); \
printNumber(cout, nearestTwo); \ printNumber(nearestTwo); \
printNumber(cout, nearTwo); \ printNumber(nearTwo); \
printNumber(cout, notNearTwo); \ printNumber(notNearTwo); \
printNumber(cout, smallestDenormal); \ printNumber(smallestDenormal); \
} }
#define testNegative(T) \ #define testNegative(T) \
......
#!/bin/sh #!/bin/sh
./runctest.sh -stdout tNumeric 2>&1 > tNumeric.log ./runctest.sh tNumeric 2>&1 > tNumeric.log
zero = 0 (0 )
one = 1 (0x3f800000)
two = 2 (0x40000000)
negativeZero = -0 (0x80000000)
nan = nan (0xffc00000)
nan1 = nan (0xffc00000)
nan2 = nan (0xffc00000)
nan3 = nan (0xffc00000)
nan4 = nan (0xffc00000)
nan5 = nan (0xffc00001)
nearestTwo = 1.99999988 (0x3fffffff)
nearTwo = 1.99999952 (0x3ffffffc)
notNearTwo = 1.99999809 (0x3ffffff0)
smallestDenormal = 1.40129846e-45 (0x1 )
zero = 0 (0 )
one = 1 (0x3ff0000000000000)
two = 2 (0x4000000000000000)
negativeZero = -0 (0x8000000000000000)
nan = nan (0xfff8000000000000)
nan1 = nan (0xfff8000000000000)
nan2 = nan (0xfff8000000000000)
nan3 = nan (0xfff8000000000000)
nan4 = nan (0xfff8000000000000)
nan5 = nan (0xfff8000000000001)
nearestTwo = 1.9999999999999998 (0x3fffffffffffffff)
nearTwo = 1.9999999999999982 (0x3ffffffffffffff8)
notNearTwo = 1.9999999999999858 (0x3fffffffffffffc0)
smallestDenormal = 4.9406564584124654e-324 (0x1 )
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