How to convert -1x10^200 to IEEE 754 double precision











up vote
-1
down vote

favorite












So like above, I want to find the IEEE 754 representation of -1x10^200.



I know we can get the sign be to be 1, as we have a negative number. However I am unsure of how to find the mantissa/exponent. My initial idea was to convert 10^200 to 2^x. However x is not a whole number. So I figure we need to get a fraction somehow by separating the 10^200 somehow. Theoretically one could use very long devision, but I am looking for a more elegant answer that can be done without a high precision calculator.










share|improve this question


























    up vote
    -1
    down vote

    favorite












    So like above, I want to find the IEEE 754 representation of -1x10^200.



    I know we can get the sign be to be 1, as we have a negative number. However I am unsure of how to find the mantissa/exponent. My initial idea was to convert 10^200 to 2^x. However x is not a whole number. So I figure we need to get a fraction somehow by separating the 10^200 somehow. Theoretically one could use very long devision, but I am looking for a more elegant answer that can be done without a high precision calculator.










    share|improve this question
























      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      So like above, I want to find the IEEE 754 representation of -1x10^200.



      I know we can get the sign be to be 1, as we have a negative number. However I am unsure of how to find the mantissa/exponent. My initial idea was to convert 10^200 to 2^x. However x is not a whole number. So I figure we need to get a fraction somehow by separating the 10^200 somehow. Theoretically one could use very long devision, but I am looking for a more elegant answer that can be done without a high precision calculator.










      share|improve this question













      So like above, I want to find the IEEE 754 representation of -1x10^200.



      I know we can get the sign be to be 1, as we have a negative number. However I am unsure of how to find the mantissa/exponent. My initial idea was to convert 10^200 to 2^x. However x is not a whole number. So I figure we need to get a fraction somehow by separating the 10^200 somehow. Theoretically one could use very long devision, but I am looking for a more elegant answer that can be done without a high precision calculator.







      c++ floating-point binary double ieee-754






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 1:12









      Philip Bal

      137




      137
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote



          accepted










          −10200 cannot be represented in IEEE-754 basic 64-bit binary format. The closest number that can be represented is -99999999999999996973312221251036165947450327545502362648241750950346848435554075534196338404706251868027512415973882408182135734368278484639385041047239877871023591066789981811181813306167128854888448.



          The encoding of this in the 64-bit format is 0xe974e718d7d7625a. It has a sign of − (encoded as 1 in bit 63), an exponent of 664 (encoded as 1687 or 0x697 in bits 62 to 52), and a significand of 0x1.4e718d7d7625a (encoded as 0x4e718d7d7625a in bits 51 to 0).



          Given that the exponent is 664, you can find the significand by dividing 10200 by 2664, writing the result in binary, and rounding after 52 bits after the radix point. Alternately, after dividing by 2664, multiply by 252 and round to an integer.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            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: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244980%2fhow-to-convert-1x10200-to-ieee-754-double-precision%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            5
            down vote



            accepted










            −10200 cannot be represented in IEEE-754 basic 64-bit binary format. The closest number that can be represented is -99999999999999996973312221251036165947450327545502362648241750950346848435554075534196338404706251868027512415973882408182135734368278484639385041047239877871023591066789981811181813306167128854888448.



            The encoding of this in the 64-bit format is 0xe974e718d7d7625a. It has a sign of − (encoded as 1 in bit 63), an exponent of 664 (encoded as 1687 or 0x697 in bits 62 to 52), and a significand of 0x1.4e718d7d7625a (encoded as 0x4e718d7d7625a in bits 51 to 0).



            Given that the exponent is 664, you can find the significand by dividing 10200 by 2664, writing the result in binary, and rounding after 52 bits after the radix point. Alternately, after dividing by 2664, multiply by 252 and round to an integer.






            share|improve this answer

























              up vote
              5
              down vote



              accepted










              −10200 cannot be represented in IEEE-754 basic 64-bit binary format. The closest number that can be represented is -99999999999999996973312221251036165947450327545502362648241750950346848435554075534196338404706251868027512415973882408182135734368278484639385041047239877871023591066789981811181813306167128854888448.



              The encoding of this in the 64-bit format is 0xe974e718d7d7625a. It has a sign of − (encoded as 1 in bit 63), an exponent of 664 (encoded as 1687 or 0x697 in bits 62 to 52), and a significand of 0x1.4e718d7d7625a (encoded as 0x4e718d7d7625a in bits 51 to 0).



              Given that the exponent is 664, you can find the significand by dividing 10200 by 2664, writing the result in binary, and rounding after 52 bits after the radix point. Alternately, after dividing by 2664, multiply by 252 and round to an integer.






              share|improve this answer























                up vote
                5
                down vote



                accepted







                up vote
                5
                down vote



                accepted






                −10200 cannot be represented in IEEE-754 basic 64-bit binary format. The closest number that can be represented is -99999999999999996973312221251036165947450327545502362648241750950346848435554075534196338404706251868027512415973882408182135734368278484639385041047239877871023591066789981811181813306167128854888448.



                The encoding of this in the 64-bit format is 0xe974e718d7d7625a. It has a sign of − (encoded as 1 in bit 63), an exponent of 664 (encoded as 1687 or 0x697 in bits 62 to 52), and a significand of 0x1.4e718d7d7625a (encoded as 0x4e718d7d7625a in bits 51 to 0).



                Given that the exponent is 664, you can find the significand by dividing 10200 by 2664, writing the result in binary, and rounding after 52 bits after the radix point. Alternately, after dividing by 2664, multiply by 252 and round to an integer.






                share|improve this answer












                −10200 cannot be represented in IEEE-754 basic 64-bit binary format. The closest number that can be represented is -99999999999999996973312221251036165947450327545502362648241750950346848435554075534196338404706251868027512415973882408182135734368278484639385041047239877871023591066789981811181813306167128854888448.



                The encoding of this in the 64-bit format is 0xe974e718d7d7625a. It has a sign of − (encoded as 1 in bit 63), an exponent of 664 (encoded as 1687 or 0x697 in bits 62 to 52), and a significand of 0x1.4e718d7d7625a (encoded as 0x4e718d7d7625a in bits 51 to 0).



                Given that the exponent is 664, you can find the significand by dividing 10200 by 2664, writing the result in binary, and rounding after 52 bits after the radix point. Alternately, after dividing by 2664, multiply by 252 and round to an integer.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 11 at 2:27









                Eric Postpischil

                69.7k874150




                69.7k874150






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244980%2fhow-to-convert-1x10200-to-ieee-754-double-precision%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Guess what letter conforming each word

                    Port of Spain

                    Run scheduled task as local user group (not BUILTIN)