I am running Qt 4.2.2 on FreeBSD 4.8 with gcc 3.4.6. I am working with dollar amounts in doubles but I cannot properly convert these doubles into QStrings for display in a QLabel. As a test I compiled the following very simple code:
#include <QtCore>
int main () {
double doublevar = 42.84;
qDebug
() <<
QString::number(doublevar
);
}
#include <QtCore>
int main () {
double doublevar = 42.84;
qDebug() << QString::number(doublevar);
}
To copy to clipboard, switch view to plain text mode
Which outputs "-0" to the terminal. What could be causing this? The same code in this simple program runs fine on my Linux and Windows boxes. If I use a QVariant as below:
#include <QtCore>
int main () {
double doublevar = 42.84;
qDebug() << var.toString();
}
#include <QtCore>
int main () {
double doublevar = 42.84;
QVariant var(doublevar);
qDebug() << var.toString();
}
To copy to clipboard, switch view to plain text mode
The output is "-0.00000000005965e+224". Again, what could be wrong?
Thanks
mAx
Bookmarks