Results 1 to 6 of 6

Thread: float

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Qt products
    Qt3
    Platforms
    Windows
    Thanks
    53

    Default Re: float

    Quote Originally Posted by Zatraz
    Because in the fallow code line:

    Qt Code:
    1. float f = Density*100;
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. float f = 0.13*100;
    To copy to clipboard, switch view to plain text mode 

    the number "100" in implicity cast to a float and this conversion could lead to a precision lost.

    Try to use:

    Qt Code:
    1. float f = Density*100.0;
    To copy to clipboard, switch view to plain text mode 

    and

    Qt Code:
    1. float f = 0.13*100.0;
    To copy to clipboard, switch view to plain text mode 
    sorry but your example doesn't solve the problem......
    Regards

  2. #2
    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: float

    Try mine, it should work just fine.

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Qt products
    Qt3
    Platforms
    Windows
    Thanks
    53

    Default Re: float

    Quote Originally Posted by wysota
    Try mine, it should work just fine.
    yes I just use it! I thanked you for this......
    Regards

Similar Threads

  1. Selecting a QLine
    By Paul Drummond in forum Qt Programming
    Replies: 6
    Last Post: 2nd September 2015, 17:30
  2. Slot
    By mickey in forum Qt Programming
    Replies: 13
    Last Post: 4th June 2006, 13:18

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.