sprintf (buf, "%g", myVal) (+). В большинстве компиляторов полный sprintf с плавучкой по умолчанию выключен, обычно доступен через опции проекта. Жрет sprintf плавающий до кучи как ROM так и RAM
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено DASM 17 октября 2004 г. 00:44
В ответ на: Как с помощью sprintf вывести float? отправлено Sinelogic 17 октября 2004 г. 00:32

вместо флага "%g" возможны иные
e:
Signed value having the form [ – ]d.dddd e [sign]ddd where d is a single decimal digit, dddd is one or more decimal digits, ddd is exactly three decimal digits, and sign is + or –.
f:
Signed value having the form [ – ]dddd.dddd, where dddd is one or more decimal digits. The number of digits before the decimal point depends on the magnitude of the number, and the number of digits after the decimal point depends on the requested precision
g:
Signed value printed in f or e format, whichever is more compact for the given value and precision. The e format is used only when the exponent of the value is less than –4 or greater than or equal to the precision argument. Trailing zeros are truncated, and the decimal point appears only if one or more digits follow it.

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru