Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, February 2007
A very strange problem about QString::number(double)


Message 1 in thread

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"

What's the matter?

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 2 in thread

Kingsun Soong wrote:
> 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"
>
> What's the matter?
>   
Maybe you could try to reconfigure Qt with option -DQT_QLOCALE_USES_FCVT 
set.
If that does not help, try to turn off optimization.

Just a guess.


Best,

Andre


To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 3 in thread

Andre Haupt wrote:

> Kingsun Soong wrote:
>> 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"
>>
>> What's the matter?
>>   
> Maybe you could try to reconfigure Qt with option -DQT_QLOCALE_USES_FCVT
> set.
> If that does not help, try to turn off optimization.
> 
> Just a guess.
> 
> 
> Best,
> 
> Andre
> 
> 
> To unsubscribe - send "unsubscribe" in the subject to
> qt-embedded-interest-request@xxxxxxxxxxxxx

It works! Thank you so much! The problem has troubled me for three days. I
googled it but got no luck. I compiled all these things with soft-float
library but still got no luck. Almost despaired! When I posted it here, by
no means can I imagine that the right answer will come to me just in one
hour! I really appreciate it!

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 4 in thread

Kingsun Soong wrote:
> Andre Haupt wrote:
>
>   
>> Kingsun Soong wrote:
>>     
>>> 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"
>>>
>>> What's the matter?
>>>   
>>>       
>> Maybe you could try to reconfigure Qt with option -DQT_QLOCALE_USES_FCVT
>> set.
>> If that does not help, try to turn off optimization.
>>
>> Just a guess.
>>
>>
>> Best,
>>
>> Andre
>>
>>
>> To unsubscribe - send "unsubscribe" in the subject to
>> qt-embedded-interest-request@xxxxxxxxxxxxx
>>     
>
> It works! Thank you so much! The problem has troubled me for three days. I
> googled it but got no luck. I compiled all these things with soft-float
> library but still got no luck. Almost despaired! When I posted it here, by
> no means can I imagine that the right answer will come to me just in one
> hour! I really appreciate it!
>
>   
Nice to hear ;-)

Best,

Andre

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx