c++ cZar
Sunday, August 17, 2008
pow function - float and int
pow returns double. So if you try to store its return value in int , you may get some problem.
eg. consider the following
int a,b,c;
float d;
now if you try :
a = pow(10,2);
then a = 99
but if you try
d= pow (10,2); or try out cout<<pow(10,2)
you will get 100.
Blogged with the
Flock Browser
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment