Jump to content


Photo

Converting To Float Not Working


1 reply to this topic

#1 rbairos

rbairos

    Newbrie

  • EstablishedMember
  • 5 posts

Posted 01 June 2011 - 03:26 PM

Hi All.
This is very frustrating:



{
int i = 5;
float f;

f = i;
}


causes:

mainloop.c
mainloop.c(404): error: can't convert 'signed int' to 'float'
mainloop.c(404:4): error: failed to generate expression


If I try:
f = (float)i;

results in:

mainloop.c
mainloop.c(404:13): internal error: can't assign operand to temp var
mainloop.c(404:6): error: failed to generate expression
mainloop.c(404:6): error: invalid operand '(float)i'
mainloop.c(404:4): error: failed to generate expression



Any help appreciated.

#2 Dave

Dave

    Super Maniac

  • Administrators
  • PipPipPipPipPip
  • 2,091 posts
  • Gender:Male
  • Location:UK
  • Interests:How things work, Electronics, Software, Cycling.

Posted 01 June 2011 - 07:09 PM

rbairos,

This is very frustrating:



{
int i = 5;
float f;

f = i;
}

Native support for floating point is not yet supported. You need to use the appropriate floating point library function and add the floating point library to your project. Please read the Floating point library manual.

Regards
Dave



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users