c語言浮點(diǎn)數(shù)默認(rèn)輸出幾位 c語言浮點(diǎn)數(shù)默認(rèn)保留幾位小數(shù)?
c語言浮點(diǎn)數(shù)默認(rèn)保留幾位小數(shù)?默認(rèn)情況下,float類型在小數(shù)點(diǎn)后保留6位數(shù)字。如果要輸出一個(gè)數(shù)字或其他數(shù)字,可以按以下形式輸出:Printf(%)。(在此輸入要輸出的位數(shù))f,x);如果輸出一位:p
c語言浮點(diǎn)數(shù)默認(rèn)保留幾位小數(shù)?
默認(rèn)情況下,float類型在小數(shù)點(diǎn)后保留6位數(shù)字。如果要輸出一個(gè)數(shù)字或其他數(shù)字,可以按以下形式輸出:
Printf(%)。(在此輸入要輸出的位數(shù))f,x);
如果輸出一位:printf(%.1f,x);
擴(kuò)展數(shù)據(jù)
C語言中浮點(diǎn)型的精確數(shù)字
例子
#包含stdio.h
#包含float.h
int main()
{
Printf(存儲(chǔ)的最大字節(jié)數(shù)printf(float :% lu
,siz:% :% :% d
,F(xiàn)LT _ DIG);
返回0;
}