pow() function is giving very strange outputs.
I tried various combinations :
#include<stdio.h>
#include<math.h>
int main()
{
int d=1;
long long n1,n2;
while(d<10)
{
n1=pow(10,d);
n2=pow(10,d);
d++;
printf("%lld %lld\n",n1,n2);
}
}
this gives the wrong output i.e. 99 instead of 100 and like that.
now if i remove one of the variables, ans. is correct. if instead of d, i use a constant, ans is correct. if i take n1 and n2 as double, ans is correct.
So having two pow() functions with both having variables as the power and type casted as integers is giving bad output. Why this strange behaviour??