Results 1 to 11 of 11

Thread: toDouble() and rounding problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: toDouble() and rounding problem

    Quote Originally Posted by sadjoker View Post
    For me QT wouldn`t be the same without qtcentre.
    But QtCentre has nothing to do with QuickTime...

  2. #2
    Join Date
    Feb 2008
    Posts
    50
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: toDouble() and rounding problem

    Another solution is to multiply double values by 100 or 1000 or 10000 (depends of the needed digits after the floating point) before storing them like LONG (int) in the database, and dividing values by 100/1000/10000 after extracting from database and before displaying them.

    The first solution was: extracting as double from the database. Doing some math with the values, converting them to string and storing back into the db.

    Now i have to decide which way to use

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 284 Times in 279 Posts

    Default Re: toDouble() and rounding problem

    I think that the best solution is to use specialized class, something like this http://www.programmersheaven.com/dow...0/ZipView.aspx

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
  •  
Qt is a trademark of The Qt Company.