Показать сообщение отдельно
Старый 01.08.2003, 08:47     # 1
naumenko
Newbie
 
Регистрация: 13.04.2003
Сообщения: 37

naumenko Путь к славе только начался
Exclamation Проблема при конвертация float->int !!!

Вот кусочек кода:

.
.
.
int devider=10;
int ascii_of_current_symbol;
float converted_symbol;
int int_part;
float float_part;
int container;

current_symbol=(TCHAR)m_strName.GetAt(some_position);
ascii_of_current_symbol=__toascii(current_symbol);
.
.
.
converted_symbol=(float)ascii_of_current_symbol/devider;
int_part=converted_symbol;
float_part=(converted_symbol-int_part)*devider;
container=(int)float_part;
container=container^some_position+2;
.
.
.


Проблема в этой строке:

container=(int)float_part;

Например (по шагам):

current_symbol='w'
ascii_of_current_symbol=119
converted_symbol=11.9000
int_part=11
float_part=9.0000
container=8
.
.
.


Какого рожна 9.0000 преобразуется в 8 ???!!!
Помогите пожалуйста!


Заранее благодарен.
naumenko вне форума