String from floating-point giving wrong number of decimal places

There seems to be an issue with constructing a String from double or float with a specified number of decimal places. The parameter is being interpreted as total number of places, which means that (for example) String(2589410.5894, 7) results in “2589410”.

This is happening in the call to StackArrayStream::writeDouble(n, decPlaces), because the std::ostream defaults to treating the places parameter as total number. It can be fixed by setting a flag:
std::ostream o (this);
if (numDecPlaces > 0)
{
o.setf(std::ios_base::fixed); // this flags precision as decimal-places only
o.precision((std::streamsize) numDecPlaces);
}
:
I’m seeing this on Windows, but it appears to be general.

Fixed. Thanks for reporting.

Hello, I’m noticing a similar behaviour with [almost] latest develop branch but when not settings fixed decimals (and not scientific notation) :
calling this function with for instance 1.0000000555 will return “1”
it seems that when numDecPlaces <= 0 , the only thing that is does is putting the value inside the stream.
Would it need something to precise not loosing so much ?