Разработка, производство и продажа радиоэлектронной аппаратуры
|
Требуется программист в Зеленограде - обработка данных с датчиков; ColdFire; 40 тыс.
e-mail: jobsmp@pochta.ru
|
j = (int)roundf( i )
Отправлено
Oldring 23 апреля 2008 г. 16:17
В ответ на:
Про приведение float к int. отправлено
Dikoy 23 апреля 2008 г. 12:59
ISO/IEC 9899:1999:
2 In the above conversions from floating to integer, the use of
(cast)x can be replaced with
(cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
(cast)ceil(x), or (cast)floor(x). In addition, C’s floating-point to integer
conversion functions, lrint(), llrint(), lround(), and llround(), can be
used. They all meet LIA−1’s requirements on floating to integer rounding for in-range
values. For out-of-range values, the conversions shall silently wrap for the modulo types.
;)
Составить ответ | Вернуться на конференцию
Ответы