[Interest] Missing leading zero in exponential format

Thiago Macieira thiago.macieira at intel.com
Wed Mar 15 16:00:20 CET 2017


Em quarta-feira, 15 de março de 2017, às 06:05:38 PDT, Marcel Stegehuis 
escreveu:
> Since the upgrade from QT 5.3.1 to 5.7.0 it seems that the string output of
> the exponential format is missing the leading zero:
> 
> Using the code below:
> double testValue = 1234.5678;
> QString (" <Value>%1</value>\n").arg (testValue, 0, 'E', 2);
> 
> I expect:
> <Value>1.23E+03</value>
> but get:
> <Value>1.23E+3</value>
> 
> Has anyone a clue if this is intentional behavior or how this could be
> solved?
> 
> (See also QT forum: https://forum.qt.io/topic/77226)

"Solved" implies it's a bug. It isn't.

My guess is that this comes from the use of the libdoubleconversion library to 
get better string representation of floating point than the sprintf function 
can achieve.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list