Results 1 to 5 of 5

Thread: strange problem about QString::number(double)

  1. #1
    Join Date
    Dec 2007
    Posts
    4

    Default strange problem about QString::number(double)

    hello,everyone,My program is:
    Qt Code:
    1. #include <QDebug>
    2. int main()
    3. {
    4. qDebug()<<QString::number(3.14);
    5. }
    To copy to clipboard, switch view to plain text mode 

    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!
    Last edited by wysota; 24th December 2007 at 10:14. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: strange problem about QString::number(double)

    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.

  3. #3
    Join Date
    Dec 2007
    Posts
    4

    Default Re: strange problem about QString::number(double)

    thanks wysota,ARM is middleendian, but this pragram run on the arm board,it gets correct answer
    Qt Code:
    1. #include <stdio.h>
    2. int main()
    3. {
    4. double a = 3.14;
    5. printf("a=%f\n",a);
    6. return 0;
    7. }
    To copy to clipboard, switch view to plain text mode 

    i think this problem whether relate to QT
    ps:my english is very poor.
    Last edited by jpn; 24th December 2007 at 13:25. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: strange problem about QString::number(double)

    Quote Originally Posted by yuzr View Post
    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.

  5. #5
    Join Date
    Dec 2007
    Posts
    4

    Default Re: strange problem about QString::number(double)

    thanks,wysota,i will check it.

Similar Threads

  1. Strange shortcut problem
    By blukske in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2007, 10:26
  2. Strange problem with events on Unix
    By sukanyarn in forum Qt Programming
    Replies: 2
    Last Post: 7th November 2006, 02:45
  3. Strange Problem with JPEG Support on win XP
    By caligula in forum Installation and Deployment
    Replies: 3
    Last Post: 18th September 2006, 10:36
  4. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.