Unsure how to tell if an overflow is possible. I am given this sample code:
char x;
float f, g;
// some values get assigned to x and f here...
g = f + x;
Can someone please explain?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
float, at its highest limits (binary exponent of 127), does not have sufficient precision (23 bits) to show a difference of the largest possiblechar(127, 7 bits), and so overflow is not possible since addition will have no effect (a precision of 127-7=120 would be required).