Understanding casts from integer to float
Could someone explain this weird looking output on a 32 bit machine? #include <stdio.h> int main() { printf("16777217 as float is %.1f\n",(float)16777217); printf("16777219 as float is %.1f\n",(float)16777219); return 0; } Output 16777217 as float is 16777216.0 16777219 as float is 16777220.0 The weird thing is that 16777217 casts to a lower value and 16777219 casts to a higher value...
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.