Difference between revisions of "Bc"
From Teknologisk videncenter
m (New page: = Leg med bc = bc programmet er en avanceret regneprogram, som faktisk også har indbygget et programmeringssprog og som samtidig er forholdsvis nem at betjene. == Lidt leg med bc for at ...) |
(No difference)
|
Revision as of 09:34, 22 August 2009
Contents
Leg med bc
bc programmet er en avanceret regneprogram, som faktisk også har indbygget et programmeringssprog og som samtidig er forholdsvis nem at betjene.
Lidt leg med bc for at lære den at kende
Store tal
Hvor mange mulige IP addresser er der i IPv6 i forhold til IPv4.
- IPv4 - 32 bits adresser
- IPv6 - 128 bits adresser
[heth@mars ~]$ <input>bc</input>
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
<input>2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2</input>
4294967296
Puha det var mange gange jeg skulle skrive 2*2*2... 32 gange. Heldigvis kan vi opløfte i potenser
[heth@mars ~]$ <input>bc</input>
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
<input>2^32</input>
4294967296
For IPv6
[heth@mars ~]$ <input>bc</input>
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
<input>2^128</input>
340282366920938463463374607431768211456
Hvor mange mulige kombinationer af nøgler har 4096 bits kryptering
[heth@mars ~]$ <input>bc</input>
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
<input>2^4096</input>
10443888814131525066917527107166243825799642490473837803842334832839\
53907971557456848826811934997558340890106714439262837987573438185793\
60726323608785136527794595697654370999834036159013438371831442807001\
18559462263763188393977127456723346843445866174968079087058037040712\
84048740118609114467977783598029006686938976881787785946905630190260\
94059957945343282346930302669644305902501597239986771421554169383555\
98852914863182379144344967340878118726394964751001890413490084170616\
75093668333850551032972088269550769983616369411933015213796825837188\
09183365675122131849284636812555022599830041234478486259567449219461\
70238065059132456108257318353800876086221028342701976982023131690176\
78006675195485079921636419370285375124784014907159135459982790513399\
61155179427110683113409058427288427979155484978295432353451706522326\
90613949059876930021229633956877828789484406160074129456749198230505\
71642377154816321380631045902916136926708342856440730447899971901781\
46576347322385026725305989979599609079946920177462481771844986745565\
92501783290704731194331655508075682218465717463732968849128195203174\
57002440926616910874148385078411929804522981857338977648103126085903\
00130241346718972667321649151113160292078173803343609024380470834040\
3154190336
Det er jo et stort tal.
Andre talsystemer
bc kan anvende ethvert talsystem. For at lave et netværksfilter havde jeg brug for at omsætte min MAC-adresse som er hexadecimal til binært
[heth@mars ~]$ <input>bc</input>
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
<input>obase=2
ibase=16
0021869FC355</input>
10000110000110100111111100001101010101
<input>quit</input>
[heth@mars ~]$