diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-02-14 04:55:19 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-02-14 04:55:19 (GMT) |
commit | d5019a964e376e8ad0ad398cc4cfb3d97509402d (patch) | |
tree | 0cb9b316ff1aff9a7befec2b6630f93746776d1b /src/printutils.cc | |
parent | c1b1d0992f78ecafb4212994207ee7cc7cbb6b39 (diff) |
deal with test suite issues under mingw-cross compile and wine
Diffstat (limited to 'src/printutils.cc')
-rw-r--r-- | src/printutils.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/printutils.cc b/src/printutils.cc index a8b62aa..698fffb 100644 --- a/src/printutils.cc +++ b/src/printutils.cc @@ -1,4 +1,5 @@ #include "printutils.h" +#include <sstream> #include <stdio.h> std::list<std::string> print_messages_stack; @@ -49,3 +50,24 @@ void PRINT_NOCACHE(const std::string &msg) outputhandler(msg, outputhandler_data); } } + +std::string two_digit_exp_format( std::string doublestr ) +{ +#ifdef _WIN32 + size_t exppos = doublestr.find('e'); + if ( exppos != std::string::npos) { + exppos += 2; + if ( doublestr[exppos] == '0' ) doublestr.erase(exppos,1); + } +#endif + return doublestr; +} + +std::string two_digit_exp_format( double x ) +{ + std::stringstream s; + s << x; + return two_digit_exp_format( s.str() ); +} + + |