Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

main()
{
float a=8.8;
double b=8.8;
if(a==b)
printf("Equal");
else
printf("not equal");
getch();
}
what is the output?
with reason

Answer Posted / rakesh

It will print "not equal". Reason is the difference in
precision of the numbers. ie numbers like 8.8 or 8.1 can't
be stored with complete precision in binary sysetm since
it's mantissa part will not end but continues with a
series. So value calculated for single precision(float)
number will be slightly different from the value calculated
for double precision (double) number. To verify this use
gcc and gdb in linux.

If you try with numbers 8.25, 8.5 or 8.75 the program will
print "equal" since the mantissa part ends with in the
precision.

I think this has nothing to do with compiler version or
inabilty of comparision.

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between array and pointer?

1012


What is dynamic dispatch in c++?

1053


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

2296


How was c created?

1049


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1977


Is c still used?

1045


Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.

1400


What is data type long in c?

1076


How can I send mail from within a c program?

1024


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

1092


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

2176


Is c a great language, or what?

1109


What is the difference between printf and scanf )?

1090


What is function definition in c?

1077


Can i use “int” data type to store the value 32768? Why?

1187