Results 1 to 7 of 7

Thread: The program cannot work correctly for more than "FFFFF"

  1. #1
    Join Date
    Mar 2015
    Posts
    24
    Thanks
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Question The program cannot work correctly for more than "FFFFF"

    Hi everybody
    Today I was seeing and working around this project:

    www.youtube.com/watch?v=HMxVDuk1gLo

    There are two links in this youtube page to download the source code and executable program. you can download them.
    after downlaoding it, I found out that it cannot work for more than "FFFFF". why?
    I changed all of the numeric variables to quint64 to see if it would work for 64bit but still it doesn't work. I attached the changed source code. in your opinion what's wrong with this program?
    Attached Files Attached Files

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

    Default Re: The program cannot work correctly for more than "FFFFF"

    What it means cannot work for more than "FFFFF" ?

  3. #3
    Join Date
    Mar 2015
    Posts
    24
    Thanks
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Talking Re: The program cannot work correctly for more than "FFFFF"

    This program is Decimal, Binary and Hexadecimal Converter. it can convert any Hex value less than "FFFFF" to Dec or Bin but for more than this value, you can just see somethings like this:



    while for less than "FFFFF" everythings is ok. look:




    Added after 24 minutes:


    And also for "FFFFFFFFFFFFFFFF":



    Looks like the calculator of windows has the same problem(wink). look:




    LoL!

    maybe I have to use an array to figure out this problem.
    Last edited by Ryan111; 3rd April 2015 at 11:57.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: The program cannot work correctly for more than "FFFFF"

    Clearly it is broken. Is it your program ? What do you want us to do about this bug ?
    Btw. if you just want to convert between different representations you can use built-in "calc" app on windows.

  5. #5
    Join Date
    Mar 2015
    Posts
    24
    Thanks
    20
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: The program cannot work correctly for more than "FFFFF"

    Quote Originally Posted by stampede View Post
    Is it your program ?
    Actually no.
    Quote Originally Posted by stampede View Post
    What do you want us to do about this bug?
    Any simple idea to solve it? any seggestion and recommends?
    Quote Originally Posted by stampede View Post
    Btw. if you just want to convert between different representations you can use built-in "calc" app on windows.
    Yes but it has some bugs or problems. then it make me to write a good converter for myself.

  6. #6
    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: The program cannot work correctly for more than "FFFFF"

    The programs probably work on some integral types therefore they won't be able to convert numbers which don't fit into those types. 0xFFFF FFFF FFFF FFFF is a 128 bit number therefore you need a datatype that can hold 128 bit unsigned numbers (e.g. uint_128_t if supported by your compiler). Other than that you can split a text string into smaller ones, perform a conversion of each of those chunks and assemble the result into textual representations again.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: The program cannot work correctly for more than "FFFFF"

    A 64-bit signed integer with all its bits set to 1 does indeed represent -1 decimal in two's complement representation. Windows calculator has that right.

Similar Threads

  1. Replies: 3
    Last Post: 16th March 2015, 07:31
  2. Replies: 2
    Last Post: 27th January 2012, 17:29
  3. Replies: 0
    Last Post: 15th November 2009, 09:40
  4. "Cannot run program "C:\Qt\4.3.3\bin\qmake": file not found
    By PeteH in forum Installation and Deployment
    Replies: 1
    Last Post: 7th February 2009, 00:48
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Tags for this Thread

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.