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 Reply Children
  • yeah i am using evaluation software.
    but i am confused to see this

    here
    unsigned char j=0xb6;

    and if i write

    unsigned char k = 255*(1- (float)18/0xb6)
    i am not getting any error and the result is same as what i wanted.
    but if i use it in the following way , i am getting error.

    unsigned char k= 255*(1-(float)18/j)
    where j=0xb6.
    Is there no other way to perform division operations in evaluation version

    -Pradeep

  • 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.