This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to get the maths function work?

I used LPC1765 in the system, the program is as follows:

#include<math.h>

...

int main(void)

{ ...

float a,b,c;

...

b = 3.1;

a = log(b);

c = sin(a);

...

}

the program is compiled and linked with no error, but "a" and "c" can't get the correct value. who could help me?
thanks a lot!

Parents
  • If the compiler knows that sin() and log() doesn't have any side effects, then it could figure out that c isn't used, so no need to call sin(), and then a isn't used so no need to call log(). And then b isn't used, so no need to allocate such a variable either.

    Next thing is that the debugger isn't always managing to correctly display variable values.

Reply
  • If the compiler knows that sin() and log() doesn't have any side effects, then it could figure out that c isn't used, so no need to call sin(), and then a isn't used so no need to call log(). And then b isn't used, so no need to allocate such a variable either.

    Next thing is that the debugger isn't always managing to correctly display variable values.

Children