浮點與分數對照表

張貼日期:Mar 26, 2013 12:11:10 PM

浮點與分數對照表

分數 分數 CME三位 浮點六位 小數

'00.00 , 0/128 , 0.000 , 0.000000 , 0

'00.25 , 1/128 , 0.008 , 0.007813 , 0.0078125

'00.50 , 2/128 , 0.016 , 0.015625 , 0.015625

'00.75 , 3/128 , 0.023 , 0.023438 , 0.0234375

'01.00 , 4/128 , 0.031 , 0.031250 , 0.03125

'01.25 , 5/128 , 0.039 , 0.039063 , 0.0390625

'01.50 , 6/128 , 0.047 , 0.046875 , 0.046875

'01.75 , 7/128 , 0.055 , 0.054688 , 0.0546875

'02.00 , 8/128 , 0.063 , 0.062500 , 0.0625

'02.25 , 9/128 , 0.070 , 0.070313 , 0.0703125

'02.50 , 10/128 , 0.078 , 0.078125 , 0.078125

'02.75 , 11/128 , 0.086 , 0.085938 , 0.0859375

'03.00 , 12/128 , 0.094 , 0.093750 , 0.09375

'03.25 , 13/128 , 0.102 , 0.101563 , 0.101563

'03.50 , 14/128 , 0.109 , 0.109375 , 0.109375

'03.75 , 15/128 , 0.117 , 0.117188 , 0.117188

'04.00 , 16/128 , 0.125 , 0.125000 , 0.125

'04.25 , 17/128 , 0.133 , 0.132813 , 0.132813

'04.50 , 18/128 , 0.141 , 0.140625 , 0.140625

'04.75 , 19/128 , 0.148 , 0.148438 , 0.148438

'05.00 , 20/128 , 0.156 , 0.156250 , 0.15625

'05.25 , 21/128 , 0.164 , 0.164063 , 0.164063

'05.50 , 22/128 , 0.172 , 0.171875 , 0.171875

'05.75 , 23/128 , 0.180 , 0.179688 , 0.179688

'06.00 , 24/128 , 0.188 , 0.187500 , 0.1875

'06.25 , 25/128 , 0.195 , 0.195313 , 0.195313

'06.50 , 26/128 , 0.203 , 0.203125 , 0.203125

'06.75 , 27/128 , 0.211 , 0.210938 , 0.210938

'07.00 , 28/128 , 0.219 , 0.218750 , 0.21875

'07.25 , 29/128 , 0.227 , 0.226563 , 0.226563

'07.50 , 30/128 , 0.234 , 0.234375 , 0.234375

'07.75 , 31/128 , 0.242 , 0.242188 , 0.242188

'08.00 , 32/128 , 0.250 , 0.250000 , 0.25

'08.25 , 33/128 , 0.258 , 0.257813 , 0.257813

'08.50 , 34/128 , 0.266 , 0.265625 , 0.265625

'08.75 , 35/128 , 0.273 , 0.273438 , 0.273438

'09.00 , 36/128 , 0.281 , 0.281250 , 0.28125

'09.25 , 37/128 , 0.289 , 0.289063 , 0.289063

'09.50 , 38/128 , 0.297 , 0.296875 , 0.296875

'09.75 , 39/128 , 0.305 , 0.304688 , 0.304688

'10.00 , 40/128 , 0.313 , 0.312500 , 0.3125

'10.25 , 41/128 , 0.320 , 0.320313 , 0.320313

'10.50 , 42/128 , 0.328 , 0.328125 , 0.328125

'10.75 , 43/128 , 0.336 , 0.335938 , 0.335938

'11.00 , 44/128 , 0.344 , 0.343750 , 0.34375

'11.25 , 45/128 , 0.352 , 0.351563 , 0.351563

'11.50 , 46/128 , 0.359 , 0.359375 , 0.359375

'11.75 , 47/128 , 0.367 , 0.367188 , 0.367188

'12.00 , 48/128 , 0.375 , 0.375000 , 0.375

'12.25 , 49/128 , 0.383 , 0.382813 , 0.382813

'12.50 , 50/128 , 0.391 , 0.390625 , 0.390625

'12.75 , 51/128 , 0.398 , 0.398438 , 0.398438

'13.00 , 52/128 , 0.406 , 0.406250 , 0.40625

'13.25 , 53/128 , 0.414 , 0.414063 , 0.414063

'13.50 , 54/128 , 0.422 , 0.421875 , 0.421875

'13.75 , 55/128 , 0.430 , 0.429688 , 0.429688

'14.00 , 56/128 , 0.438 , 0.437500 , 0.4375

'14.25 , 57/128 , 0.445 , 0.445313 , 0.445313

'14.50 , 58/128 , 0.453 , 0.453125 , 0.453125

'14.75 , 59/128 , 0.461 , 0.460938 , 0.460938

'15.00 , 60/128 , 0.469 , 0.468750 , 0.46875

'15.25 , 61/128 , 0.477 , 0.476563 , 0.476563

'15.50 , 62/128 , 0.484 , 0.484375 , 0.484375

'15.75 , 63/128 , 0.492 , 0.492188 , 0.492188

'16.00 , 64/128 , 0.500 , 0.500000 , 0.5

'16.25 , 65/128 , 0.508 , 0.507813 , 0.507813

'16.50 , 66/128 , 0.516 , 0.515625 , 0.515625

'16.75 , 67/128 , 0.523 , 0.523438 , 0.523438

'17.00 , 68/128 , 0.531 , 0.531250 , 0.53125

'17.25 , 69/128 , 0.539 , 0.539063 , 0.539063

'17.50 , 70/128 , 0.547 , 0.546875 , 0.546875

'17.75 , 71/128 , 0.555 , 0.554688 , 0.554688

'18.00 , 72/128 , 0.563 , 0.562500 , 0.5625

'18.25 , 73/128 , 0.570 , 0.570313 , 0.570313

'18.50 , 74/128 , 0.578 , 0.578125 , 0.578125

'18.75 , 75/128 , 0.586 , 0.585938 , 0.585938

'19.00 , 76/128 , 0.594 , 0.593750 , 0.59375

'19.25 , 77/128 , 0.602 , 0.601563 , 0.601563

'19.50 , 78/128 , 0.609 , 0.609375 , 0.609375

'19.75 , 79/128 , 0.617 , 0.617188 , 0.617188

'20.00 , 80/128 , 0.625 , 0.625000 , 0.625

'20.25 , 81/128 , 0.633 , 0.632813 , 0.632813

'20.50 , 82/128 , 0.641 , 0.640625 , 0.640625

'20.75 , 83/128 , 0.648 , 0.648438 , 0.648438

'21.00 , 84/128 , 0.656 , 0.656250 , 0.65625

'21.25 , 85/128 , 0.664 , 0.664063 , 0.664063

'21.50 , 86/128 , 0.672 , 0.671875 , 0.671875

'21.75 , 87/128 , 0.680 , 0.679688 , 0.679688

'22.00 , 88/128 , 0.688 , 0.687500 , 0.6875

'22.25 , 89/128 , 0.695 , 0.695313 , 0.695313

'22.50 , 90/128 , 0.703 , 0.703125 , 0.703125

'22.75 , 91/128 , 0.711 , 0.710938 , 0.710938

'23.00 , 92/128 , 0.719 , 0.718750 , 0.71875

'23.25 , 93/128 , 0.727 , 0.726563 , 0.726563

'23.50 , 94/128 , 0.734 , 0.734375 , 0.734375

'23.75 , 95/128 , 0.742 , 0.742188 , 0.742188

'24.00 , 96/128 , 0.750 , 0.750000 , 0.75

'24.25 , 97/128 , 0.758 , 0.757813 , 0.757813

'24.50 , 98/128 , 0.766 , 0.765625 , 0.765625

'24.75 , 99/128 , 0.773 , 0.773438 , 0.773438

'25.00 , 100/128 , 0.781 , 0.781250 , 0.78125

'25.25 , 101/128 , 0.789 , 0.789063 , 0.789063

'25.50 , 102/128 , 0.797 , 0.796875 , 0.796875

'25.75 , 103/128 , 0.805 , 0.804688 , 0.804688

'26.00 , 104/128 , 0.813 , 0.812500 , 0.8125

'26.25 , 105/128 , 0.820 , 0.820313 , 0.820313

'26.50 , 106/128 , 0.828 , 0.828125 , 0.828125

'26.75 , 107/128 , 0.836 , 0.835938 , 0.835938

'27.00 , 108/128 , 0.844 , 0.843750 , 0.84375

'27.25 , 109/128 , 0.852 , 0.851563 , 0.851563

'27.50 , 110/128 , 0.859 , 0.859375 , 0.859375

'27.75 , 111/128 , 0.867 , 0.867188 , 0.867188

'28.00 , 112/128 , 0.875 , 0.875000 , 0.875

'28.25 , 113/128 , 0.883 , 0.882813 , 0.882813

'28.50 , 114/128 , 0.891 , 0.890625 , 0.890625

'28.75 , 115/128 , 0.898 , 0.898438 , 0.898438

'29.00 , 116/128 , 0.906 , 0.906250 , 0.90625

'29.25 , 117/128 , 0.914 , 0.914063 , 0.914063

'29.50 , 118/128 , 0.922 , 0.921875 , 0.921875

'29.75 , 119/128 , 0.930 , 0.929688 , 0.929688

'30.00 , 120/128 , 0.938 , 0.937500 , 0.9375

'30.25 , 121/128 , 0.945 , 0.945313 , 0.945313

'30.50 , 122/128 , 0.953 , 0.953125 , 0.953125

'30.75 , 123/128 , 0.961 , 0.960938 , 0.960938

'31.00 , 124/128 , 0.969 , 0.968750 , 0.96875

'31.25 , 125/128 , 0.977 , 0.976563 , 0.976563

'31.50 , 126/128 , 0.984 , 0.984375 , 0.984375

'31.75 , 127/128 , 0.992 , 0.992188 , 0.992188

參考程式碼

int main(int argc, char* argv[])

{

int i;

double d;

char caF3[16];

for (i = 0; i < 128; i++)

{

d = (double)i / 128;

sprintf(caF3, "%.03f", d);

printf("'%02d.%02d , %3d/128 , %s , %.6f , %g\n", ((25 * i) / 100), ((25 * i) % 100), i, caF3, d, ((double)(((atoi(caF3 + 2) * 128) + 500)/1000))/128 );

}

return 0;

}