PDA

View Full Version : strange problem about QString::number(double)



yuzr
24th December 2007, 03:45
hello,everyone,My program is:

#include <QDebug>
int main()
{
qDebug()<<QString::number(3.14);
}

When I compile and run it on my KDE Desktop with qt 4.2.0ïit gives the
result:

"3.14"

However, when I cross compile and run it on my ARM board with
qtopia-core-opensource-4.2.2, it gives a completely wrong result:

"4.27698e+86"
i have added macro QT_QLOCALE_USES_FCVT when configure QT,but it doesn't work.
has someone solved the problem?can you show me your configure?
thanks!

wysota
24th December 2007, 11:16
Have you verified the endianness is not causing it? As far as I know ARM can be either big- or littleendian, maybe you compiled the application incorrectly.

yuzr
24th December 2007, 12:39
thanks wysota,ARM is middleendian, but this pragram run on the arm board,it gets correct answer

#include <stdio.h>
int main()
{
double a = 3.14;
printf("a=%f\n",a);
return 0;
}

i think this problem whether relate to QT
ps:my english is very poor.:eek:

wysota
24th December 2007, 13:38
i think this problem whether relate to QT
If you compiled it incorrectly, then it surely is. That's why I suggest you check it out.

yuzr
24th December 2007, 14:05
thanks,wysota,i will check it.