float overflow in c

What will happen if we will go beyond the range of float, double and long double data type?
Answer:

If we will assign a value which is beyond the maximum value of that data type compiler will assign +INF if number is positive and –INF if number is negative. If we will assign a value witch is less than minimum value of that data type then complier will assign a garbage value or zero. 



double data type overflow :



For example: What will be output of following c code?

#include<stdio.h>
int main(){
    float pmax= 3.5e38f;
    float nmin=-3.3e38f;
    float min= 1.0e-38f;
    printf("%f  %f  %f",pmax,nmin,min);
    return 0;
}

Overflow of char data type in c programming
Overflow of int data type in c programming
Overflow of long int data type in c programming
Overflow of float data type in c programming
Overflow of enum data type in c programming
Data type tutorial home
C tutorial home.

3 comments:

Unknown said...

ans. of program is
pmax=+INF
nmin=-32999999654827121000000000000000000000.0
min=0.000000

Unknown said...

Plz explain the ans of second one

d47bheu5ru said...

However, 카지노사이트.online behind the tough exterior, you’ll discover a first rate card recreation with solely three attainable outcomes per hand. In reality, there’s little to no skill required to get began. Stephany loves gaming, she is especially fond of bingo games, blackjack, slot machines, and old fashioned Nintendo.