Results 1 to 11 of 11

Thread: QStrings and Floats, Current Precision?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Join Date
    Jun 2012
    Posts
    98
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    11

    Default Re: QStrings and Floats, Current Precision?

    Ha! I didn't realize you meant to not use floating point at all. For sure.

    As it is, this is a simple keypad for user input (it doesn't even do calculations, sort of...) That said, yeah, I can agree with that. Binary representation has it's practical limits.

    EDIT: You've never used "setprecision()"? Its a standard C++ cout uh.. right-hand variable. I.E. setprecision(X) limits all cout functionality to read to X decimal places similar to QString::number(<NUM>,'f',X) regardless of the number.

    Also, you keep talking as if I didn't make it clear that I understand how floating point is represented. I even displayed so in an example (and mentioned why.) It's worth noting that Cout isn't really doing anything to the value other than allowing the floating point to be interpreted; just as you said there's no distinction for extra zeros. [You're setting floating point bits and then leaving the exponent. There's no real way to set extra zeros in binary without always setting all of them.]

    The main issue in this discussion has been that we're viewing the word "Precision" differently. I'm using as the Qt term (and apparently C++ term) meaning "number of decimal places to use" and you seem to be remarking on the actual precision of the value.
    Last edited by tescrin; 12th July 2012 at 20:21.

Similar Threads

  1. Replies: 4
    Last Post: 4th November 2014, 22:53
  2. Replies: 10
    Last Post: 9th February 2012, 05:31
  3. Replies: 2
    Last Post: 17th May 2011, 10:47
  4. QPainter::drawPixmap with floats ?
    By christophe.daudin in forum Qt Programming
    Replies: 8
    Last Post: 20th October 2009, 10:19
  5. Current Time with microsecond precision on windows
    By Dwarf007 in forum General Programming
    Replies: 16
    Last Post: 5th April 2006, 11:42

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.