We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi folk, I have
u16 wTemp = 0; fsingle fTemp = 17.5123; wTemp = (u16)fTemp;
"Technically, the wTemp should be 18" No; 17 is correct: "When a value of floating type is converted to integral type, the fractional part is discarded" [1] (my emphasis). That's precisely what "truncate" means! [1] Appendix A, K&R, "The C Programming Language, 2/ed"