I cannot use the math funciton,such as log()

Dave Korn dave.korn@artimi.com
Wed Nov 29 19:27:00 GMT 2006


On 27 November 2006 14:14, Tan Ping wrote:

> Hi,
>   When I use the math function , the program can be complied
> successfully.But when I download it into the s3c2410 board and run it,
> the result is wrong?
>   What is the matter? Can you help me?
>   I use the arm-linux-gcc-2.95.3,

  That's rather old, but it's probably not the cause.

> the code is :
> #include <math.h>
> #include <stdio.h>
> int main()
> {
>    float a,b;
>    a=4.0;
>    b=log(a);
>    printf("a=%f,b=%f\n",a,b);
> }
> The result of running is:
>  a=4.0,b=4.0
> the b's value is wrong!

  I think the heart of the problem might be revealed in the answer to these
two questions:

1)  Does the particular ARM cpu on your board have an FPU?
2)  Is the version of gcc you're using configured for hardware or software fp?



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list