The minimum negative integer value that can be represented using 32-bit signed representation

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












As far as signed binary numbers are concerned for a 32bit machine, the leftmost bit is allocated for the sign. When I try to calculate the smallest negative integer value which can be stored in a machine, i follow the following steps:



  1. I assign the most significant bit as 1 (because it is negative)

  2. I place 1's into the remaining bits, thus the number of 1's I have for the magnitude of the number is 31.

  3. I convert this binary number to decimal:

$$ 2^30+ 2^29+...+2^1+2^0=2^31-1 $$



  1. With the negative sign, the smallest number is $$1-2^31$$

However the following source says otherwise. It says the smallest value is $$ -2^31$$ on the third page.



https://www.uio.no/studier/emner/matnat/math/MAT-INF1100/h12/kompendiet/kap4.pdf



What am I doing wrong here?







share|cite|improve this question























    up vote
    0
    down vote

    favorite












    As far as signed binary numbers are concerned for a 32bit machine, the leftmost bit is allocated for the sign. When I try to calculate the smallest negative integer value which can be stored in a machine, i follow the following steps:



    1. I assign the most significant bit as 1 (because it is negative)

    2. I place 1's into the remaining bits, thus the number of 1's I have for the magnitude of the number is 31.

    3. I convert this binary number to decimal:

    $$ 2^30+ 2^29+...+2^1+2^0=2^31-1 $$



    1. With the negative sign, the smallest number is $$1-2^31$$

    However the following source says otherwise. It says the smallest value is $$ -2^31$$ on the third page.



    https://www.uio.no/studier/emner/matnat/math/MAT-INF1100/h12/kompendiet/kap4.pdf



    What am I doing wrong here?







    share|cite|improve this question





















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      As far as signed binary numbers are concerned for a 32bit machine, the leftmost bit is allocated for the sign. When I try to calculate the smallest negative integer value which can be stored in a machine, i follow the following steps:



      1. I assign the most significant bit as 1 (because it is negative)

      2. I place 1's into the remaining bits, thus the number of 1's I have for the magnitude of the number is 31.

      3. I convert this binary number to decimal:

      $$ 2^30+ 2^29+...+2^1+2^0=2^31-1 $$



      1. With the negative sign, the smallest number is $$1-2^31$$

      However the following source says otherwise. It says the smallest value is $$ -2^31$$ on the third page.



      https://www.uio.no/studier/emner/matnat/math/MAT-INF1100/h12/kompendiet/kap4.pdf



      What am I doing wrong here?







      share|cite|improve this question











      As far as signed binary numbers are concerned for a 32bit machine, the leftmost bit is allocated for the sign. When I try to calculate the smallest negative integer value which can be stored in a machine, i follow the following steps:



      1. I assign the most significant bit as 1 (because it is negative)

      2. I place 1's into the remaining bits, thus the number of 1's I have for the magnitude of the number is 31.

      3. I convert this binary number to decimal:

      $$ 2^30+ 2^29+...+2^1+2^0=2^31-1 $$



      1. With the negative sign, the smallest number is $$1-2^31$$

      However the following source says otherwise. It says the smallest value is $$ -2^31$$ on the third page.



      https://www.uio.no/studier/emner/matnat/math/MAT-INF1100/h12/kompendiet/kap4.pdf



      What am I doing wrong here?









      share|cite|improve this question










      share|cite|improve this question




      share|cite|improve this question









      asked Jul 25 at 13:44









      Ali Kıral

      11




      11




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          1
          down vote













          The smallest negative number is a $1$ followed by $31$ zeros which is interpreted as $-2^31.$ Because twos' complement is essentially arithmetic modulo $2^32,$ it would be equally logical to interpret it as $2^31.$ The negative value is chosen so that the negative integers are precisely those with a $1$ as the most significant bit.






          share|cite|improve this answer





















          • Thank you very much Sir
            – Ali Kıral
            Jul 25 at 14:04










          • @AliKıral It was my pleasure.
            – saulspatz
            Jul 25 at 14:05

















          up vote
          1
          down vote













          Your calculation in itself is correct. However, there are more efficient ways to represent negative integers than sign & magnitude, which is the method you use. Such methods include "two's complement", which is in fact described in the link you provided. When they write that the smallest negative integer we can represent is $-2^31$ they refer to the more efficient methods, and not the naive method. I suggest you continue to read the section about two's complement and maybe then it will all make more sense.






          share|cite|improve this answer





















          • Thank you for your time, I am going to read the remaining part
            – Ali Kıral
            Jul 25 at 14:05

















          up vote
          1
          down vote













          You are assuming the representation is signed-magnitude, which is a valid representation of negative numbers. Your answer is correct for that representation. Most computers use two's complement, which allows one more negative value. The most negative value is $1$ followed by $31$ zeros and represents $-2^-31$. The motivation is that you can do arithmetic in two's complement without worrying about whether numbers are positive or negative and it comes out right, simplifying the design of the chip.






          share|cite|improve this answer





















          • Thank you for your input
            – Ali Kıral
            Jul 25 at 14:04

















          up vote
          0
          down vote













          In the two's complement representation,



          $$beginalign
          000&to0
          \001&to1
          \010&to2
          \011&to3
          \100&to-4
          \101&to-3
          \110&to-2
          \111&to-1
          endalign$$



          In this representation, the values are in increasing order (except for the $3/-4$ jump), so that virtually the same adder can be used for unsigned and signed additions/subtractions.






          share|cite|improve this answer





















            Your Answer




            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "69"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2862426%2fthe-minimum-negative-integer-value-that-can-be-represented-using-32-bit-signed-r%23new-answer', 'question_page');

            );

            Post as a guest






























            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            The smallest negative number is a $1$ followed by $31$ zeros which is interpreted as $-2^31.$ Because twos' complement is essentially arithmetic modulo $2^32,$ it would be equally logical to interpret it as $2^31.$ The negative value is chosen so that the negative integers are precisely those with a $1$ as the most significant bit.






            share|cite|improve this answer





















            • Thank you very much Sir
              – Ali Kıral
              Jul 25 at 14:04










            • @AliKıral It was my pleasure.
              – saulspatz
              Jul 25 at 14:05














            up vote
            1
            down vote













            The smallest negative number is a $1$ followed by $31$ zeros which is interpreted as $-2^31.$ Because twos' complement is essentially arithmetic modulo $2^32,$ it would be equally logical to interpret it as $2^31.$ The negative value is chosen so that the negative integers are precisely those with a $1$ as the most significant bit.






            share|cite|improve this answer





















            • Thank you very much Sir
              – Ali Kıral
              Jul 25 at 14:04










            • @AliKıral It was my pleasure.
              – saulspatz
              Jul 25 at 14:05












            up vote
            1
            down vote










            up vote
            1
            down vote









            The smallest negative number is a $1$ followed by $31$ zeros which is interpreted as $-2^31.$ Because twos' complement is essentially arithmetic modulo $2^32,$ it would be equally logical to interpret it as $2^31.$ The negative value is chosen so that the negative integers are precisely those with a $1$ as the most significant bit.






            share|cite|improve this answer













            The smallest negative number is a $1$ followed by $31$ zeros which is interpreted as $-2^31.$ Because twos' complement is essentially arithmetic modulo $2^32,$ it would be equally logical to interpret it as $2^31.$ The negative value is chosen so that the negative integers are precisely those with a $1$ as the most significant bit.







            share|cite|improve this answer













            share|cite|improve this answer



            share|cite|improve this answer











            answered Jul 25 at 13:51









            saulspatz

            10.4k21323




            10.4k21323











            • Thank you very much Sir
              – Ali Kıral
              Jul 25 at 14:04










            • @AliKıral It was my pleasure.
              – saulspatz
              Jul 25 at 14:05
















            • Thank you very much Sir
              – Ali Kıral
              Jul 25 at 14:04










            • @AliKıral It was my pleasure.
              – saulspatz
              Jul 25 at 14:05















            Thank you very much Sir
            – Ali Kıral
            Jul 25 at 14:04




            Thank you very much Sir
            – Ali Kıral
            Jul 25 at 14:04












            @AliKıral It was my pleasure.
            – saulspatz
            Jul 25 at 14:05




            @AliKıral It was my pleasure.
            – saulspatz
            Jul 25 at 14:05










            up vote
            1
            down vote













            Your calculation in itself is correct. However, there are more efficient ways to represent negative integers than sign & magnitude, which is the method you use. Such methods include "two's complement", which is in fact described in the link you provided. When they write that the smallest negative integer we can represent is $-2^31$ they refer to the more efficient methods, and not the naive method. I suggest you continue to read the section about two's complement and maybe then it will all make more sense.






            share|cite|improve this answer





















            • Thank you for your time, I am going to read the remaining part
              – Ali Kıral
              Jul 25 at 14:05














            up vote
            1
            down vote













            Your calculation in itself is correct. However, there are more efficient ways to represent negative integers than sign & magnitude, which is the method you use. Such methods include "two's complement", which is in fact described in the link you provided. When they write that the smallest negative integer we can represent is $-2^31$ they refer to the more efficient methods, and not the naive method. I suggest you continue to read the section about two's complement and maybe then it will all make more sense.






            share|cite|improve this answer





















            • Thank you for your time, I am going to read the remaining part
              – Ali Kıral
              Jul 25 at 14:05












            up vote
            1
            down vote










            up vote
            1
            down vote









            Your calculation in itself is correct. However, there are more efficient ways to represent negative integers than sign & magnitude, which is the method you use. Such methods include "two's complement", which is in fact described in the link you provided. When they write that the smallest negative integer we can represent is $-2^31$ they refer to the more efficient methods, and not the naive method. I suggest you continue to read the section about two's complement and maybe then it will all make more sense.






            share|cite|improve this answer













            Your calculation in itself is correct. However, there are more efficient ways to represent negative integers than sign & magnitude, which is the method you use. Such methods include "two's complement", which is in fact described in the link you provided. When they write that the smallest negative integer we can represent is $-2^31$ they refer to the more efficient methods, and not the naive method. I suggest you continue to read the section about two's complement and maybe then it will all make more sense.







            share|cite|improve this answer













            share|cite|improve this answer



            share|cite|improve this answer











            answered Jul 25 at 13:55









            Dean Gurvitz

            287




            287











            • Thank you for your time, I am going to read the remaining part
              – Ali Kıral
              Jul 25 at 14:05
















            • Thank you for your time, I am going to read the remaining part
              – Ali Kıral
              Jul 25 at 14:05















            Thank you for your time, I am going to read the remaining part
            – Ali Kıral
            Jul 25 at 14:05




            Thank you for your time, I am going to read the remaining part
            – Ali Kıral
            Jul 25 at 14:05










            up vote
            1
            down vote













            You are assuming the representation is signed-magnitude, which is a valid representation of negative numbers. Your answer is correct for that representation. Most computers use two's complement, which allows one more negative value. The most negative value is $1$ followed by $31$ zeros and represents $-2^-31$. The motivation is that you can do arithmetic in two's complement without worrying about whether numbers are positive or negative and it comes out right, simplifying the design of the chip.






            share|cite|improve this answer





















            • Thank you for your input
              – Ali Kıral
              Jul 25 at 14:04














            up vote
            1
            down vote













            You are assuming the representation is signed-magnitude, which is a valid representation of negative numbers. Your answer is correct for that representation. Most computers use two's complement, which allows one more negative value. The most negative value is $1$ followed by $31$ zeros and represents $-2^-31$. The motivation is that you can do arithmetic in two's complement without worrying about whether numbers are positive or negative and it comes out right, simplifying the design of the chip.






            share|cite|improve this answer





















            • Thank you for your input
              – Ali Kıral
              Jul 25 at 14:04












            up vote
            1
            down vote










            up vote
            1
            down vote









            You are assuming the representation is signed-magnitude, which is a valid representation of negative numbers. Your answer is correct for that representation. Most computers use two's complement, which allows one more negative value. The most negative value is $1$ followed by $31$ zeros and represents $-2^-31$. The motivation is that you can do arithmetic in two's complement without worrying about whether numbers are positive or negative and it comes out right, simplifying the design of the chip.






            share|cite|improve this answer













            You are assuming the representation is signed-magnitude, which is a valid representation of negative numbers. Your answer is correct for that representation. Most computers use two's complement, which allows one more negative value. The most negative value is $1$ followed by $31$ zeros and represents $-2^-31$. The motivation is that you can do arithmetic in two's complement without worrying about whether numbers are positive or negative and it comes out right, simplifying the design of the chip.







            share|cite|improve this answer













            share|cite|improve this answer



            share|cite|improve this answer











            answered Jul 25 at 13:55









            Ross Millikan

            275k21186351




            275k21186351











            • Thank you for your input
              – Ali Kıral
              Jul 25 at 14:04
















            • Thank you for your input
              – Ali Kıral
              Jul 25 at 14:04















            Thank you for your input
            – Ali Kıral
            Jul 25 at 14:04




            Thank you for your input
            – Ali Kıral
            Jul 25 at 14:04










            up vote
            0
            down vote













            In the two's complement representation,



            $$beginalign
            000&to0
            \001&to1
            \010&to2
            \011&to3
            \100&to-4
            \101&to-3
            \110&to-2
            \111&to-1
            endalign$$



            In this representation, the values are in increasing order (except for the $3/-4$ jump), so that virtually the same adder can be used for unsigned and signed additions/subtractions.






            share|cite|improve this answer

























              up vote
              0
              down vote













              In the two's complement representation,



              $$beginalign
              000&to0
              \001&to1
              \010&to2
              \011&to3
              \100&to-4
              \101&to-3
              \110&to-2
              \111&to-1
              endalign$$



              In this representation, the values are in increasing order (except for the $3/-4$ jump), so that virtually the same adder can be used for unsigned and signed additions/subtractions.






              share|cite|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                In the two's complement representation,



                $$beginalign
                000&to0
                \001&to1
                \010&to2
                \011&to3
                \100&to-4
                \101&to-3
                \110&to-2
                \111&to-1
                endalign$$



                In this representation, the values are in increasing order (except for the $3/-4$ jump), so that virtually the same adder can be used for unsigned and signed additions/subtractions.






                share|cite|improve this answer













                In the two's complement representation,



                $$beginalign
                000&to0
                \001&to1
                \010&to2
                \011&to3
                \100&to-4
                \101&to-3
                \110&to-2
                \111&to-1
                endalign$$



                In this representation, the values are in increasing order (except for the $3/-4$ jump), so that virtually the same adder can be used for unsigned and signed additions/subtractions.







                share|cite|improve this answer













                share|cite|improve this answer



                share|cite|improve this answer











                answered Jul 25 at 14:01









                Yves Daoust

                111k665203




                111k665203






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2862426%2fthe-minimum-negative-integer-value-that-can-be-represented-using-32-bit-signed-r%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What is the equation of a 3D cone with generalised tilt?

                    Color the edges and diagonals of a regular polygon

                    Relationship between determinant of matrix and determinant of adjoint?