關于float 和double
int float weight=25.8;
printf("體重=%f",weight);//輸出25.800000
int float height=25.8;
printf("體重=%lf",weight);//輸出25.800000,請問double不是有8個字節嗎?小數點后不是應該輸出16位,即我認為的 輸出結果應該是25.8000000000000000
int float weight=25.8;
printf("體重=%f",weight);//輸出25.800000
int float height=25.8;
printf("體重=%lf",weight);//輸出25.800000,請問double不是有8個字節嗎?小數點后不是應該輸出16位,即我認為的 輸出結果應該是25.8000000000000000
2018-10-01
舉報
2018-10-02
這個是看格式符的,weight前面的格式符是%f即6位小數
2018-10-01
f 是6小數哇