What is the largest double available on yourmachine? What happens when you go be
ID: 3609685 • Letter: W
Question
What is the largest double available on yourmachine? What happens when you go beyond this value? Experiment byrunning the following program:# include <stdio.h>
#include <float.h>
int main(void)
{
double x = 1.0, y = -1.0, z =0.0;
printf("The largest double: %.3e ",DBL_MAX);
printf(" Add a little bit:%.3e ", DBL_MAX+ 1.0) ;
printf(" Add alot: %.3e ",
DBL_MAX + DBL_MAX);
printf(" Divisionby zero: %.3e %.3e ",
x / z, y / z);
return 0;
}
Modify the program so that it alsoprints out the largest floatavailable on your machine. Is it a lotsmaller than the largest double?Hint: read the header file float.h on yoursystem.
Explanation / Answer
//Hope this will help you.. Ouput of the above program will be : /* The largest double: 1.798e+308 Add a little bit: 1.798e+308 Add a lot: inf Division by zero: inf -inf */ So the maximum value of double in my machine is 1.798e+308 This value may be different for different machine. /* For float value The float : 3.403e+38 Add a little bit: 3.403e+38 Add a lot: inf Division by zero: inf -inf */ So the maximum value of float is 3.403e+38
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.