For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2006 > Pow() doesn't give me the correct result









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Pow() doesn't give me the correct result
Ram

2006-09-16, 8:00 am

I tried to obtain the power of a number i.e say I used something like
pow(2.0,3.0) in my program. Initially it said error undefined symbol :
pow() . Then I linked the library libbsd.a. Then it got cmpiled but its
displayed some garbage value as output.

Can anybody let me know where I'm missing ?

Thanks
Ram

Rainer Temme

2006-09-16, 8:00 am

Ram wrote:
> I tried to obtain the power of a number i.e say I used something like
> pow(2.0,3.0) in my program. Initially it said error undefined symbol :
> pow() . Then I linked the library libbsd.a. Then it got cmpiled but its
> displayed some garbage value as output.
>
> Can anybody let me know where I'm missing ?


#include <math.h>

Rainer
DaVinci

2006-09-16, 10:01 pm


Ram wrote:
> I tried to obtain the power of a number i.e say I used something like
> pow(2.0,3.0) in my program. Initially it said error undefined symbol :
> pow() . Then I linked the library libbsd.a. Then it got cmpiled but its
> displayed some garbage value as output.
>
> Can anybody let me know where I'm missing ?
>
> Thanks
> Ram\


link the library -lm ?
double d = pow(2.0,3.0);
printf("%ld\n",d)//d = 0;
why?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com