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. Other Discussions
  3. Clever Code
  4. 1+1=3

1+1=3

Scheduled Pinned Locked Moved Clever Code
helpdesigndebuggingquestionlearning
9 Posts 7 Posters 5 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.
  • R Offline
    R Offline
    Robert Ranck
    wrote on last edited by
    #1

    My most memorable subtle bug experience dates back about 14 years. I had just coded a fairly complex piece of logic, but I had worked through the design and coding very meticulously and was certain it would work. But of course it didn't. On a second careful review of the design and code, everything still seemed to be in order. With no good debugger in the coding environment, I began peppering my code with debugging statements to narrow in on the bug. Then I began replacing complex sections of code with simple statements which of course no longer implemented my logic but still demonstrated the bug. After two full days of debugging effort, my broken code was finally reduced to one simple statement along the lines of... print(1+1) ... which produced a result of 3 !?!? After staring at that for quite some time, I ran Windows calculator and typed in "1+1=", and was again greeted with a 3. The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

    B M G E 4 Replies Last reply
    0
    • R Robert Ranck

      My most memorable subtle bug experience dates back about 14 years. I had just coded a fairly complex piece of logic, but I had worked through the design and coding very meticulously and was certain it would work. But of course it didn't. On a second careful review of the design and code, everything still seemed to be in order. With no good debugger in the coding environment, I began peppering my code with debugging statements to narrow in on the bug. Then I began replacing complex sections of code with simple statements which of course no longer implemented my logic but still demonstrated the bug. After two full days of debugging effort, my broken code was finally reduced to one simple statement along the lines of... print(1+1) ... which produced a result of 3 !?!? After staring at that for quite some time, I ran Windows calculator and typed in "1+1=", and was again greeted with a 3. The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

      B Offline
      B Offline
      Bradml
      wrote on last edited by
      #2

      hahaha. That would give me the sh***. I had a similiar experience. I was experiencing a lot of lags, crash and general software mal functions. I had been writing my own applications that did some advanced things on the machine (Things i have since learned to just leave the f* alone). Fianly out of desperation i thought, maybe my CPU has become covered in a thick layer of dirt and this is causing malfunctions. I went to open the box and was promptly greated with the answer to my quest for the culprit. The Windows XP sticker.

      Brad Australian Have you tried Rebooting it?

      1 Reply Last reply
      0
      • R Robert Ranck

        My most memorable subtle bug experience dates back about 14 years. I had just coded a fairly complex piece of logic, but I had worked through the design and coding very meticulously and was certain it would work. But of course it didn't. On a second careful review of the design and code, everything still seemed to be in order. With no good debugger in the coding environment, I began peppering my code with debugging statements to narrow in on the bug. Then I began replacing complex sections of code with simple statements which of course no longer implemented my logic but still demonstrated the bug. After two full days of debugging effort, my broken code was finally reduced to one simple statement along the lines of... print(1+1) ... which produced a result of 3 !?!? After staring at that for quite some time, I ran Windows calculator and typed in "1+1=", and was again greeted with a 3. The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

        M Offline
        M Offline
        Monty2
        wrote on last edited by
        #3

        Robert Ranck wrote:

        The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

        Wow didn't know that can happen, really weird :)


        You can't see me :cool:

        R 1 Reply Last reply
        0
        • M Monty2

          Robert Ranck wrote:

          The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

          Wow didn't know that can happen, really weird :)


          You can't see me :cool:

          R Offline
          R Offline
          Roger Stoltz
          wrote on last edited by
          #4

          Yeah, usually the original code doesn't work...;P


          "It's supposed to be hard, otherwise anybody could do it!" - selfquote

          "No one remembers a coward!" - Jan Elfström 1998
          "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above

          1 Reply Last reply
          0
          • R Robert Ranck

            My most memorable subtle bug experience dates back about 14 years. I had just coded a fairly complex piece of logic, but I had worked through the design and coding very meticulously and was certain it would work. But of course it didn't. On a second careful review of the design and code, everything still seemed to be in order. With no good debugger in the coding environment, I began peppering my code with debugging statements to narrow in on the bug. Then I began replacing complex sections of code with simple statements which of course no longer implemented my logic but still demonstrated the bug. After two full days of debugging effort, my broken code was finally reduced to one simple statement along the lines of... print(1+1) ... which produced a result of 3 !?!? After staring at that for quite some time, I ran Windows calculator and typed in "1+1=", and was again greeted with a 3. The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

            G Offline
            G Offline
            Gary R Wheeler
            wrote on last edited by
            #5

            Are you sure the math coprocessor chip actually failed? It might have just been using large values of 1.


            Software Zen: delete this;

            Fold With Us![^]

            A 1 Reply Last reply
            0
            • G Gary R Wheeler

              Are you sure the math coprocessor chip actually failed? It might have just been using large values of 1.


              Software Zen: delete this;

              Fold With Us![^]

              A Offline
              A Offline
              Anton Afanasyev
              wrote on last edited by
              #6

              can you say, overclocking?


              :badger:

              1 Reply Last reply
              0
              • R Robert Ranck

                My most memorable subtle bug experience dates back about 14 years. I had just coded a fairly complex piece of logic, but I had worked through the design and coding very meticulously and was certain it would work. But of course it didn't. On a second careful review of the design and code, everything still seemed to be in order. With no good debugger in the coding environment, I began peppering my code with debugging statements to narrow in on the bug. Then I began replacing complex sections of code with simple statements which of course no longer implemented my logic but still demonstrated the bug. After two full days of debugging effort, my broken code was finally reduced to one simple statement along the lines of... print(1+1) ... which produced a result of 3 !?!? After staring at that for quite some time, I ran Windows calculator and typed in "1+1=", and was again greeted with a 3. The fix? After replacing a failed math coprocessor chip, my original code worked just fine.

                E Offline
                E Offline
                Ennis Ray Lynch Jr
                wrote on last edited by
                #7

                1 = 2; is a legal statement and actually overwrites one.


                On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage

                A 1 Reply Last reply
                0
                • E Ennis Ray Lynch Jr

                  1 = 2; is a legal statement and actually overwrites one.


                  On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage

                  A Offline
                  A Offline
                  Anton Afanasyev
                  wrote on last edited by
                  #8

                  in which case 1=2; 1+1 == 4??? or can you 1=1.5f; // ?;P


                  :badger:

                  E 1 Reply Last reply
                  0
                  • A Anton Afanasyev

                    in which case 1=2; 1+1 == 4??? or can you 1=1.5f; // ?;P


                    :badger:

                    E Offline
                    E Offline
                    Ennis Ray Lynch Jr
                    wrote on last edited by
                    #9

                    Assigning 2 to 1 would overwrite the value of 1 in some early languages. I don't remember which one I just remember it from comparative languages.


                    On two occasions I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. - Charles Babbage

                    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