Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. 128 bit Decimal Type

128 bit Decimal Type

Scheduled Pinned Locked Moved C#
question
12 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C computerpublic

    Hello, I have some issues with the understanding of how it is possible to use a the 128 bit Decimal Type on my 64 bit computer. Somehow the logic doesn't seem to come to me. Can someone please explain how this is possible? Thank You.

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #3

    How do you think 8 bit processors handled 16 bit integers? It's not difficult: you just have a half carry in the middle!

    0x1234 + 0x6743
    is worked out in 8 bits as:
    0x34 + 0x43 == 0x77 plus a zero carry
    and 0x12 + 0x67 + 0 == 0x79

    == 0x7977

    It's not done quite that way with decimals (because floating point arithmetic is a lot more complex) but that's the general idea. Think about it: you are a base ten processor: but there is no limit on how big a pair of numbers you can do arithmetic with!

    You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    P 1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      How do you think 8 bit processors handled 16 bit integers? It's not difficult: you just have a half carry in the middle!

      0x1234 + 0x6743
      is worked out in 8 bits as:
      0x34 + 0x43 == 0x77 plus a zero carry
      and 0x12 + 0x67 + 0 == 0x79

      == 0x7977

      It's not done quite that way with decimals (because floating point arithmetic is a lot more complex) but that's the general idea. Think about it: you are a base ten processor: but there is no limit on how big a pair of numbers you can do arithmetic with!

      You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #4

      You had me at

      OriginalGriff wrote:

      how big a pair

      OriginalGriffO 1 Reply Last reply
      0
      • C computerpublic

        Hello, I have some issues with the understanding of how it is possible to use a the 128 bit Decimal Type on my 64 bit computer. Somehow the logic doesn't seem to come to me. Can someone please explain how this is possible? Thank You.

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #5

        See also: http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx[^]

        1 Reply Last reply
        0
        • P PIEBALDconsult

          You had me at

          OriginalGriff wrote:

          how big a pair

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #6

          Clubs? Spades? :InnocentWhistleSmiley:

          You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          P 1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Clubs? Spades? :InnocentWhistleSmiley:

            You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #7

            At clubs usually. As for the other, I hesitate to use such language.

            OriginalGriffO 1 Reply Last reply
            0
            • P PIEBALDconsult

              At clubs usually. As for the other, I hesitate to use such language.

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #8

              Grief! That's a term I hadn't heard or thought about for decades. I assumed that died in the 70's!

              You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              P 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Grief! That's a term I hadn't heard or thought about for decades. I assumed that died in the 70's!

                You looking for sympathy? You'll find it in the dictionary, between sympathomimetic and sympatric (Page 1788, if it helps)

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #9

                Yeah, it's not used so much anymore. It appears in "Streets of Fire" (circa 1984) and if I recall correctly, Bill Maher used it a while back.

                1 Reply Last reply
                0
                • C computerpublic

                  Hello, I have some issues with the understanding of how it is possible to use a the 128 bit Decimal Type on my 64 bit computer. Somehow the logic doesn't seem to come to me. Can someone please explain how this is possible? Thank You.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #10

                  It's not a type directly supported with processor instructions dedicated to it. You can look at its source[^] to see how it works (does not include the source of some math operations and so on, but shows their function names).

                  1 Reply Last reply
                  0
                  • C computerpublic

                    Hello, I have some issues with the understanding of how it is possible to use a the 128 bit Decimal Type on my 64 bit computer. Somehow the logic doesn't seem to come to me. Can someone please explain how this is possible? Thank You.

                    R Offline
                    R Offline
                    Ravi Bhavnani
                    wrote on last edited by
                    #11

                    You may be confusing addressing space with data size. A 64-bit computer can address 264 bytes.  An instance of a 128 bit decimal type (located somewhere in the address space) occupies 16 bytes. /ravi

                    My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

                    1 Reply Last reply
                    0
                    • C computerpublic

                      Hello, I have some issues with the understanding of how it is possible to use a the 128 bit Decimal Type on my 64 bit computer. Somehow the logic doesn't seem to come to me. Can someone please explain how this is possible? Thank You.

                      J Offline
                      J Offline
                      jschell
                      wrote on last edited by
                      #12

                      computerpublic wrote:

                      Somehow the logic doesn't seem to come to me

                      Might help if you wrote your own class to do infinite digit integer handling. So you want a class that can take a 50 digit integer and add a different 50 digit integer to it. Each class instance represents a single number. So the add operation would look like the following. MyInt op1 = new MyInt("1000....001"); MyInt op2 = new MyInt("9000....019"); MyInt result = op1.add(op2);

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups