Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I mentioned in class that 13! 1932053504 is wrong for data type int (caused by overflow) Below is my result of running smallfact2.java (posted at
I mentioned in class that 13! 1932053504 is wrong for data type int (caused by overflow) Below is my result of running smallfact2.java (posted at the end of module 1) for short, int, long, float, and double 13! in short is -13312 13! is 1932053504 13! in long is 6227020800 13! in float is 6.2270208E9 13! in double is 6.2270208E9 (a) (3%) Is the result for int (=1932053504) right? Why? 1 (b) (10%) why the output for 13! for int data type is calculated to be 1932053504? Show how you can calculate to get this number. (c) (5%) We see that 13! for short, int, and long are all different. Which one ifs right? (or all three are wrong?) (or all three though looking different, are all correct) (d) (10%) We see that 13! Calculated for long (6227020800) and for float and double (6.2270208E9) look a little bit different. Does this mean only the result for long is correct (and result for float and double are wrong), or only the result for float and double are right and the result for long is wrong, or all 3 results are right, or all 3 results are wrong? Explain! (e) (7%) Explain why for short, 13! is calculated to be -13312
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started