Stephen Tu
2008-07-21 18:55:31 UTC
i have a question off one of garcia's past midterms:
Q: The result of casting the double number
closest to -? (but is not -?) into a float.
A: -inf
i am not sure how double -> float casting works. the double closest to
-inf (correct me if i'm wrong please is):
1 11111111110 1111...1111 (52 1's)
(there is a zero in the rightmost bit of the exp since it if it were all
ones then it would be a reserved number (NaN). )
so when we cast this number to float, what happens? does it take the 8
most significant bits from the Exp and the 23 most sig bits, and make it
a 32 bit float (keeping the sign) ? how do they get -inf?
thanks
Q: The result of casting the double number
closest to -? (but is not -?) into a float.
A: -inf
i am not sure how double -> float casting works. the double closest to
-inf (correct me if i'm wrong please is):
1 11111111110 1111...1111 (52 1's)
(there is a zero in the rightmost bit of the exp since it if it were all
ones then it would be a reserved number (NaN). )
so when we cast this number to float, what happens? does it take the 8
most significant bits from the Exp and the 23 most sig bits, and make it
a 32 bit float (keeping the sign) ? how do they get -inf?
thanks