Thread: Quick question...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    131

    Quick question...

    What is the largest value you can represent using a 256-bit unsigned integer? unsigned means non-negative correct?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    1.1579208923731619542357098500869e+77
    Next time, get your calculator out and figure it out for yourself,#
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by Salem
    1.1579208923731619542357098500869e+77
    Next time, get your calculator out and figure it out for yourself,#
    I would if I knew how hence me having to ask. How did you do that?

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    A 256 bit data type There is currently no such thing. Most compilers support a 64 bit data type (long long or __int64). But a 256 bit data could have a range of approximately 1.1579208923731619542357098500869e+77 And yes, that is what unsigned means. Edit: 2 ^ 256. Not the XOR, the exponent.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by Tonto
    A 256 bit data type There is currently no such thing. Most compilers support a 64 bit data type (long long or __int64). But a 256 bit data could have a range of approximately 1.1579208923731619542357098500869e+77 And yes, that is what unsigned means. Edit: 2 ^ 256. Not the XOR, the exponent.
    Oh I get it now. But would it not be 2^256 - 1?

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >How did you do that?
    Assuming the Windows calculator, enter 2, then choose the x^y button, then enter 256 and hit the = button.
    My best code is written with the delete key.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Betcha-you-have-to-explain-how-to-get-from-basic-to-scientific-mode
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Or, if you want the exact value:

    11579208923731619542357098500868790785326998466564 0564039457584007913129639935
    Last edited by XSquared; 08-04-2006 at 01:32 PM.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #9
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by Salem
    Betcha-you-have-to-explain-how-to-get-from-basic-to-scientific-mode
    Wow. A little harsh don't ya think. We all have to start somewere. I more so was looking for help with the theory behind it.

    Thanks for the help though,

    Chad

  10. #10
    Useless Apprentice ryan_germain's Avatar
    Join Date
    Jun 2004
    Posts
    76
    yes it should be 2^256 - 1 as the max value or 2^256 combinations
    There is not the slightest indication that [nuclear energy] will ever be obtainable. It would mean that the atom would have to be shattered at will.

    -Albert Einstein, 1932

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM