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.
c++ floating-point binary double ieee-754
add a comment |
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.
c++ floating-point binary double ieee-754
add a comment |
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.
c++ floating-point binary double ieee-754
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
c++ floating-point binary double ieee-754
asked Nov 11 at 1:12
Philip Bal
137
137
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
add a comment |
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.
−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.
answered Nov 11 at 2:27
Eric Postpischil
69.7k874150
69.7k874150
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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