MCPcopy Create free account
hub / github.com/RenderKit/oidn / fpToString

Function fpToString

external/catch.hpp:15045–15062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15043
15044template<typename T>
15045std::string fpToString( T value, int precision ) {
15046 if (Catch::isnan(value)) {
15047 return "nan";
15048 }
15049
15050 ReusableStringStream rss;
15051 rss << std::setprecision( precision )
15052 << std::fixed
15053 << value;
15054 std::string d = rss.str();
15055 std::size_t i = d.find_last_not_of( '0' );
15056 if( i != std::string::npos && i != d.size()-1 ) {
15057 if( d[i] == '.' )
15058 i++;
15059 d = d.substr( 0, i+1 );
15060 }
15061 return d;
15062}
15063
15064//// ======================================================= ////
15065//

Callers 1

convertMethod · 0.85

Calls 4

isnanFunction · 0.85
strMethod · 0.80
sizeMethod · 0.80
substrMethod · 0.80

Tested by

no test coverage detected