[Qt-interest] QLocale::toString(double) implicitly rounds?!?

Atlant Schmidt aschmidt at dekaresearch.com
Wed Aug 17 14:18:19 CEST 2011


Robert:

> How can I force toString to cut off, instead of round?
  Create temporary double, chop it at the desired precision, and
  then use toString() in *THAT* double.

                                             Atlant

From: qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com [mailto:qt-interest-bounces+aschmidt=dekaresearch.com at qt.nokia.com] On Behalf Of Schimkowitsch Robert
Sent: Tuesday, August 16, 2011 07:11
To: qt-interest at qt.nokia.com
Subject: [Qt-interest] QLocale::toString(double) implicitly rounds?!?


Hi,

is it correct that converting a double to a QString using QLocale::toString will round the number before conversion, if the given precision is insufficient to fit the number?

This is neither documented (see http://doc.qt.nokia.com/4.7/qlocale.html#toString-9, http://doc.qt.nokia.com/4.7/qstring.html#number-2 and http://doc.qt.nokia.com/4.7/qstring.html#argument-formats), nor desired in all use cases.

How can I force toString to cut off, instead of round?

Kind regards

Robert Schimkowitsch

________________________________

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.

Thank You.

________________________________


Click here<https://www.mailcontrol.com/sr/i8PjaDnZ0YnTndxI!oX7Ulvwl1GqFAPrmLCoWudD7Atmix+!6ttWoarNm1Tp75Pdj4fdSEfZti1TQ40Is2HDWw==> to report this email as spam.

________________________________
This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110817/41adf4fd/attachment.html 


More information about the Qt-interest-old mailing list