MCPcopy Create free account
hub / github.com/comaps/comaps / to_string_dac

Function to_string_dac

libs/base/string_utils.cpp:396–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394}
395
396std::string to_string_dac(double d, int dac)
397{
398 dac = std::min(std::numeric_limits<double>::digits10, dac);
399
400 std::ostringstream ss;
401
402 if (d < 1. && d > -1.)
403 {
404 std::string res;
405 if (d >= 0.)
406 {
407 ss << std::setprecision(dac + 1) << d + 1;
408 res = ss.str();
409 res[0] = '0';
410 }
411 else
412 {
413 ss << std::setprecision(dac + 1) << d - 1;
414 res = ss.str();
415 res[1] = '0';
416 }
417 return res;
418 }
419
420 // Calc digits before comma (log10).
421 double fD = fabs(d);
422 while (fD >= 1.0 && dac < std::numeric_limits<double>::digits10)
423 {
424 fD /= 10.0;
425 ++dac;
426 }
427
428 ss << std::setprecision(dac) << d;
429 return ss.str();
430}
431
432bool IsHTML(std::string const & utf8)
433{

Callers 15

BuildUniqueIdFunction · 0.85
ProcessMethod · 0.85
LatLonToXMLFunction · 0.85
HierarchyEntryToCsvRowFunction · 0.85
EditorDialogMethod · 0.85
PlacePageDialogUserMethod · 0.85
FeatureInfoDialogMethod · 0.85
UNIT_TESTFunction · 0.85
SetGeometryMethod · 0.85
SetCenterMethod · 0.85

Calls

no outgoing calls

Tested by 1

UNIT_TESTFunction · 0.68