Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Solutions to the following problems should consist of program codes, computed re

ID: 3671087 • Letter: S

Question

Solutions to the following problems should consist of program codes, computed results, and short write-ups. In the write-up, discuss the results you have obtained and explain them from the numerical point of view. Use SINGLE PRECISION ONLY. Insert COMMENTS in your programs. Using a technique explained in the class, calculate the number of mantissa digits and the unit round-off on the machine that you will use for this course. You need to know the number for analyzing errors in this and other home-works and, therefore, I will not be checking your computer projects until you show me a correct solution to this problem.

Explanation / Answer

//NUMERICAL ANALYSIS

//preprocessive directives for I/O operations

#include <stdio.h>
#include <float.h>
#include<conio.h>

int main()
{
//initializations

float a = 1;
float b = 0.5;
float c = a + b;
int bits = 1;
//logic   

while (c != a) {
bits = bits + 1;
b = b / 2;
c = a + b;
}
//Display the digits

printf("%d ",FLT_MANT_DIG);
//display the bits   

printf("%d ",bits);

//see the output

getch();
   return 0;
}

output :

24

24

explanation:The code will output

24

24

to show that calculated value matches the value in the header file

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote