X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Ftests%2Fparanoidcalculator.cpp;h=c8f75246205c9ec0c4c4e9e54e3bb348279c4c42;hb=081b38a5f11d0eb093fdf3315051e9c1de7135fd;hp=156247fa2e14ede945540446896db5644606bf09;hpb=20788af97c06b76040ea2de5ab3ddc683a261365;p=ipdf%2Fcode.git diff --git a/src/tests/paranoidcalculator.cpp b/src/tests/paranoidcalculator.cpp index 156247f..c8f7524 100644 --- a/src/tests/paranoidcalculator.cpp +++ b/src/tests/paranoidcalculator.cpp @@ -19,6 +19,8 @@ int main(int argc, char ** argv) Debug("FLT_EPSILON = %.40f", FLT_EPSILON); Debug("Sizeof ParanoidNumber::digit_t is %u", sizeof(ParanoidNumber::digit_t)); Debug("Sizeof ParanoidNumber is %u", sizeof(ParanoidNumber)); + Debug("Sizeof double is %u", sizeof(double)); + Debug("Sizeof ParanoidNumber* %u", sizeof(ParanoidNumber*)); string token(""); cin >> token; @@ -27,6 +29,7 @@ int main(int argc, char ** argv) float fa = da; while (cin.good()) { + Debug("a is {%s} \"%.40lf\"", a.Str().c_str(), a.ToDouble()); char op; cin >> op; token = ""; @@ -39,11 +42,14 @@ int main(int argc, char ** argv) token += c; c = cin.get(); } - Debug("String is %s", token.c_str()); + + //Debug("String is \"%s\"", token.c_str()); float fb = strtof(token.c_str(), NULL); double db = strtod(token.c_str(), NULL); ParanoidNumber b(token.c_str()); - Debug("b is {%s} %lf", b.Str().c_str(), b.ToDouble()); + + Debug("b is {%s} \"%lf\"", b.Str().c_str(), b.ToDouble()); + Debug("db is %lf", db); switch (op) { case '+': @@ -68,10 +74,12 @@ int main(int argc, char ** argv) break; } - Debug("a is: %s", a.Str().c_str()); - Debug("a as double: %.40f\n", a.ToDouble()); - Debug("floats give: %.40f\n", fa); - Debug("double gives: %.40f\n", da); + Debug("a is: {%s}", a.Str().c_str()); + Debug("a as double: %.40lf", a.ToDouble()); + //Debug("a as float: %.40f", a.ToFloat()); + //Debug("a as int64_t: %ld", a.Convert()); + //Debug("floats give: %.40f", fa); + Debug("double gives: %.40lf", da); }