MCPcopy Create free account
hub / github.com/apache/trafficserver / fpToString

Function fpToString

lib/catch2/catch.hpp:15056–15073  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15054
15055template<typename T>
15056std::string fpToString( T value, int precision ) {
15057 if (Catch::isnan(value)) {
15058 return "nan";
15059 }
15060
15061 ReusableStringStream rss;
15062 rss << std::setprecision( precision )
15063 << std::fixed
15064 << value;
15065 std::string d = rss.str();
15066 std::size_t i = d.find_last_not_of( '0' );
15067 if( i != std::string::npos && i != d.size()-1 ) {
15068 if( d[i] == '.' )
15069 i++;
15070 d = d.substr( 0, i+1 );
15071 }
15072 return d;
15073}
15074
15075//// ======================================================= ////
15076//

Callers 1

convertMethod · 0.85

Calls 4

isnanFunction · 0.85
strMethod · 0.45
sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected