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

floating point datatype

Hello

Can any body tell me how to use floating point datatype for programming in C in kiel.

i have defined in the following way

float i= 19.5;
or
float j= 18.2/255;

but these are given as errors.
please tell me how to use floating point datatype for Keil.

Thanking you

Parents
  • The right hand side of this line only contains constants:

    unsigned char k = 255*(1- (float)18/0xb6)

    so the compiler evaluates it for you.

    This line has a variable on the right hand side:

    unsigned char k= 255*(1-(float)18/j)

    so it has to be evaluated at runtime, which you can't do with the evaluation version.

Reply
  • The right hand side of this line only contains constants:

    unsigned char k = 255*(1- (float)18/0xb6)

    so the compiler evaluates it for you.

    This line has a variable on the right hand side:

    unsigned char k= 255*(1-(float)18/j)

    so it has to be evaluated at runtime, which you can't do with the evaluation version.

Children
No data