[Qt-interest] SQL (ODBC) retreiving doubles incorrectly
Julien Cugnière
julien.cugniere at gmail.com
Fri Oct 2 15:57:53 CEST 2009
2009/10/2 Andre Somers <andre at familiesomers.nl>:
> Julien Cugnière wrote:
>> A slightly better hack would be to prepend "0.0" to the value you get
>> if it starts with 'E' or 'e'. Then you can use QString::toDouble().
>>
> I disagree. My hack actually gets the value I was after, instead of
> returning 0. Only if the value is smaller than 0.000001, I will still
> get 0. That is not a big issue. It remains a very ugly hack nontheless.
Sorry, I wasn't thinking properly : I should have said prepend "1",
and not "0.0".
The idea is to turn the string "E-3" into "1E-3", which can be
converted to a double, and gives you the correct value (unless I'm
still not thinking properly :-)
--
Julien Cugnière
More information about the Qt-interest-old
mailing list