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. The Lounge
  3. A gentle puzzle I was just asked.

A gentle puzzle I was just asked.

Scheduled Pinned Locked Moved The Lounge
questioncomlounge
80 Posts 44 Posters 4 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.
  • L Lost User

    Well, considering the largest negative integer tends to infinity…

    R Offline
    R Offline
    raddevus
    wrote on last edited by
    #46

    Which one is true? 1. -Infinity > -1 2. -1 > -Infinity JavaScript says that the first is false and second is true -- see snapshot[^]. Pretty sure that JS has the definitive answer, since it's the Best Programming Language ever! :rolleyes: Sorry, just trolling all programming nerds. :laugh: But seriously, don't you think that is right?

    Number.NEGATIVE_INFINITY > -1 // false
    Number.NEGATIVE_INFINITY < -1 // true

    // a little clearer about my meaning
    -1 > Number.NEGATIVE_INFINITY // TRUE

    So largest negative integer = -1 :)

    1 Reply Last reply
    0
    • M MarkTJohnson

      The largest negative integer is the negative integer that is greater than all other negative integers. hence -1. Hopefully this isn't devolving into a political conversation.

      I’ve given up trying to be calm. However, I am open to feeling slightly less agitated. I’m begging you for the benefit of everyone, don’t be STUPID.

      R Offline
      R Offline
      raddevus
      wrote on last edited by
      #47

      Check this out. It's JavaScript but...

      Number.MIN_VALUE < -1 // true
      Number.NEGATIVE_INFINITY > -1 // false
      // a little clearer
      -1 > Number.NEGATIVE_INFINITY // TRUE

      So the largest negative integer is -1. :thumbsup:

      H 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        So which is bigger: -1 or -2?

        "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 AntiTwitter: @DalekDave is now a follower!

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

        -∞

        J 1 Reply Last reply
        0
        • OriginalGriffO OriginalGriff

          What is the smallest positive integer minus the largest negative integer?

          "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 AntiTwitter: @DalekDave is now a follower!

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

          OriginalGriff wrote:

          What is the smallest positive integer minus the largest negative integer?

          Yeah, I resorted to asking a child. The smallest positive integer is 1. I can cope with that. The largest negative integer is infinite. She said infinite negative +1. I am still looking for a way to refute that.

          Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            What is the smallest positive integer minus the largest negative integer?

            "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 AntiTwitter: @DalekDave is now a follower!

            J Offline
            J Offline
            jmaida
            wrote on last edited by
            #50

            1 is smallest positive integer -infinity is largest negative integer 1 - (-infinity) is 1 + infinity is infinity oops my coffee cup is overflowing

            "A little time, a little trouble, your better day" Badfinger

            L 1 Reply Last reply
            0
            • A Amarnath S

              Smallest positive integer = 1 Largest negative integer = -1 Difference is 2.

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

              Largest negative. I had not noticed that. Reading correctly is half the battle. :thumbsup: Well done :suss:

              Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

              1 Reply Last reply
              0
              • J jmaida

                1 is smallest positive integer -infinity is largest negative integer 1 - (-infinity) is 1 + infinity is infinity oops my coffee cup is overflowing

                "A little time, a little trouble, your better day" Badfinger

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

                I fell for the same. -1 is larger than -10. The largest negative integer is -1. Infinity isn't in this game. Made me feel stupid and I loved it :thumbsup:

                Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                J 1 Reply Last reply
                0
                • L Lost User

                  I fell for the same. -1 is larger than -10. The largest negative integer is -1. Infinity isn't in this game. Made me feel stupid and I loved it :thumbsup:

                  Bastard Programmer from Hell :suss: "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

                  J Offline
                  J Offline
                  jmaida
                  wrote on last edited by
                  #53

                  All depends on one's definition of largest negative integer. The largest integer that is negative or the largest negative integer compared to all negative integers. The problem as stated is missing this clarity.

                  "A little time, a little trouble, your better day" Badfinger

                  1 Reply Last reply
                  0
                  • D dbrenth

                    This was my answer as well. Both the smallest positive and largest negative integers are 0. But I can see the case for both 2 and Infinity. Brent Hoskisson

                    Brent

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

                    Mathematically, zero is neither positive or negative ... :-D

                    "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 AntiTwitter: @DalekDave is now a follower!

                    "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

                    1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

                      Oh? Is -2 bigger than -1 now? :-D

                      "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 AntiTwitter: @DalekDave is now a follower!

                      D Offline
                      D Offline
                      Davyd McColl
                      wrote on last edited by
                      #55

                      For sure: if I have -$2, I owe the bank more than if I had -$1. $2 is a larger number, indicating a larger debt.

                      ------------------------------------------------ If you say that getting the money is the most important thing You will spend your life completely wasting your time You will be doing things you don't like doing In order to go on living That is, to go on doing things you don't like doing Which is stupid. - Alan Watts https://www.youtube.com/watch?v=-gXTZM\_uPMY

                      1 Reply Last reply
                      0
                      • OriginalGriffO OriginalGriff

                        What is the smallest positive integer minus the largest negative integer?

                        "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 AntiTwitter: @DalekDave is now a follower!

                        J Offline
                        J Offline
                        Jorgen Andersson
                        wrote on last edited by
                        #56

                        Silly me was thinking in Int32.

                        Wrong is evil and must be defeated. - Jeff Ello

                        1 Reply Last reply
                        0
                        • R raddevus

                          Check this out. It's JavaScript but...

                          Number.MIN_VALUE < -1 // true
                          Number.NEGATIVE_INFINITY > -1 // false
                          // a little clearer
                          -1 > Number.NEGATIVE_INFINITY // TRUE

                          So the largest negative integer is -1. :thumbsup:

                          H Offline
                          H Offline
                          haughtonomous
                          wrote on last edited by
                          #57

                          I think it's a bad mistake to assume that a computer implementation of a mathematical concept provides a correct definition, especially at the limits. But I agree that mathematically -1 is larger than -2. It's the distance from the extreme left of the number line (-infinity) that illustrates this. And zero is neutral, neither positive nor negative. And we're relying on ChatGPT for truth now? Lord help us!

                          R J 2 Replies Last reply
                          0
                          • OriginalGriffO OriginalGriff

                            What is the smallest positive integer minus the largest negative integer?

                            "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 AntiTwitter: @DalekDave is now a follower!

                            B Offline
                            B Offline
                            BernardIE5317
                            wrote on last edited by
                            #58

                            This should clear things up. Integer - Wikipedia[^]

                            1 Reply Last reply
                            0
                            • OriginalGriffO OriginalGriff

                              What is the smallest positive integer minus the largest negative integer?

                              "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 AntiTwitter: @DalekDave is now a follower!

                              J Offline
                              J Offline
                              jarvisa
                              wrote on last edited by
                              #59

                              The smallest positive integer is either 0 or 1 depending on whether 0 is considered positive or not. The largest negative integer is -1. So the answer is 1 or 2. This is not the intent of question but that is the correct answer given how the question was worded.

                              1 Reply Last reply
                              0
                              • R raddevus

                                MarkTJohnson wrote:

                                The largest negative integer is the negative integer that is greater than all other negative integers.

                                I thought the same thing. Also, isn't it interesting that on the other side of 0 that no one had a problem distinguishing the smallest positive integer : which is 1. Aren't all numbers greater than others when the are further to the right of other numbers? Also, do these people not believe that following are true? -5000 < -1 -1 > -5000 Then why don't they know that the largest negative integer is -1?

                                O Offline
                                O Offline
                                obeobe
                                wrote on last edited by
                                #60

                                Post-modernism.

                                1 Reply Last reply
                                0
                                • OriginalGriffO OriginalGriff

                                  What is the smallest positive integer minus the largest negative integer?

                                  "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 AntiTwitter: @DalekDave is now a follower!

                                  M Offline
                                  M Offline
                                  MikeCO10
                                  wrote on last edited by
                                  #61

                                  Halfway through my first cup of coffee, this sent me into overthink mode, coming up with everything from infinity to zero. It took some reading of comments to see the correct answer is indeed 2. Great question Griff.

                                  1 Reply Last reply
                                  0
                                  • OriginalGriffO OriginalGriff

                                    What is the smallest positive integer minus the largest negative integer?

                                    "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 AntiTwitter: @DalekDave is now a follower!

                                    M Offline
                                    M Offline
                                    Member 10652083
                                    wrote on last edited by
                                    #62

                                    You have to define 'largest'.

                                    OriginalGriffO 1 Reply Last reply
                                    0
                                    • M Member 10652083

                                      You have to define 'largest'.

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

                                      I don't - we have dictionaries to do that: :-D

                                      Quote:

                                      largest Definitions from the GNU version of the Collaborative International Dictionary of English. (adjective) Greatest in size of those under consideration. (adjective) maximal. from Wiktionary, Creative Commons Attribution/Share-Alike License. (adjective) Superlative form of large: most large.

                                      "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 AntiTwitter: @DalekDave is now a follower!

                                      "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

                                      M 1 Reply Last reply
                                      0
                                      • L Lost User

                                        -∞

                                        J Offline
                                        J Offline
                                        jochance
                                        wrote on last edited by
                                        #64

                                        ∞ + 1 Because: 1 - (-∞)

                                        1 Reply Last reply
                                        0
                                        • OriginalGriffO OriginalGriff

                                          What is the smallest positive integer minus the largest negative integer?

                                          "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 AntiTwitter: @DalekDave is now a follower!

                                          M Offline
                                          M Offline
                                          mdblack98
                                          wrote on last edited by
                                          #65

                                          Since this is a coding site here are the possibilities for a 32-bit int.

                                          #include #include int main()
                                          {
                                          int pos = 1;
                                          int neg = INT_MIN;
                                          printf("pos=%d neg=%d\n", pos,neg);
                                          printf("pos+neg=%d\n", pos+neg);
                                          printf("pos-neg=%d\n", pos-neg);
                                          printf("neg+pos=%d\n", neg+pos); // yes I know it's commutative but here for completeness
                                          printf("neg-pos=%d\n", neg-pos);
                                          return 0;
                                          }

                                          pos=1 neg=-2147483648
                                          pos+neg=-2147483647
                                          pos-neg=-2147483647 // Hmmm...this seems wrong -- subtracting negative SHOULD add it.
                                          neg+pos=-2147483647
                                          neg-pos=2147483647

                                          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