[Qt-interest] QString::toDouble with the string "inf"

Arnold Krille arnold at arnoldarts.de
Mon Jun 22 18:08:20 CEST 2009


Hi,

On Monday 22 June 2009 17:20:25 Julien Cugnière wrote:
> It seems QString::toDouble knows how to convert a string such as "inf",
> "-inf", or "nan" into the corresponding double representation. The code to
> handle these special numbers is in qlocale.cpp, but it's not documented
> anywhere. I'd like to know if I can rely on this behavior, or if it's
> intentionally omitted from the documentation so nobody relies on it.

I don't even think it is needed to document this because [+-] inf and nan are 
valid double values. So any double<->string conversion without it would be 
incomplete and buggy. And the reason its actually implemented in QLocale is 
probably that different people can write inf in the native language when 
interacting with the software.

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090622/69dc4714/attachment.bin 


More information about the Qt-interest-old mailing list