Thursday, October 13, 2016

C (programming language): 1 / 2^n

Command:

$ cat testmath.c


Result:

#include <stdio.h>
#include <math.h>
#include <float.h>

int main(){

int i = 1;

for (int i = 1; i <= 84; i++)
{
printf("%d:%.84f\n", i, 1.0/pow(2,i));
}
}


Command:

$ gcc testmath.c
$ ./a.out


Result:

1:0.500000000000000000000000000000000000000000000000000000000000000000000000000000000000
2:0.250000000000000000000000000000000000000000000000000000000000000000000000000000000000
3:0.125000000000000000000000000000000000000000000000000000000000000000000000000000000000
4:0.062500000000000000000000000000000000000000000000000000000000000000000000000000000000
5:0.031250000000000000000000000000000000000000000000000000000000000000000000000000000000
6:0.015625000000000000000000000000000000000000000000000000000000000000000000000000000000
7:0.007812500000000000000000000000000000000000000000000000000000000000000000000000000000
8:0.003906250000000000000000000000000000000000000000000000000000000000000000000000000000
9:0.001953125000000000000000000000000000000000000000000000000000000000000000000000000000
10:0.000976562500000000000000000000000000000000000000000000000000000000000000000000000000
11:0.000488281250000000000000000000000000000000000000000000000000000000000000000000000000
12:0.000244140625000000000000000000000000000000000000000000000000000000000000000000000000
13:0.000122070312500000000000000000000000000000000000000000000000000000000000000000000000
14:0.000061035156250000000000000000000000000000000000000000000000000000000000000000000000
15:0.000030517578125000000000000000000000000000000000000000000000000000000000000000000000
16:0.000015258789062500000000000000000000000000000000000000000000000000000000000000000000
17:0.000007629394531250000000000000000000000000000000000000000000000000000000000000000000
18:0.000003814697265625000000000000000000000000000000000000000000000000000000000000000000
19:0.000001907348632812500000000000000000000000000000000000000000000000000000000000000000
20:0.000000953674316406250000000000000000000000000000000000000000000000000000000000000000
21:0.000000476837158203125000000000000000000000000000000000000000000000000000000000000000
22:0.000000238418579101562500000000000000000000000000000000000000000000000000000000000000
23:0.000000119209289550781250000000000000000000000000000000000000000000000000000000000000
24:0.000000059604644775390625000000000000000000000000000000000000000000000000000000000000
25:0.000000029802322387695312500000000000000000000000000000000000000000000000000000000000
26:0.000000014901161193847656250000000000000000000000000000000000000000000000000000000000
27:0.000000007450580596923828125000000000000000000000000000000000000000000000000000000000
28:0.000000003725290298461914062500000000000000000000000000000000000000000000000000000000
29:0.000000001862645149230957031250000000000000000000000000000000000000000000000000000000
30:0.000000000931322574615478515625000000000000000000000000000000000000000000000000000000
31:0.000000000465661287307739257812500000000000000000000000000000000000000000000000000000
32:0.000000000232830643653869628906250000000000000000000000000000000000000000000000000000
33:0.000000000116415321826934814453125000000000000000000000000000000000000000000000000000
34:0.000000000058207660913467407226562500000000000000000000000000000000000000000000000000
35:0.000000000029103830456733703613281250000000000000000000000000000000000000000000000000
36:0.000000000014551915228366851806640625000000000000000000000000000000000000000000000000
37:0.000000000007275957614183425903320312500000000000000000000000000000000000000000000000
38:0.000000000003637978807091712951660156250000000000000000000000000000000000000000000000
39:0.000000000001818989403545856475830078125000000000000000000000000000000000000000000000
40:0.000000000000909494701772928237915039062500000000000000000000000000000000000000000000
41:0.000000000000454747350886464118957519531250000000000000000000000000000000000000000000
42:0.000000000000227373675443232059478759765625000000000000000000000000000000000000000000
43:0.000000000000113686837721616029739379882812500000000000000000000000000000000000000000
44:0.000000000000056843418860808014869689941406250000000000000000000000000000000000000000
45:0.000000000000028421709430404007434844970703125000000000000000000000000000000000000000
46:0.000000000000014210854715202003717422485351562500000000000000000000000000000000000000
47:0.000000000000007105427357601001858711242675781250000000000000000000000000000000000000
48:0.000000000000003552713678800500929355621337890625000000000000000000000000000000000000
49:0.000000000000001776356839400250464677810668945312500000000000000000000000000000000000
50:0.000000000000000888178419700125232338905334472656250000000000000000000000000000000000
51:0.000000000000000444089209850062616169452667236328125000000000000000000000000000000000
52:0.000000000000000222044604925031308084726333618164062500000000000000000000000000000000
53:0.000000000000000111022302462515654042363166809082031250000000000000000000000000000000
54:0.000000000000000055511151231257827021181583404541015625000000000000000000000000000000
55:0.000000000000000027755575615628913510590791702270507812500000000000000000000000000000
56:0.000000000000000013877787807814456755295395851135253906250000000000000000000000000000
57:0.000000000000000006938893903907228377647697925567626953125000000000000000000000000000
58:0.000000000000000003469446951953614188823848962783813476562500000000000000000000000000
59:0.000000000000000001734723475976807094411924481391906738281250000000000000000000000000
60:0.000000000000000000867361737988403547205962240695953369140625000000000000000000000000
61:0.000000000000000000433680868994201773602981120347976684570312500000000000000000000000
62:0.000000000000000000216840434497100886801490560173988342285156250000000000000000000000
63:0.000000000000000000108420217248550443400745280086994171142578125000000000000000000000
64:0.000000000000000000054210108624275221700372640043497085571289062500000000000000000000
65:0.000000000000000000027105054312137610850186320021748542785644531250000000000000000000
66:0.000000000000000000013552527156068805425093160010874271392822265625000000000000000000
67:0.000000000000000000006776263578034402712546580005437135696411132812500000000000000000
68:0.000000000000000000003388131789017201356273290002718567848205566406250000000000000000
69:0.000000000000000000001694065894508600678136645001359283924102783203125000000000000000
70:0.000000000000000000000847032947254300339068322500679641962051391601562500000000000000
71:0.000000000000000000000423516473627150169534161250339820981025695800781250000000000000
72:0.000000000000000000000211758236813575084767080625169910490512847900390625000000000000
73:0.000000000000000000000105879118406787542383540312584955245256423950195312500000000000
74:0.000000000000000000000052939559203393771191770156292477622628211975097656250000000000
75:0.000000000000000000000026469779601696885595885078146238811314105987548828125000000000
76:0.000000000000000000000013234889800848442797942539073119405657052993774414062500000000
77:0.000000000000000000000006617444900424221398971269536559702828526496887207031250000000
78:0.000000000000000000000003308722450212110699485634768279851414263248443603515625000000
79:0.000000000000000000000001654361225106055349742817384139925707131624221801757812500000
80:0.000000000000000000000000827180612553027674871408692069962853565812110900878906250000
81:0.000000000000000000000000413590306276513837435704346034981426782906055450439453125000
82:0.000000000000000000000000206795153138256918717852173017490713391453027725219726562500
83:0.000000000000000000000000103397576569128459358926086508745356695726513862609863281250
84:0.000000000000000000000000051698788284564229679463043254372678347863256931304931640625