Unix Programming - Pow() doesn't give me the correct result

This is Interesting: Free IT 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, 1:43 pm

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, 1:43 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 ?


#include <math.h>

Rainer
DaVinci

2006-09-17, 1:28 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 ?
>
> Thanks
> Ram\


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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com