[問題] float 小數位數
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C:B 10.05
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
N/A
問題(Question):
float 跟 double 所存的小數點的位數最多只能到16位?
餵入的資料(Input):
1.12345678901234567890123
預期的正確結果(Expected Output):
1.12345678901234567890123
錯誤結果(Wrong Output):
1.12345678901234570000000
程式碼(Code):(請善用置底文網頁, 記得排版)
float f;
scanf("%f", &f);
printf("%.23f", f);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.255.181.60
→
11/15 01:41, , 1F
11/15 01:41, 1F
→
11/15 01:41, , 2F
11/15 01:41, 2F
→
11/15 01:42, , 3F
11/15 01:42, 3F
→
11/15 02:13, , 4F
11/15 02:13, 4F
→
11/15 02:14, , 5F
11/15 02:14, 5F
→
11/15 02:20, , 6F
11/15 02:20, 6F