Changeset 889 for cpp/frams/util
- Timestamp:
- 07/22/19 01:16:11 (5 years ago)
- Location:
- cpp/frams/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/sstring.cpp
r826 r889 52 52 { 53 53 size = guessMemSize(initsize); 54 if (size > 0) 54 if (size > 0) { txt = (char*)malloc(size + 1); txt[0] = 0; } 55 55 else txt = (char*)""; 56 56 used = 0; … … 368 368 #ifdef USE_PRINTFLOAT_DRAGON4 369 369 SString tmp; 370 char* here =tmp.directWrite(30);371 tmp.endWrite(PrintFloat64(here, 30,d,372 ((d<-1e17)||(d>1e17)||((d<1e-4)&&(d>-1e-4)&&(d!=0.0)))373 374 370 char* here = tmp.directWrite(30); 371 tmp.endWrite(PrintFloat64(here, 30, d, 372 ((d < -1e17) || (d > 1e17) || ((d < 1e-4) && (d > -1e-4) && (d != 0.0))) 373 ? PrintFloatFormat_Scientific : PrintFloatFormat_Positional, 374 -1));//http://www.ryanjuckett.com/programming/printing-floating-point-numbers/ 375 375 #else 376 376 SString tmp = SString::sprintf("%.17g", d); //https://stackoverflow.com/questions/16839658/printf-width-specifier-to-maintain-precision-of-floating-point-value -
cpp/frams/util/sstring.h
r793 r889 77 77 void copyFrom(const char* ch, int chlen = -1); ///< copy string, length of -1 == unknown 78 78 79 void* operator new(size_t s, void* mem) { return mem; }79 void* operator new(size_t s, void* mem) { return mem; } 80 80 #ifdef _MSC_VER 81 81 void operator delete(void* mem, void* t) {} 82 82 #endif 83 void* operator new(size_t s) { return malloc(sizeof(SString)); }83 void* operator new(size_t s) { return malloc(sizeof(SString)); } 84 84 void operator delete(void* mem) { free(mem); } 85 85
Note: See TracChangeset
for help on using the changeset viewer.