View Single Post
  #1   Spotlight this post!  
Unread 28-01-2005, 20:31
logicalhippo logicalhippo is offline
Registered User
AKA: Russell McClellan
#0213 (Dirty Birds)
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Keene, NH
Posts: 11
logicalhippo is an unknown quantity at this point
Send a message via AIM to logicalhippo
Unhappy Converting floating point to integers

I'm having a little problem with converting floating point values to integers. if I do something like this:

float f = 245.56;
int i;
i = (int)f;
printf("%d\n", i);

the output will be 0. Can anyone explain this problem? Do I need an explicit conversion? If so, where could I find documentation on it?