Johntopia
Johntopia

Reputation: 353

How does C work when int is converted to float?

If we have a 32bit pattern of 1111 1111 1000 0000 0000 0000 0000 0000, which is -2^23 in int, when we convert int to float will this be -INF?

Upvotes: 1

Views: 81

Answers (1)

R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215193

Conversions in C operate on values, and the value -2^23 is representable in float, so the result of the conversion is the value -2^23.

Upvotes: 3

Related Questions