#include "conversion.hpp" #include #include namespace common { common::UniquePtr doubleToStr(double num, unsigned int width, unsigned int precision) { auto str = common::make_unique(width + precision); dtostrf(num, static_cast(width), static_cast(precision), str->c_str); return str; } common::UniquePtr intToStr(int num) { auto width = static_cast(log10(num)); auto str = common::make_unique(width + 1U); dtostrf(num, static_cast(width + 1U), 0U, str->c_str); return str; } common::UniquePtr uintToStr(unsigned int num) { auto width = static_cast(log10(num)); auto str = common::make_unique(width + 1U); dtostrf(num, static_cast(width + 1U), 0U, str->c_str); return str; } } // namespace common