aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bc.test72
-rw-r--r--tests/files/bc/add.txt24
-rw-r--r--tests/files/bc/add_results.txt36
-rwxr-xr-xtests/files/bc/arctan.bc12
-rw-r--r--tests/files/bc/basic.txt7
-rw-r--r--tests/files/bc/basic_results.txt9
-rw-r--r--tests/files/bc/decimal.txt34
-rw-r--r--tests/files/bc/decimal_results.txt48
-rw-r--r--tests/files/bc/divide.txt31
-rw-r--r--tests/files/bc/divide_results.txt31
-rw-r--r--tests/files/bc/modulus.txt66
-rw-r--r--tests/files/bc/modulus_results.txt65
-rw-r--r--tests/files/bc/multiply.txt39
-rw-r--r--tests/files/bc/multiply_results.txt40
-rwxr-xr-xtests/files/bc/parse.bc16
-rw-r--r--tests/files/bc/pi.txt7
-rw-r--r--tests/files/bc/power.txt42
-rw-r--r--tests/files/bc/power_results.txt385
-rwxr-xr-xtests/files/bc/print.bc21
-rw-r--r--tests/files/bc/screen.bc19
-rw-r--r--tests/files/bc/script.sh24
-rw-r--r--tests/files/bc/sqrt.txt12
-rw-r--r--tests/files/bc/sqrt_results.txt11
-rw-r--r--tests/files/bc/subtract.txt30
-rw-r--r--tests/files/bc/subtract_results.txt34
25 files changed, 1115 insertions, 0 deletions
diff --git a/tests/bc.test b/tests/bc.test
new file mode 100644
index 00000000..213b21ab
--- /dev/null
+++ b/tests/bc.test
@@ -0,0 +1,72 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+#testing "name" "command" "result" "infile" "stdin"
+
+BDIR="$FILES/bc"
+TESTDIR="./"
+
+results=$(cat "$BDIR/decimal_results.txt")
+testcmd "decimal" "-l $BDIR/decimal.txt" "$results\n" "$BDIR/decimal.txt" ""
+
+results=$(cat "$BDIR/add_results.txt")
+testcmd "add" "-l $BDIR/add.txt" "$results\n" "$BDIR/add.txt" ""
+
+results=$(cat "$BDIR/subtract_results.txt")
+testcmd "subtract" "-l $BDIR/subtract.txt" "$results\n" "$BDIR/subtract.txt" ""
+
+results=$(cat "$BDIR/multiply_results.txt")
+testcmd "multiply" "-l $BDIR/multiply.txt" "$results\n" "$BDIR/multiply.txt" ""
+
+results=$(cat "$BDIR/divide_results.txt")
+testcmd "divide" "-l $BDIR/divide.txt" "$results\n" "$BDIR/divide.txt" ""
+
+results=$(cat "$BDIR/modulus_results.txt")
+testcmd "modulus" "-l $BDIR/modulus.txt" "$results\n" "$BDIR/modulus.txt" ""
+
+results=$(cat "$BDIR/power_results.txt")
+testcmd "power" "-l $BDIR/power.txt" "$results\n" "$BDIR/power.txt" ""
+
+results=$(cat "$BDIR/sqrt_results.txt")
+testcmd "sqrt" "-l $BDIR/sqrt.txt" "$results\n" "$BDIR/sqrt.txt" ""
+
+results=$(cat "$BDIR/basic_results.txt")
+testcmd "basic" "-l $BDIR/basic.txt" "$results\n" "$BDIR/basic.txt" ""
+
+if [ ! -f "$TESTDIR/parse.txt" ]; then
+ echo "Generating bc parse..."
+ cat "$BDIR/parse.bc" | bc -l > "$TESTDIR/parse.txt"
+fi
+results=$(cat "$TESTDIR/parse.txt" | bc -l)
+testcmd "parse" "-l $TESTDIR/parse.txt" "$results\n" "$TESTDIR/parse.txt" ""
+
+if [ ! -f "$TESTDIR/print.txt" ]; then
+ echo "Generating bc print..."
+ cat "$BDIR/print.bc" | bc -l > "$TESTDIR/print.txt"
+fi
+results=$(cat "$TESTDIR/print.txt" | bc -l)
+testcmd "print" "-l $TESTDIR/print.txt" "$results\n" "$TESTDIR/print.txt" ""
+
+results=$(cat "$BDIR/pi.txt" | bc -l)
+testcmd "pi" "-l $BDIR/pi.txt" "$results\n" "$BDIR/pi.txt" ""
+
+if [ ! -f "$TESTDIR/arctan.txt" ]; then
+ echo "Generating bc arctan..."
+ cat "$BDIR/arctan.bc" | bc -l > "$TESTDIR/arctan.txt"
+fi
+results=$(cat "$TESTDIR/arctan.txt" | bc -l)
+testcmd "arctan" "-l $TESTDIR/arctan.txt" "$results\n" "$TESTDIR/arctan.txt" ""
+
+results=$(cat "$TESTDIR/arctan.txt")
+testcmd "arctan script" "-l $BDIR/arctan.bc" "$results" "$BDIR/arctan.bc" ""
+
+results=$(cat "$TESTDIR/parse.txt")
+testcmd "parse script" "-l $BDIR/parse.bc" "$results\n" "$BDIR/parse.bc" ""
+
+results=$(cat "$TESTDIR/print.txt")
+testcmd "print script" "-l $BDIR/print.bc" "$results\n" "$BDIR/print.bc" ""
+
+results=$(cat "$BDIR/screen.bc" | bc -l)
+testcmd "screen script" "-l $BDIR/screen.bc" "$results\n" "$BDIR/screen.bc" ""
+
diff --git a/tests/files/bc/add.txt b/tests/files/bc/add.txt
new file mode 100644
index 00000000..01ea6c80
--- /dev/null
+++ b/tests/files/bc/add.txt
@@ -0,0 +1,24 @@
+0 + 0
+0 + 1
+1 + 1
+1 + 0
+2 + 5
+237 + 483
+999 + 999
+2374623 + 324869356734856
+2378639084586723980562 + 23468729367839
+37298367203972395108367910823465293084561329084561390845613409516734503870691837451 + 785621394067928346918023476190834672198467134908618723249671349062187346898241093486139046139084613490817356023871869102746182749061872609129847
+1.1 + 0
+0 + 1.1
+457283.731284923576 + 37842934672834.3874629385672354
+1.0 + 0.1
+3746289134067138046 + 0.138375863945672398456712389456273486293
+-1 + -1
+-4 + -15
+-1346782 + -1287904651762468913476
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995 + 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+99999999999999999999999999999999999999999999999999999999999.999999999999999999999999999999999999999999999999999999999899999999999999999999999999999999999999999999999999999999999999 + 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+99999999999999999999999999999999999989999999999999999999999.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+-1889985797 + 2012747315
diff --git a/tests/files/bc/add_results.txt b/tests/files/bc/add_results.txt
new file mode 100644
index 00000000..313fa450
--- /dev/null
+++ b/tests/files/bc/add_results.txt
@@ -0,0 +1,36 @@
+0
+1
+2
+1
+7
+720
+1998
+324869359109479
+2378639108055453348401
+78562139406792834691802347619083467219846713490861872324967138636055\
+45508706362018540498696043776980521464405852627147161556994835657433\
+00967298
+1.1
+1.1
+37842935130118.1187478621432354
+1.1
+3746289134067138046.138375863945672398456712389456273486293
+-2
+-19
+-1287904651762470260258
+100000000000000000000000000000000000000000000000000000000000.0000000\
+00000000000000000000000000000000000000000000000000000000000000000000\
+000000000000000000000000000000000000000000000
+100000000000000000000000000000000000000000000000000000000000.0000000\
+00000000000000000000000000000000000000000000000000000000000000000000\
+000000000000000000000000000000000000000000000
+100000000000000000000000000000000000000000000000000000000000.0000000\
+00000000000000000000000000000000000000000000000000000000000000000000\
+000000000000000000000000000000000000000009999
+99999999999999999999999999999999999999999999999999999999999.99999999\
+99999999999999999999999999999999999999999999999999000000000000000000\
+00000000000000000000000000000000000000009999
+99999999999999999999999999999999999990000000000000000000000.00000000\
+00000000000000000000000000000000000000000000000000000000000000000000\
+00000000000000000000000000000000000000009999
+122761518
diff --git a/tests/files/bc/arctan.bc b/tests/files/bc/arctan.bc
new file mode 100755
index 00000000..11a76953
--- /dev/null
+++ b/tests/files/bc/arctan.bc
@@ -0,0 +1,12 @@
+#! /usr/bin/bc -q
+
+i = 0
+for (i = 1; i <= 100; ++i) {
+ print "scale = ", i, "\n"
+ print "a(.267)\n"
+ print "a(1)\n"
+}
+
+"halt"
+
+halt
diff --git a/tests/files/bc/basic.txt b/tests/files/bc/basic.txt
new file mode 100644
index 00000000..f3d957a2
--- /dev/null
+++ b/tests/files/bc/basic.txt
@@ -0,0 +1,7 @@
+scale=10;123981239.981273987 * 12983791827398.29836472638
+scale=100;759634576394.3946587934658364895 / 9834759834895386.36459364958346
+34895734986539489834759837489573498573.398475984759837485734987598345 + 9823749832749872384234872934.28347982374987239847982374
+a=123123123.987239874; b=123123123.239479823748; a+b
+20347023.23498723984 - 28934723874.234720384
+scale=100;a=739534985.895347284957;b=238746782364.2374623784; c = a / b; c+0
+
diff --git a/tests/files/bc/basic_results.txt b/tests/files/bc/basic_results.txt
new file mode 100644
index 00000000..1e0d92f1
--- /dev/null
+++ b/tests/files/bc/basic_results.txt
@@ -0,0 +1,9 @@
+1609746610419572350599.59456175545
+.0000772397688552681359718594121969204138521230712049526233926741658\
+845368495051158801794834809672994
+34895734996363239667509709873808371507.68195580850970988421481133834\
+5
+246246247.226719697748
+-28914376850.99973314416
+.0030975704827179453786044330548590249517387192084765414205077089498\
+482709063381782183114683451531598
diff --git a/tests/files/bc/decimal.txt b/tests/files/bc/decimal.txt
new file mode 100644
index 00000000..a58f9304
--- /dev/null
+++ b/tests/files/bc/decimal.txt
@@ -0,0 +1,34 @@
+0
+0.0
+000000000000000000000000.00000000000000000000000
+000000000000000000000000000135482346782356
+000000000000000000000000002
+1
+11
+123
+7505
+1023468723275435238491972521917846
+4343472432431705867392073517038270398027352709027389273920739037937960379637893607893607893670530278200795207952702873892786172916728961783907893607418973587857386079679267926737520730925372983782793652793
+-1
+-203
+-57
+-18586
+-31378682943772818461924738352952347258
+-823945628745673589495067238723986520375698237620834674509627345273096287563846592384526349872634895763257893467523987578690283762897568459072348758071071087813501875908127359018715023841710239872301387278
+.123521346523546
+0.1245923756273856
+-.1024678456387
+-0.8735863475634587
+4.0
+-6.0
+234237468293576.000000000000000000000000000000
+23987623568943567.00000000000000000005677834650000000000000
+23856934568940675.000000000000000435676782300000000000000456784
+77567648698496.000000000000000000587674750000000000458563800000000000000
+2348672354968723.2374823546000000000003256987394502346892435623870000000034578
+-2354768.000000000000000000000000000000000000
+-96739874567.000000000347683456
+-3764568345.000000000004573845000000347683460
+-356784356.934568495770004586495678300000000
+74325437345273852773827101738273127312738521733017537073520735207307570358738257390761276072160719802671980267018728630178.7082681027680521760217867841276127681270867827821768173178207830710978017738178678012767377058785378278207385237085237803278203782037237582795870
+-756752732785273851273728537852738257837283678965738527385272983678372867327835672967385278372637862738627836279863782673862783670.71738178361738718367186378610738617836781603760178367018603760178107735278372832783728367826738627836278378260736270367362073867097307925
diff --git a/tests/files/bc/decimal_results.txt b/tests/files/bc/decimal_results.txt
new file mode 100644
index 00000000..01bfa586
--- /dev/null
+++ b/tests/files/bc/decimal_results.txt
@@ -0,0 +1,48 @@
+0
+0
+0
+135482346782356
+2
+1
+11
+123
+7505
+1023468723275435238491972521917846
+43434724324317058673920735170382703980273527090273892739207390379379\
+60379637893607893607893670530278200795207952702873892786172916728961\
+78390789360741897358785738607967926792673752073092537298378279365279\
+3
+-1
+-203
+-57
+-18586
+-31378682943772818461924738352952347258
+-8239456287456735894950672387239865203756982376208346745096273452730\
+96287563846592384526349872634895763257893467523987578690283762897568\
+45907234875807107108781350187590812735901871502384171023987230138727\
+8
+.123521346523546
+.1245923756273856
+-.1024678456387
+-.8735863475634587
+4.0
+-6.0
+234237468293576.000000000000000000000000000000
+23987623568943567.00000000000000000005677834650000000000000
+23856934568940675.000000000000000435676782300000000000000456784
+77567648698496.00000000000000000058767475000000000045856380000000000\
+0000
+2348672354968723.237482354600000000000325698739450234689243562387000\
+0000034578
+-2354768.000000000000000000000000000000000000
+-96739874567.000000000347683456
+-3764568345.000000000004573845000000347683460
+-356784356.934568495770004586495678300000000
+74325437345273852773827101738273127312738521733017537073520735207307\
+570358738257390761276072160719802671980267018728630178.7082681027680\
+52176021786784127612768127086782782176817317820783071097801773817867\
+8012767377058785378278207385237085237803278203782037237582795870
+-7567527327852738512737285378527382578372836789657385273852729836783\
+72867327835672967385278372637862738627836279863782673862783670.71738\
+17836173871836718637861073861783678160376017836701860376017810773527\
+8372832783728367826738627836278378260736270367362073867097307925
diff --git a/tests/files/bc/divide.txt b/tests/files/bc/divide.txt
new file mode 100644
index 00000000..4d0caddc
--- /dev/null
+++ b/tests/files/bc/divide.txt
@@ -0,0 +1,31 @@
+0 / 1
+0 / 321566
+0 / 0.3984567238456
+1 / 1
+1 / 1287469297356
+1 / 0.2395672438567234
+1 / 237586239856.0293596728392360
+1249687284356 / 3027949207835207
+378617298617396719 / 35748521
+9348576237845624358 / 0.9857829375461
+35768293846193284 / 2374568947.045762839567823
+-78987234567812345 / 876542837618936
+-356789237555535468 / 0.3375273860984786903
+-5203475364850390 / 435742903748307.70869378534043296404530458
+-0.37861723347576903 / 7385770896
+-0.399454682043962 / 0.34824389304
+-0.6920414523873204 / 356489645223.76076045304879030
+-35872917389671.7573280963748 / 73924708
+-78375896314.4836709876983 / 0.78356798637817
+-2374123896417.143789621437581 / 347821469423789.1473856783960
+-896729350238549726 / -34976289345762
+-2374568293458762348596 / -0.8792370647234987679
+-237584692306721845726038 / -21783910782374529637.978102738746189024761
+-0.23457980123576298375682 / -1375486293874612
+-0.173897061862478951264 / -0.8179327486017634987516298745
+-0.9186739823576829347586 / -0.235678293458756239846
+-0.9375896183746982374568 / -13784962873546.0928729395476283745
+-2930754618923467.12323745862937465 / -734869238465
+-23745861923467.874675129834675 / -0.23542357869124756
+-3878923750692883.7238596702834756902 / -7384192674957215364986723.9738461923487621983
+1 / 0.00000000000000000000000000000000000000000002346728372937352457354204563027
diff --git a/tests/files/bc/divide_results.txt b/tests/files/bc/divide_results.txt
new file mode 100644
index 00000000..c19f2f9b
--- /dev/null
+++ b/tests/files/bc/divide_results.txt
@@ -0,0 +1,31 @@
+0
+0
+0
+1.00000000000000000000
+.00000000000077671755
+4.17419336592637110778
+.00000000000420899796
+.00041271738677857404
+10591131829.40901859967857131767
+9483402361494453751.52388015648196297248
+15063068.13735316451497043884
+-90.11223545260531110575
+-1057067521778623447.45138528213564485251
+-11.94161814246320631346
+-.00000000005126306228
+-1.14705437777218917343
+-.00000000000194126663
+-485262.88923145638029569727
+-100024372711.74763635544535424582
+-.00682569681609989277
+25638.20711150436682153521
+2700714504347599627864.24626421085374010264
+10906.42973524078145692731
+.00000000000000017054
+.21260557443109085166
+3.89799997647407910677
+.00000000000006801538
+3988.13076601933678578945
+100864416620775.31076855630746548983
+.00000000052530099381
+42612515855353136519261264261472677699404182.78776061098893912189
diff --git a/tests/files/bc/modulus.txt b/tests/files/bc/modulus.txt
new file mode 100644
index 00000000..e2539892
--- /dev/null
+++ b/tests/files/bc/modulus.txt
@@ -0,0 +1,66 @@
+1 % 1
+2 % 1
+16 % 4
+15 % 4
+17 % 4
+2389473 % 5
+39240687239 % 1
+346728934 % 23958
+3496723859067234 % 298375462837546928347623059375486
+-1 % 1
+-2 % 1
+-47589634875689345 % 37869235
+-1274852934765 % 2387628935486273546
+-6324758963 % 237854962
+1 % -1
+2 % -1
+2 % -2
+2 % -3
+16 % 5
+15 % 5
+14 % 5
+89237423 % -237856923854
+123647238946 % -12467
+-1 % -1
+-2 % -1
+-2 % -2
+-2 % -3
+-13 % -7
+-14 % -7
+-15 % -7
+-12784956 % -32746
+-127849612 % -23712347682193
+scale = 0
+1 % 1
+2 % 1
+16 % 4
+15 % 4
+17 % 4
+2389473 % 5
+39240687239 % 1
+346728934 % 23958
+3496723859067234 % 298375462837546928347623059375486
+-1 % 1
+-2 % 1
+-47589634875689345 % 37869235
+-1274852934765 % 2387628935486273546
+-6324758963 % 237854962
+1 % -1
+2 % -1
+2 % -2
+2 % -3
+16 % 5
+15 % 5
+14 % 5
+89237423 % -237856923854
+123647238946 % -12467
+-1 % -1
+-2 % -1
+-2 % -2
+-2 % -3
+-13 % -7
+-14 % -7
+-15 % -7
+-12784956 % -32746
+-127849612 % -23712347682193
+-3191280681 % 641165986
diff --git a/tests/files/bc/modulus_results.txt b/tests/files/bc/modulus_results.txt
new file mode 100644
index 00000000..323b3a7d
--- /dev/null
+++ b/tests/files/bc/modulus_results.txt
@@ -0,0 +1,65 @@
+0
+0
+0
+0
+0
+0
+0
+.00000000000000002026
+2747189239559.46904933397471305894
+0
+0
+-.00000000000011057855
+-.00076922992566770712
+-.00000000000050364144
+0
+0
+0
+.00000000000000000002
+0
+0
+0
+.00000000070585524350
+.00000000000000002898
+0
+0
+0
+-.00000000000000000002
+-.00000000000000000005
+0
+-.00000000000000000002
+-.00000000000000011722
+-.00000002640923745817
+0
+0
+0
+3
+1
+3
+0
+8758
+3496723859067234
+0
+0
+-8236960
+-1274852934765
+-140529951
+0
+0
+0
+2
+1
+0
+4
+89237423
+6692
+0
+0
+0
+-2
+-6
+0
+-1
+-14016
+-127849612
+-626616737
diff --git a/tests/files/bc/multiply.txt b/tests/files/bc/multiply.txt
new file mode 100644
index 00000000..5ef49c4c
--- /dev/null
+++ b/tests/files/bc/multiply.txt
@@ -0,0 +1,39 @@
+0 * 0
+1 * 0
+0 * 1
+0 * 2498752389672835476
+873246913745129084576134 * 0
+1 * 472638590273489273456
+12374861230476103672835496 * 1
+1 * 1
+2 * 1
+1 * 2
+2 * 2
+3 * 14
+17 * 8
+1892467513846753 * 1872439821374591038746
+328962735862.2973546835638947635 * 1728465791348762356
+38745962374538.387427384672934867234 * 0.1932476528394672837568923754
+9878894576289457634856.2738627161689017387608947567654 * 37842939768237596237854203.29874372139852739126739621793162
+-1 * 1
+-1 * 2
+78893457 * -34876238956
+235678324957634 * -0.2349578349672389576
+-12849567821934 * 12738462937681
+1274861293467.927843682937462 * -28935678239
+2936077239872.12937462836 * -0.012842357682435762
+2387692387566.2378569237546 * -272189345628.123875629835876
+0.012348629356782835962 * -23487692356
+0.4768349567348675934 * -0.23756834576934857638495
+0.98748395367485962735486 * -4675839462354867.376834956738456
+-321784627934586 * -235762378596
+-32578623567892356 * -0.32567384579638456
+-35768232346876 * -2348672935602387620.28375682349576237856
+-0.2356728394765234 * -238759624356978
+-0.2345768212346780 * -0.235768124697074385948943532045
+-0.370873860736785306278630 * -7835678398607.7086378076867096270
+-78365713707.7089637863786730 * -738580798679306780
+-73867038956790490258249 * -0.7379862716391723672803679
+-378621971598721837710387 * -98465373878350798.09743896037963078560
+37164201 * 2931559660
+679468076118972457796560530571.46287161642138401685 * 93762.2836
diff --git a/tests/files/bc/multiply_results.txt b/tests/files/bc/multiply_results.txt
new file mode 100644
index 00000000..c8167dbe
--- /dev/null
+++ b/tests/files/bc/multiply_results.txt
@@ -0,0 +1,40 @@
+0
+0
+0
+0
+0
+472638590273489273456
+12374861230476103672835496
+1
+2
+2
+4
+42
+136
+3543531533584430580556128344529291738
+568600835566479683035874339053.4411638427543228060
+7487566285885.8557453089005171423976251098
+373846412427291014394738378015501363938345620046.7869650248829232267\
+2297002026819
+-1
+-2
+-2751507058396910892
+-55374468980751.0837656919743223184
+-163683743464924630346895054
+-36888976187143312550878.567134791289418
+-37706154097.69662826215753378160
+-649904428532907022680241.94791869424754101064
+-290040807.350385412976669306472
+-.11328089187650139309272
+-4617316439035114.40320367843985107357898
+75864709277486862054521256
+10610005628108234.92015040406042336
+84007879267445533366251128067927.91168012197674537856
+56269158624557.1027018519702852
+.055305737239900889424090264801
+2906048299183.472237078104362540110129
+57879411419313585866282299201.3825582163029400
+54512860676747314187949.9414724679950990587298071
+37281153992026463004361915151761464058058.54968338992209002720
+108949072447731660
+63708478450213482928510139572007971.83536929222529239687
diff --git a/tests/files/bc/parse.bc b/tests/files/bc/parse.bc
new file mode 100755
index 00000000..8cc7472f
--- /dev/null
+++ b/tests/files/bc/parse.bc
@@ -0,0 +1,16 @@
+#! /usr/bin/bc -q
+
+for (b = 2; b <= 16; ++b) {
+ if (b == 10) continue
+ obase = 10
+ print "ibase = A; ibase = ", b, "\n"
+ obase = b
+ for (i = 0; i <= 65536; ++i) {
+ i
+ print "0.", i, "\n"
+ print "1.", i, "\n"
+ print i, ".", i, "\n"
+ }
+}
+
+halt
diff --git a/tests/files/bc/pi.txt b/tests/files/bc/pi.txt
new file mode 100644
index 00000000..4ae0fa64
--- /dev/null
+++ b/tests/files/bc/pi.txt
@@ -0,0 +1,7 @@
+for (i = 0; i <= 100; ++i) {
+ scale = i
+ 4 * a(1)
+}
+
+scale = 1000
+4 * a(1)
diff --git a/tests/files/bc/power.txt b/tests/files/bc/power.txt
new file mode 100644
index 00000000..3222e9d7
--- /dev/null
+++ b/tests/files/bc/power.txt
@@ -0,0 +1,42 @@
+0 ^ 0
+0 ^ 1
+0 ^ 1894
+1 ^ 0
+39746823 ^ 0
+0.238672983047682 ^ 0
+18394762374689237468.97354862973846 ^ 0
+1 ^ 1
+2 ^ 1
+18927361346 ^ 1
+0.23523785962738592635777 ^ 1
+328956734869213746.89782398457234 ^ 1
+8937 ^ 98
+0.124876812394 ^ 2396
+93762.2836 ^ 13
+1 ^ -1
+2 ^ -1
+10 ^ -1
+683734768 ^ -1
+38579623756.897937568235 ^ -1
+1 ^ -32467
+2 ^ -53
+23897 ^ -213
+-1 ^ 1
+-1 ^ 2
+-2 ^ 1
+-2 ^ 2
+-237 ^ 294
+-3746 ^ 28
+-0.3548 ^ 35
+-4267.234 ^ 2837
+-326.3246 ^ 2378
+-1 ^ -1
+-1 ^ -2
+-2 ^ -1
+-2 ^ -2
+-237 ^ -293
+-784 ^ -23
+-0.2357689 ^ -8723
+-0.23424398 ^ -781
+-178.234786 ^ -879
+-1274.346 ^ -768
diff --git a/tests/files/bc/power_results.txt b/tests/files/bc/power_results.txt
new file mode 100644
index 00000000..28f9ad73
--- /dev/null
+++ b/tests/files/bc/power_results.txt
@@ -0,0 +1,385 @@
+1
+0
+0
+1
+1
+1
+1
+1
+2
+18927361346
+.23523785962738592635777
+328956734869213746.89782398457234
+16473742664221279051571200630760751138799221376964991600670000200609\
+08006052596520320731708604393844468006290371918262741885989163144389\
+39367835091560809036359941703341471396407660150658436796925310445979\
+21333166245765946557344383284626113908419359990042883048537750217279\
+17481980123593363177308481941550382845381799410533956718500484099889\
+610805653325917409549921909941664118421333562129
+0
+43287877285033571298394739716218787350087163435619825150259705419.98\
+016445740928054425
+1.00000000000000000000
+.50000000000000000000
+.10000000000000000000
+.00000000146255543348
+.00000000002592041867
+1.00000000000000000000
+.00000000000000011102
+0
+-1
+1
+-2
+4
+14997322375665265051328725757939209353051902095893907150382724666290\
+49749481660976421019742616298227588464420182758442163654172400528243\
+00885441207762486233574213374503090372518590691583139696652847404883\
+08573912261119588874308960204159666762789603037188471170006223907416\
+60492840269152716750700089148882139254399347568222390231015487895905\
+73727080561379177721440905866857248917982113340543176658480139248897\
+54802503253413282808814063861470711399810899724515727713334909764746\
+27910290211411231279325882505708287941671508154740003122373284699097\
+78346501539634198926772266511968381368929692275950529960923432771985\
+12597189390708050983487158873301681237787429436264801751664042999180\
+3448659818912436089
+11478830555358864333472551120140548480416206583184496764727387456058\
+792742209537931243951391229607936
+-.00000000000000017759
+-5315000202937163259492745003279421369106067669145129859648420636529\
+90445623045796466912212328506740453231539873473645734499753872948065\
+49633577959910694192145181126036108234067752197600736121017297080808\
+17616863795402188466673465041737963185044596535417380459631266160640\
+14583650452617054961289909930913477463730596242904393535447326927217\
+89173834172615425952449908691097034304917795485671070317830033446935\
+38310140064407341431340535164186443832804681667156458972977303614472\
+33265448905074750219542877570352782981931513698676869313385161238014\
+33972388487066619195467353034148880813325180423582595649900987746182\
+41895615903666063666862790223026863393142524825702604904791179988750\
+45809820128887237302302157495251041558294866524648134606244499204091\
+49083321829864412304204374908788049385821238476680431773652392070264\
+59357384450300571070886634991808217727920058131365837495515494533981\
+36075073475798690610073101157985973126714728174798097385600505077064\
+64307865500312391435488397915044572948634144019685716400039399263051\
+47069168529330946438107251496721589630778010562251104749454115537505\
+09733953415921981476370056761128775090287101279301783155189276038704\
+41895108419474778802941709888668845300019024827549284756327304572867\
+96869370102131426204516615827055555481884884048493606181911952577877\
+05397677851197539883332750824024563555696883835248240415293162263750\
+05514521919787836514087683462282073201968011400045654810616450219205\
+73232304423399284026556121979893723420267398521035723282740403251520\
+70294763262021087574735376398655633958565910985905690707543972327381\
+79651823478575002271270347555847440100290072055641291249615250133821\
+23680505794038719878415117091425492978380126284031828475714412518947\
+51403219894454213518071933476255317428650882367543271627040950041490\
+91372087962670790674328089839025158796625170118099611830170979543268\
+46838632558303335286513165259961630072343847303015053999848541735021\
+39379960402818223313798877113839753031848265476145371954184400351975\
+19977868370176657443035408745111796788080163762225487710398592741290\
+98787560930947073645198429428485551148558897458881325360238752512610\
+98690991255078245972980209265660013809958812534609566576738101048147\
+34329168149020134400358076493774220564483240987538866711281966656859\
+18228754994689923361234391823268535969284464590048851347740342490135\
+80582121673049738942667229825249768347409932358345160950361775166418\
+82751455678372618713022132536591723169934677105756691317738344397268\
+90573948285753449856526392182699265739146286909855515863327591370172\
+96513402830426867299550070873218083912846316696859579237689097606617\
+51412181799181999491584413579614146497226592868301697388159623700483\
+00659079928861331453476112481313601846831595328497558270598024459232\
+74912696765475545648721620753770739038715242528380011572795805287890\
+01939075629577724714913609448633168350641667779462272317624977977687\
+89411614882740247487664271240314348194082962843296263500386625878796\
+16008267844410696232952338235393887568658739373008887867945112312649\
+37512501534803268323910539533256177216274619007193744007547951718027\
+44891444064662982576153272050128040514240063258499485242019550507676\
+49205138815607756069725427984311319511383142516469030500318130266868\
+09562452698690462723828096105664810553482713948643515707658305658393\
+72023560005542444849685206743523113508500669188917639514697867955895\
+12373464625905759443093770382990555315516365416332558133979562433906\
+64399570722334065625238452042436862494620574134988589848680778801045\
+80364738912102881123102375480846598525717754089210605941752731049392\
+56508983631805570091285332387678472351633908797365562850039083300108\
+47232419881746103565282587619297019434166937029533469166882663817564\
+29976915091973096170480140645736257668317363421806536290197863436706\
+26329935979085366547105772889986581827630974873885363455721321518675\
+74550918001246595763248153435251121743997710894306721046034483557443\
+41864814444085298842519861926734021561007690300579493326968172112502\
+95349794378935063903999801566960185173164130751935856368624282418902\
+49903427392381027457836738642462080633422197014627613031666173271030\
+24009983647554746216502223968131796915055226880729894075452499140925\
+19177060502090392977689000070401037945555335784892959624056769694880\
+70127948818327506368318902831799150505770877874320893074064721292530\
+76004340604038727565364771854369404877106769882488933769119954174458\
+63427198989142502713770105419055459625123528877838096228199336886214\
+21837202020595779957506625129762358884285607071464800971415209072458\
+75682887352693221792690653281585020879608438468426360254454386930843\
+54976719034954514257351084680941537598410460432624632742664122097832\
+55471067840289495535313044781584274249832292545673979710554622543455\
+30516485658045903022569236826984516014156085335693691217261175850028\
+11509249909703901135898031685959221507256600883997280093471285352593\
+74651564252383941896194282297958682783629524012219104563242048510868\
+49404888188055550910540455332990660903744972091115431351121998533490\
+10628770561915126917221852108705651086200022632698873237836290310011\
+50397167016292123727570196128842632496685647047378603671979173369902\
+38344528655539740311539345421161242532069895829237353049373101325730\
+58493431814287223494709459895137424641564383576690784600424038087145\
+68158626235336913952048107753521197980942527673210440048833533401989\
+77194468283364506459394258867172301466872892027180482209222506949673\
+75540211531086133182859182501150200938696263997726250563093539326927\
+72416498048175683546939420898769717737493711540907129536293416724813\
+97334892336321395426368347878890663066224459524345472570152264395565\
+82460457205896704725983507812401218371956212982033047108572121728288\
+68439360992844654681941401782292533682559747777726117649955921552419\
+55376528393134227258758852448268802426432183531325943771999071974220\
+84507900584510094182786537515367929613158392549027805302398374451653\
+29783084211098081095916445508682076609084201827750535494005579802641\
+02110253224910370222254741046671205720360236688797968947854015063183\
+74781883451633687835151401181076347221311394223209721077894188865562\
+17163237549065972085718513359358745797320834007267934729637068457958\
+78217344964677096738194254363183885544424572157628941346479343797930\
+63230768723171941706715546034642365335802368178916578666998370822061\
+72862620144866941168433360449388831342015135002439921450475536956234\
+85718095823776355549608105131404093038257448195903825875318154784464\
+57935967137213602336432368420092393199865275518568170524736528628808\
+93046789512886643769514221911060706901882607274461392115657530222519\
+60506897541913211652548871872655185050770561256446930362103759873477\
+20814169286537387159054802380892512900817347470322088751411585458882\
+41036364127218851060253574463952502666758564753936431041853733829336\
+81956327037910407368879304536602331340358193253227646166149675880981\
+90185334787495657054886233085573272038907945218357219923287605428049\
+35666687006406359493768055467531146025838548653407558188013071660477\
+24887464015842344700561688728471808389891252725983936114487839466957\
+40043539434901358379294391964732252971766132528295626269595832591134\
+56027086653085411942665786654648139554565734237361808707377581887789\
+66923318292898929469635931606196495932835130228371557394460176225814\
+11294729746332614993610933221574816059609941245722612553947822056329\
+45166526051215867786737290871927622630571958311944341999538582128241\
+88101449037438663818287018817893377018470050800767265593919107803658\
+99179719652514229604754127018714522533683024867676021795442147409531\
+82665068198462837070231146555812259357357244425469897484784424722789\
+98092162511423506856070449076457969548678211615932082662896053695730\
+59596107990542324416612202410744156365868863162658463321070228706136\
+03710190425407794885324375605255084573684494837484778909503277766179\
+03805931454654223652089029461399110825127848153069688576228655184611\
+79768137149996093510064025168479068628086773645884984425319145539556\
+76075842624219168086936568629614756427244958470902064700287889315121\
+42821595391061266909080096092842976758284557671645207398033087646044\
+17795953284430870706941395475756240133534497464444148185165836807395\
+71914117065975311130980817438007210936836173788977246078579157885631\
+72554614326985076533529062730320433321718255208710180221207959776564\
+44807136643850248843075432242048108865528202646121118339881280138404\
+82631669965543003783709309604010072045746432183362756236508231558635\
+61612161495534067211577721563585202440442091745682170086700119976895\
+75305033539518807762552637355861809986052721463214055606925010502791\
+07576812492087807771863865045627658966172004291057058152115216759979\
+22319079703493506449231900704401329270559051817722834844916790378159\
+11859709258213481757435116529558560545817146375060752889351017308411\
+95572062296153349066166356419465693735841939197159220983287655122200\
+09840635157449290677165408337833131188667931637453023949628963892756\
+63193160301363072401750285289993232161836627416139186835622928460896\
+48149321238238359576069768524810647473234302169351941202863446100303\
+53232244538087380921705800082227661328078185734538075621775853483863\
+46009590875234025712706120859992692401627589733758997890952517701102\
+02016569612428376053082696146484227576336230217783445219505920601019\
+33095515519409035408457025188297805207228192604390482809071392611771\
+33574590494165516290378201746154276638463914544405829940734889440058\
+50872804307391483948705360196306393676853047662331937698157275120923\
+48711155405917301727814008897384220075085940864758781426442918315337\
+44390460389070271397096746357700721225995274575108538008722000506426\
+47404684409899926300364430394284048326877036744378234790013121512243\
+33164520619956221756712877328384924842769057299918312486776801292033\
+39413452695345490240752153799893116785749303845400056553954464555994\
+39334000822859108507894822667482270295636516694380611524569121800656\
+78897195293770217125145562613393065181685018248294372660081402258855\
+48853815860093731077664651690349598684633625439324574755046646013201\
+06398457066352039259763533826806131024950715685749198907167018006511\
+02464285979192745974664572565800070933275878035489902288536459657148\
+10685133636383678846628804163294690525771415724388606805062681265155\
+37392172544282115243622208997041455133123289393606286284500392860748\
+62119813421171900660703096743899221542487565865013924144916275687604\
+64479606566082627831225860827957.17168783602794452821
+28791115786912240198245990478525647696448607532847787454795539441976\
+53008508268300461139912183674125065861791306990382838955098345250249\
+22502669615923663783199016557590859598868092987910291249798821013403\
+47170755689306294929681899092787860167594484443520025764276997309005\
+71232591347006382641934629802477111942681146373278874858958991309971\
+42218657973486847296406258064331676882178534298665203090265502510842\
+61357125721516691133409251768860513967679408456139499213904923923576\
+37499277430205645222804747709288259277839665497374416103934921664053\
+88731269133493437149540799596101039891946001868119671990803717566748\
+68467317062896591145978297935654103133461783237181415461118621447827\
+16566513542336675866067109631200815886090268983547210391679827916177\
+66749211382337550790076502678641642759218859737882068043983365758093\
+88115252413477398218126191256394635905372596424544841499726539685941\
+78846216282131573581580140976129717830765415534880473794126349434060\
+97681722453558939398648461893368494055862371927814819807297911399492\
+95580520229158808988334006735101124776362181960799247867627735191693\
+73903485711688121338008278287587497284624296263925302024072761974353\
+61966862903296298157098997084877146402382401378955497440970708541715\
+71060260791739883205083920081207497221052029803497230694536402248293\
+84189292235575350657775157901460538210293883451036457246928408437463\
+57025709490435640319319731216408410871212349724010449894980914894111\
+45126169053678363169035062112633812855552434451031074552786171143660\
+17791316677936527412873416758988896839052262917297431626073985184825\
+68730935720280511977117820747425896122905967666049570524572855538268\
+71933166116690914412078365573528353249200818122694099666956346567349\
+56010083783703566732405340529840912472403938999295934861826136988528\
+52894398797143227990144946007954597506649176236568417409173396261740\
+09944204836056027440284138866913080493697596579842739525086068210108\
+30917026182518589497356978161501183235810718665383370604175757091568\
+10504733159455864451885520846599280592234061718671428498049587028363\
+09597188469848024202986163560176441060995115838886952815416199737130\
+85184131031637903681209647592228571844358102702795272489240540680335\
+22995408987458398979652061771760715657085982221294267557650384941211\
+16571782590299783628409645657075923536327475626565993147833196817893\
+84890960043718955708485355506889614382188765539323874543288395613135\
+48259205614690288575840557276052824284532091372945666583648761976586\
+54283058035504963407488664771183492661235835415687745843736315114774\
+43686975428521437310363210532146903026713880922536383314487398789950\
+21702186636914955380336514259253343897789306312138193893174316891009\
+25090195344105820648333601730709055646550997346188323397099605767390\
+34894823825457067510931521240790321078124435027433519041465778273927\
+23319532476569131737943328836549868951187283843748101565050501127139\
+39788055683460535125272798566822769537496548960358061381835527396784\
+44159701828925988029710177774963814786204991523055795795848219525653\
+78564959121442581906399531806160230589018845426048851169697986777287\
+74075545396657630131400229956599605344545338728285946750023266326131\
+18395556301061966915885165125087447008943040958729761732405732133453\
+05659206180031669466579706301575290530027196513949455331037954675305\
+91429773751487919865699329769483827518561578140696380487766857058838\
+31309495041955167145108840698853798192292390926661492994257145343218\
+75197591439357956390053018804271252634995353886475156597147490672190\
+84005441103601046351701967370002688361030978781507248572868925129931\
+45212430472187369787725343203192539974915241551259671056853308250443\
+11579521168679966954003584316378530310813735804407853338924589172695\
+49587287454029232631399437877164701878506916307005029866776607783174\
+00990236971979307623094886527377840855865891785310660470287570263965\
+61154240289857785082315249341545762749489375521484585792993526397150\
+25291795278405033005502446233161932054427925917356980644302691002421\
+05338681858378618032104503307510725895517575751909671470465133180844\
+45243480750024854699238912226469242734228059627483302616513195012834\
+43802954961131534089020537879306473924379457087764802237333653274089\
+09872997910414155414383580061821406683789130399702013589496974143998\
+44210014079488461309789159536423690801631777295441838031615666359452\
+91792585173201915395374115631184500874352677152997721623175685942803\
+12895271487864578322544981918732876539884531639075213978691991567128\
+92573298522996863101920878033796664977571688329072100951103604405455\
+04594983831740226312202494100656829982197377383796775671017926797756\
+33549687557826719410938591588030077844865002785718028430426129760210\
+36066302087600569325663160491853875481246546462291564965235321897400\
+09821990048706319068186530740803926837337644235256457047575804469608\
+57918916920499725776957856681677440330511211984210012143987263574481\
+71709887053711071662845885541874087944270034896684123101730242288672\
+65579256713582552909399156304710870435571862371857243373965327959283\
+24373963625438574863307319451700340730565660031867078113256711758690\
+18796202639316990441856414190865637384044006457067135125967606919472\
+95170121458841562486321464164304264236784363298699561094832596396303\
+92360868258336925172544977314262275517987378331545670817629321398756\
+15182133973429985062471316188494603822719972823331439920331498101624\
+22111613425281021340447127502486056789900343682995162436423970012504\
+90978225961351399347128920481166268040828775885589315967277308416623\
+10747904592254184017050343694378092682731532047514967157960793406652\
+36139056722846794201187751078359641314204515940335354669085175926977\
+07798383659826703423446297688966624848039546300824464419495212357576\
+30053757647015611767992745708562501425118059217142265688975505274910\
+97787536006751801909703819658921934635314177988896852619491725638370\
+71808330540021305608094054601852463148765060366588983799418357589432\
+50483622298669607953178468063724713066810575740314939366769021165167\
+07815391414524210692762963631699377023760137647543023883110883.71538\
+917119055084587
+-1.00000000000000000000
+1.00000000000000000000
+-.50000000000000000000
+.25000000000000000000
+0
+0
+-6311170951758340301695281786963968566677422268510931490731625646715\
+38125720985932037093927317044573426510551289791217448529282843416440\
+05520241029621417251047599699565382090122980340754774043142594913023\
+41451303393302883218750389898179604908116730833849497339744904526958\
+92448895393345637572643345481921080373277750542706722066894818520149\
+55418007617650491691821446193721233611264616251750844770017173787564\
+04232060714472103058158955208768415961630196604514972898509827500777\
+27629930054547832303627233403424962009295500700592022031464695225081\
+69492417968838445910538898321612151030444695696921499051881571008127\
+66125471882262561112705701582131968122295251908747948325161616700850\
+85967720641482842278602425546630702337458673286944405688069366413844\
+74467291289141708874382307277925684201714645138026540159746689295598\
+49229569543693814809740194976378989712946860327540588853786160311862\
+26553843014447253417608142170534232089237645726271317586792866436463\
+57906771436600573193316692947877521038683967731837711063242972271670\
+96055668939700794111101379234021535739329350922700763647464255738367\
+45664949133751858862157294162807244687731159626486653201155582499714\
+79484408164370429277582140594961024021235193104960984535030512698140\
+29991642773255454178297132207171199052829597210364476553497942817268\
+62690611849309055824536998344110574782877812780572822768074693914603\
+93441675889749948913356381877977663664670923405154024034819183077630\
+07222467129739709730595197712146877807485841798099359485655082017504\
+57266468940919731337521917893149437593088571899978481009627569104752\
+83788737229048754086398051323802242295499011906844043041969326497378\
+66830847485298392258392207609286448536144199906732162033971327749980\
+72409681682525277718455729872598195785847026351837425524957713502283\
+35808405846301401511404101208274836584641837898337018415760457721775\
+34793070383077489542736177701902455308320830139111584515391609551696\
+93786802204354185248901167656622471020051493389173955741467861607741\
+06154885234719288084392388173679574839263106373769157250023377763195\
+33722849246313238409188148501441642227744274888764386850047852926601\
+66259132899777197674037156711065912041415912906771682871632890618266\
+52534846581370718069768101784480970852297316593250497344665499975249\
+28847715738269148419095709788743634068235772638161673973508170592990\
+08150460394328942539838852965761260991598586792881336905193093363807\
+68065001971035985210175312847093321437455851062753166316674526831405\
+22643924906227066856960275731105243745519239095725263849049284368192\
+69981817924601931034908526477849233791352299993888953628294142682398\
+32015215644146196271258557701759614063395810649987412865008620060711\
+96106494559320848767208198924865288907648098617871697423778043460357\
+69278505913120523758525932088676939064487208006723185721403213528197\
+47356185573586878001575522729281782905160737709112298608240868302736\
+14912060528477110966342331323542913308637670012031732420815525850428\
+29985502836060351264856351721233689681302128443493923953325682146378\
+90500497094869973228157090077323643982214655247057954479537461140251\
+22391223645059066176683097828439526347990270348890072988824089134075\
+53045635915091127616051632821157251240715937718601438621807151809470\
+70020273648673726614138773619623873071209988854639064449056946951244\
+08154683439806851412045718493101194516264182543687642102731940333675\
+02204434515648501183682202170295476412677952210259771498961159478693\
+39533360510234199050863187055497001898319590310626558410825947546499\
+25866422095282655331612522936168323192019066427954358596287913432824\
+23986416514347998122918766123490242000799600412705715403792955802428\
+68680411940581906418239192566545624215426795832902852897359879579206\
+29806298084768133342364905840962242909627360003836496432663468404056\
+75003716322755561456947876758325012806130640785145137044014345149729\
+64472421537485940360688927943947253997322254484456390238538599823516\
+53783313664554244804188239596232973290117637825103346417364845445537\
+63874844173295342500665949524580816903010072450214234574076441210052\
+76312238941224960108202455846209231258733492737852892758457199956062\
+64745301484120814116015376716640043059840936868045425494746747743167\
+47635509486725886548517712648186478000538173675010335580427072223374\
+22683297174260468174666990490676363371877116991078914450165283451094\
+38053584777926914783233278650205938696956998820904630096199992054805\
+15352923265061131541221436151100238443368250876934012537521701653429\
+83749419904181832047886489040835511827487858712692455203809244256381\
+95363676537203584858079014204774516763297210884678721481745464679151\
+34153801765303831091048471166149310881939079992670658056687054966453\
+64078260772450818012184785716598737407583554314901714361312982863209\
+08568827536105214917228565402326151858487667522128825392025654986079\
+94364340694436809828167006177389014092285574489110459783543308691830\
+81359774673499877856622602227027179803067114877976882524477854727554\
+43145812466491583566468289389559643610433010688516435918531866978568\
+98694778365921976545970326296067215777099795140100793885931248501330\
+88092521136829832995633382275605096697602165804297877578997817111968\
+18131992614391087249610046250364652601740222742376049435751285932886\
+51855281108498217714451092451205316423498083202395699293550040438603\
+96607653833910364834434269652078271541907585050569750193777851038475\
+94658423552329776425242871169305484855793189639257265149554708344704\
+30807466779976397658781768927423667079487402547120198173689660436452\
+23216183977421942478485697014756283.15080425429190208981
+-1945134149489344891879057554905782841936258356736314337975569799825\
+94091939572752348215929683891336730843553721422164737465108229034947\
+87333189564755763444242676978610321731298729194092653999616928308494\
+26419468484566422775668903315088810746121307679948574976162519479931\
+18935243698160094347216562490000767121041786977792546155155934655909\
+14123833869470494708767968978717730012864171105540029928688274136791\
+98175053824022144065005509214813689232148489884560100200475909009813\
+340098100705258138.98542904577525702068
+0
+0
diff --git a/tests/files/bc/print.bc b/tests/files/bc/print.bc
new file mode 100755
index 00000000..e8423c21
--- /dev/null
+++ b/tests/files/bc/print.bc
@@ -0,0 +1,21 @@
+#! /usr/bin/bc -q
+
+for (b = 2; b <= 16; ++b) {
+
+ if (b == 10) continue
+
+ s = b * b
+
+ print "obase = ", b, "\n"
+
+ for (i = 0; i <= s; ++i) {
+ i
+ print "0.", i, "\n"
+ print "1.", i, "\n"
+ print i, ".", i, "\n"
+ }
+
+ 2189432174861923048671023498128347619023487610234689172304.192748960128745108927461089237469018723460
+}
+
+halt
diff --git a/tests/files/bc/screen.bc b/tests/files/bc/screen.bc
new file mode 100644
index 00000000..916b4f6a
--- /dev/null
+++ b/tests/files/bc/screen.bc
@@ -0,0 +1,19 @@
+define a(i, j) {
+ scale = 0
+ if(i % 2 == 0) return i;
+ if(j - i >= 0.5) return i + 1;
+ return i - 1;
+}
+
+define x(w, h, n) {
+ scale = 20
+ f = w / n
+ scale = 0
+ i = h / f
+ scale = 1
+ j = h / f
+ return a(i, j);
+}
+
+x(720, 576, 600)
+
diff --git a/tests/files/bc/script.sh b/tests/files/bc/script.sh
new file mode 100644
index 00000000..d279b6a2
--- /dev/null
+++ b/tests/files/bc/script.sh
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+if [ "$#" -lt 4 ]; then
+ echo "usage: script.sh <bc> <test_output1> <test_output2> <script>"
+ exit 1
+fi
+
+set -e
+
+bc="$1"
+shift
+
+out1="$1"
+shift
+
+out2="$1"
+shift
+
+script="$1"
+
+echo "quit" | bc -lq "$script" > "$out1"
+echo "quit" | "$bc" -lq "$script" > "$out2"
+
+diff "$out1" "$out2"
diff --git a/tests/files/bc/sqrt.txt b/tests/files/bc/sqrt.txt
new file mode 100644
index 00000000..8be84ca6
--- /dev/null
+++ b/tests/files/bc/sqrt.txt
@@ -0,0 +1,12 @@
+scale = 20
+sqrt(0)
+sqrt(2)
+sqrt(4)
+sqrt(9)
+sqrt(16)
+sqrt(25)
+sqrt(121)
+sqrt(48765)
+sqrt(9287356207356)
+sqrt(0.189274385967238956872354)
+sqrt(12389467137496823.134567829387456283946)
diff --git a/tests/files/bc/sqrt_results.txt b/tests/files/bc/sqrt_results.txt
new file mode 100644
index 00000000..8005a310
--- /dev/null
+++ b/tests/files/bc/sqrt_results.txt
@@ -0,0 +1,11 @@
+0
+1.41421356237309504880
+2.00000000000000000000
+3.00000000000000000000
+4.00000000000000000000
+5.00000000000000000000
+11.00000000000000000000
+220.82798735667542192643
+3047516.39985021245496456781
+.435056761776252544285578
+111307983.260397019622398608908
diff --git a/tests/files/bc/subtract.txt b/tests/files/bc/subtract.txt
new file mode 100644
index 00000000..4fdebea8
--- /dev/null
+++ b/tests/files/bc/subtract.txt
@@ -0,0 +1,30 @@
+0 - 0
+0 - 1
+1 - 0
+1 - 1
+5 - 2
+2 - 9
+321974 - 12845976238457
+2874519803456710938465- 384723854
+10000000000000000000000000000000000000000 - 999999999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 9999999999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 999999999999999999999999999999999999999.99999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 9999999999999999999999999999999999999999.9999999999999999999999999999999999
+10000000000000000000000000000000000000000 - 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+10000000000000000000000000000000000000001 - 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+10000000000000000000000000000000000000000.0000000001 - 0.0000000000000000000000000000000000000000000000000000000000000000000000000001
+-2 - 6
+-23784692345 - 182934721309467230894628735496027345
+-224352354962873059862 - -1245723576829456278354960278345
+-3468273598 - -12354243
+-0.92345768293 - -2354768923
+-712384634.123476823 - -24768293376
+-1879234638 - -0.917234869234
+-0.9172438692134 - -0.971284967124
+-0.1283475123465 - -0.937462346
+-124765829346.2837468293562 - -0.923467829346
+-12476829385769 - -1928476259034.8378629356
+-0.38476284395876345 - -94875394587623.2357869324857
+-4674596708467.34754789403674343567 - -48672394852354698.237548629345
+979519669 - 3018100865
+929002449 - 3280677283
diff --git a/tests/files/bc/subtract_results.txt b/tests/files/bc/subtract_results.txt
new file mode 100644
index 00000000..71488d50
--- /dev/null
+++ b/tests/files/bc/subtract_results.txt
@@ -0,0 +1,34 @@
+0
+-1
+1
+0
+3
+-7
+-12845975916483
+2874519803456326214611
+9000000000000000000000000000000000000001
+1
+9000000000000000000000000000000000000000.000000000000000000000000000\
+00000001
+.0000000000000000000000000000000001
+9999999999999999999999999999999999999999.999999999999999999999999999\
+99999999999999999999999999999999999999999999999999999999999
+10000000000000000000000000000000000000000.99999999999999999999999999\
+999999999999999999999999999999999999999999999999999999999999
+10000000000000000000000000000000000000000.00000000009999999999999999\
+99999999999999999999999999999999999999999999999999
+-8
+-182934721309467230894628759280719690
+1245723576605103923392087218483
+-3455919355
+2354768922.07654231707
+24055908741.876523177
+-1879234637.082765130766
+.0540410979106
+.8091148336535
+-124765829345.3602790000102
+-10548353126734.1621370644
+94875394587622.85102408852693655
+48667720255646230.89000073530825656433
+-2038581196
+-2351674834