File: latex_build_fix

package info (click to toggle)
libtommath 1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,248 kB
  • ctags: 1,707
  • sloc: ansic: 15,034; perl: 400; makefile: 278; sh: 169; asm: 30
file content (1808 lines) | stat: -rw-r--r-- 63,057 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
Description: LaTeX build fix
 It seems you cannot use "[here]" anymore to indicate float placement;
 the correct usage is "[h]", as documented e.g. here:
 https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
Bug-Debian: https://bugs.debian.org/790320
Author: Martin Michlmayr <tbm@hpe.com>
---


--- a/booker.pl
+++ b/booker.pl
@@ -251,7 +251,7 @@
       # FIGU,file,caption
       chomp($_);
       @m = split(",", $_);
-      print OUT "\\begin{center}\n\\begin{figure}[here]\n\\includegraphics{pics/$m[1]$graph}\n";
+      print OUT "\\begin{center}\n\\begin{figure}[h]\n\\includegraphics{pics/$m[1]$graph}\n";
       print OUT "\\caption{$m[2]}\n\\label{pic:$m[1]}\n\\end{figure}\n\\end{center}\n";
       $wroteline += 4;
    } else {
--- a/bn.tex
+++ b/bn.tex
@@ -257,7 +257,7 @@
 So you may be thinking ``should I use LibTomMath?'' and the answer is a definite maybe.  Let me tabulate what I think
 are the pros and cons of LibTomMath by comparing it to the math routines from GnuPG\footnote{GnuPG v1.2.3 versus LibTomMath v0.28}.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|l|c|c|l|}
@@ -299,7 +299,7 @@
 There are three possible return codes a function may return.
 
 \index{MP\_OKAY}\index{MP\_YES}\index{MP\_NO}\index{MP\_VAL}\index{MP\_MEM}
-\begin{figure}[here!]
+\begin{figure}[h!]
 \begin{center}
 \begin{small}
 \begin{tabular}{|l|l|}
@@ -822,7 +822,7 @@
 for any comparison.
 
 \index{MP\_GT} \index{MP\_EQ} \index{MP\_LT}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|c|c|}
 \hline \textbf{Result Code} & \textbf{Meaning} \\
@@ -1289,7 +1289,7 @@
 \end{alltt}
 Where ``XXX'' is one of the following entries from the table \ref{fig:tuning}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|l|l|}
@@ -1738,7 +1738,7 @@
 (see fig. \ref{fig:primeopts}) which can be OR'ed together.  The callback parameters are used as in
 mp\_prime\_random().
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|r|l|}
--- a/tommath.src
+++ b/tommath.src
@@ -175,7 +175,7 @@
 typical RSA modulus would be at least greater than $10^{309}$.  However, modern programming languages such as ISO C \cite{ISOC} and
 Java \cite{JAVA} only provide instrinsic support for integers which are relatively small and single precision.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{center}
 \begin{tabular}{|r|c|}
 \hline \textbf{Data Type} & \textbf{Range} \\
@@ -366,7 +366,7 @@
 exercises ranges from one (the easiest) to five (the hardest).  The following table sumarizes the
 scoring system used.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|c|l|}
@@ -573,7 +573,7 @@
 used within LibTomMath.
 
 \index{mp\_int}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 %\begin{verbatim}
@@ -670,7 +670,7 @@
 \textbf{int} data type with one of the following values (fig \ref{fig:errcodes}).
 
 \index{MP\_OKAY} \index{MP\_VAL} \index{MP\_MEM}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|l|l|}
 \hline \textbf{Value} & \textbf{Meaning} \\
@@ -719,7 +719,7 @@
 structure are set to valid values.  The mp\_init algorithm will perform such an action.
 
 \index{mp\_init}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_init}. \\
@@ -793,7 +793,7 @@
 When an mp\_int is no longer required by the application, the memory that has been allocated for its digits must be
 returned to the application's memory pool with the mp\_clear algorithm.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_clear}. \\
@@ -857,7 +857,7 @@
 is large enough to simply increase the \textbf{used} digit count.  However, when the size of the array is too small it
 must be re-sized appropriately to accomodate the result.  The mp\_grow algorithm will provide this functionality.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_grow}. \\
@@ -911,7 +911,7 @@
 of input mp\_ints to a given algorithm.  The purpose of algorithm mp\_init\_size is similar to mp\_init except that it
 will allocate \textit{at least} a specified number of digits.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -963,7 +963,7 @@
 The purpose of algorithm mp\_init\_multi is to initialize a variable length array of mp\_int structures in a single
 statement.  It is essentially a shortcut to multiple initializations.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_init\_multi}. \\
@@ -1022,7 +1022,7 @@
 positive number which means that if the \textbf{used} count is decremented to zero, the sign must be set to
 \textbf{MP\_ZPOS}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_clamp}. \\
@@ -1090,7 +1090,7 @@
 a copy for the purposes of this text.  The copy of the mp\_int will be a separate entity that represents the same
 value as the mp\_int it was copied from.  The mp\_copy algorithm provides this functionality.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_copy}. \\
@@ -1205,7 +1205,7 @@
 useful within functions that need to modify an argument but do not wish to actually modify the original copy.  The
 mp\_init\_copy algorithm has been designed to help perform this task.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_init\_copy}. \\
@@ -1235,7 +1235,7 @@
 Reseting an mp\_int to the default state is a common step in many algorithms.  The mp\_zero algorithm will be the algorithm used to
 perform this task.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_zero}. \\
@@ -1265,7 +1265,7 @@
 With the mp\_int representation of an integer, calculating the absolute value is trivial.  The mp\_abs algorithm will compute
 the absolute value of an mp\_int.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_abs}. \\
@@ -1297,7 +1297,7 @@
 With the mp\_int representation of an integer, calculating the negation is also trivial.  The mp\_neg algorithm will compute
 the negative of an mp\_int input.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_neg}. \\
@@ -1334,7 +1334,7 @@
 \subsection{Setting Small Constants}
 Often a mp\_int must be set to a relatively small value such as $1$ or $2$.  For these cases the mp\_set algorithm is useful.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_set}. \\
@@ -1375,7 +1375,7 @@
 To overcome the limitations of the mp\_set algorithm the mp\_set\_int algorithm is ideal.  It accepts a ``long''
 data type as input and will always treat it as a 32-bit integer.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_set\_int}. \\
@@ -1425,7 +1425,7 @@
 
 To facilitate working with the results of the comparison functions three constants are required.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|r|l|}
 \hline \textbf{Constant} & \textbf{Meaning} \\
@@ -1438,7 +1438,7 @@
 \caption{Comparison Return Codes}
 \end{figure}
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_cmp\_mag}. \\
@@ -1479,7 +1479,7 @@
 Comparing with sign considerations is also fairly critical in several routines (\textit{division for example}).  Based on an unsigned magnitude
 comparison a trivial signed comparison algorithm can be written.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_cmp}. \\
@@ -1560,7 +1560,7 @@
 Historically that convention stems from the MPI library where ``s\_'' stood for static functions that were hidden from the developer entirely.
 
 \newpage
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{center}
 \begin{small}
 \begin{tabular}{l}
@@ -1663,7 +1663,7 @@
 For example, the default for LibTomMath is to use a ``unsigned long'' for the mp\_digit ``type'' while $\beta = 2^{28}$.  In ISO C an ``unsigned long''
 data type must be able to represent $0 \le x < 2^{32}$ meaning that in this case $\gamma \ge 32$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{center}
 \begin{small}
 \begin{tabular}{l}
@@ -1754,7 +1754,7 @@
 Recall from section 5.2 that an mp\_int represents an integer with an unsigned mantissa (\textit{the array of digits}) and a \textbf{sign}
 flag.  A high level addition is actually performed as a series of eight separate cases which can be optimized down to three unique cases.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_add}. \\
@@ -1783,7 +1783,7 @@
 either \cite{TAOCPV2} or \cite{HAC} since they both only provide unsigned operations.  The algorithm is fairly
 straightforward but restricted since subtraction can only produce positive results.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|}
@@ -1833,7 +1833,7 @@
 \subsection{High Level Subtraction}
 The high level signed subtraction algorithm is essentially the same as the high level signed addition algorithm.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_sub}. \\
@@ -1865,7 +1865,7 @@
 \cite{HAC}.  Also this algorithm is restricted by algorithm s\_mp\_sub.  Chart \ref{fig:SubChart} lists the eight possible inputs and
 the operations required.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|}
@@ -1911,7 +1911,7 @@
 In a binary system where the radix is a power of two multiplication by two not only arises often in other algorithms it is a fairly efficient
 operation to perform.  A single precision logical shift left is sufficient to multiply a single digit by two.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -1967,7 +1967,7 @@
 \subsection{Division by Two}
 A division by two can just as easily be accomplished with a logical shift right as multiplication by two can be with a logical shift left.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2024,7 +2024,7 @@
 degree.  In this case $f(x) \cdot x = a_n x^{n+1} + a_{n-1} x^n + ... + a_0 x$.  From a scalar basis point of view multiplying by $x$ is equivalent to
 multiplying by the integer $\beta$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2080,7 +2080,7 @@
 
 Division by powers of $x$ is easily achieved by shifting the digits right and removing any that will end up to the right of the zero'th digit.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2136,7 +2136,7 @@
 
 \subsection{Multiplication by Power of Two}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2199,7 +2199,7 @@
 
 \subsection{Division by Power of Two}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2252,7 +2252,7 @@
 The last algorithm in the series of polynomial basis power of two algorithms is calculating the remainder of division by $2^b$.  This
 algorithm benefits from the fact that in twos complement arithmetic $a \mbox{ (mod }2^b\mbox{)}$ is the same as $a$ AND $2^b - 1$.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2363,7 +2363,7 @@
 include $\alpha$ which shall represent the number of bits in the type \textbf{mp\_word}.  This implies that $2^{\alpha} > 2 \cdot \beta^2$.  The
 constant $\delta = 2^{\alpha - 2lg(\beta)}$ will represent the maximal weight of any column in a product (\textit{see ~COMBA~ for more information}).
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2422,7 +2422,7 @@
 For example, consider multiplying $576$ by $241$.  That is equivalent to computing $10^0(1)(576) + 10^1(4)(576) + 10^2(2)(576)$ which is best
 visualized in the following table.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|c|l|}
 \hline   &&          & 5 & 7 & 6 & \\
@@ -2500,7 +2500,7 @@
 Where $\vec x_n$ is the $n'th$ column of the output vector.  Consider the following example which computes the vector $\vec x$ for the multiplication
 of $576$ and $241$.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|c|}
@@ -2521,7 +2521,7 @@
 Now the columns must be fixed by propagating the carry upwards.  The resultant vector will have one extra dimension over the input vector which is
 congruent to adding a leading zero digit.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2577,7 +2577,7 @@
 the smaller input may not have more than $256$ digits if the Comba method is to be used.  This is quite satisfactory for most applications since
 $256$ digits would allow for numbers in the range of $0 \le x < 2^{7168}$ which, is much larger than most public key cryptographic algorithms require.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2783,7 +2783,7 @@
 of this system of equations has made Karatsuba fairly popular.  In fact the cutoff point is often fairly low\footnote{With LibTomMath 0.18 it is 70 and 109 digits for the Intel P4 and AMD Athlon respectively.}
 making it an ideal algorithm to speed up certain public key cryptosystems such as RSA and Diffie-Hellman.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2888,7 +2888,7 @@
 the algorithm can be faster than a baseline multiplication.  However, the greater complexity of this algorithm places the cutoff point
 (\textbf{TOOM\_MUL\_CUTOFF}) where Toom-Cook becomes more efficient much higher than the Karatsuba cutoff point.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2925,7 +2925,7 @@
 \caption{Algorithm mp\_toom\_mul}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2997,7 +2997,7 @@
 Now that algorithms to handle multiplications of every useful dimensions have been developed, a rather simple finishing touch is required.  So far all
 of the multiplication algorithms have been unsigned multiplications which leaves only a signed multiplication algorithm to be established.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3051,7 +3051,7 @@
 For any $n$-digit input, there are ${{\left (n^2 + n \right)}\over 2}$ possible unique single precision multiplications required compared to the $n^2$
 required for multiplication.  The following diagram gives an example of the operations required.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{ccccc|c}
 &&1&2&3&\\
@@ -3080,7 +3080,7 @@
 The baseline squaring algorithm is meant to be a catch-all squaring algorithm.  It will handle any of the input sizes that the faster routines
 will not handle.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3159,7 +3159,7 @@
 mp\_word arrays.  One array will hold the squares and the other array will hold the double products.  With both arrays the doubling and
 carry propagation can be moved to a $O(n)$ work level outside the $O(n^2)$ level.  In this case, we have an even simpler solution in mind.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3249,7 +3249,7 @@
 The 100 digit halves will not be squared using Karatsuba, but instead using the faster Comba based squaring algorithm.  If Karatsuba multiplication
 were used instead, the 100 digit numbers would be squared with a slower Comba based multiplication.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3342,7 +3342,7 @@
 derive their own Toom-Cook squaring algorithm.
 
 \subsection{High Level Squaring}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3560,7 +3560,7 @@
 is considerably faster than the straightforward $3m^2$ method.
 
 \subsection{The Barrett Algorithm}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3634,7 +3634,7 @@
 In order to use algorithm mp\_reduce the value of $\mu$ must be calculated in advance.  Ideally this value should be computed once and stored for
 future use so that the Barrett algorithm can be used without delay.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3680,7 +3680,7 @@
 
 From these two simple facts the following simple algorithm can be derived.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3706,7 +3706,7 @@
 final result of the Montgomery algorithm.  If $k > lg(n)$ and $0 \le x < n^2$ then the final result is limited to
 $0 \le r < \lfloor x/2^k \rfloor + n$.  As a result at most a single subtraction is required to get the residue desired.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|l|}
@@ -3736,7 +3736,7 @@
 and $k^2$ single precision additions.  At this rate the algorithm is most certainly slower than Barrett reduction and not terribly useful.
 Fortunately there exists an alternative representation of the algorithm.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3758,7 +3758,7 @@
 This algorithm is equivalent since $2^tn$ is a multiple of $n$ and the lower $k$ bits of $x$ are zero by step 2.  The number of single
 precision shifts has now been reduced from $2k^2$ to $k^2 + k$ which is only a small improvement.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|l|r|}
@@ -3791,7 +3791,7 @@
 Instead of computing the reduction on a bit-by-bit basis it is actually much faster to compute it on digit-by-digit basis.  Consider the
 previous algorithm re-written to compute the Montgomery reduction in this new fashion.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3849,7 +3849,7 @@
 The baseline Montgomery reduction algorithm will produce the residue for any size input.  It is designed to be a catch-all algororithm for
 Montgomery reductions.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3933,7 +3933,7 @@
 With this change in place the Montgomery reduction algorithm can be performed with a Comba style multiplication loop which substantially increases
 the speed of the algorithm.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4014,7 +4014,7 @@
 \subsection{Montgomery Setup}
 To calculate the variable $\rho$ a relatively simple algorithm will be required.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4070,7 +4070,7 @@
 The variable $n$ reduces modulo $n - k$ to $k$.  By putting $q = \lfloor x/n \rfloor$ and $r = x \mbox{ mod } n$
 into the equation the original congruence is reproduced, thus concluding the proof.  The following algorithm is based on this observation.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4183,7 +4183,7 @@
 of $x$ and $q$.  The resulting algorithm is very efficient and can lead to substantial improvements over Barrett and Montgomery reduction when modular
 exponentiations are performed.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4249,7 +4249,7 @@
 To setup the restricted Diminished Radix algorithm the value $k = \beta - n_0$ is required.  This algorithm is not really complicated but provided for
 completeness.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4271,7 +4271,7 @@
 Another algorithm which will be useful is the ability to detect a restricted Diminished Radix modulus.  An integer is said to be
 of restricted Diminished Radix form if all of the digits are equal to $\beta - 1$ except the trailing digit which may be any value.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4304,7 +4304,7 @@
 In general the restricted Diminished Radix reduction algorithm is much faster since it has considerably lower overhead.  However, this new
 algorithm is much faster than either Montgomery or Barrett reduction when the moduli are of the appropriate form.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4346,7 +4346,7 @@
 \subsubsection{Unrestricted Setup}
 To setup this reduction algorithm the value of $k = 2^p - n$ is required.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4385,7 +4385,7 @@
 that there will be value of $k$ that when added to the modulus causes a carry in the first digit which propagates all the way to the most
 significant bit.  The resulting sum will be a power of two.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4487,7 +4487,7 @@
 While this current method is a considerable speed up there are further improvements to be made.  For example, the $a^{2^i}$ term does not need to
 be computed in an auxilary variable.  Consider the following equivalent algorithm.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4539,7 +4539,7 @@
 to be used when a small power of an input is required (\textit{e.g. $a^5$}).  It is faster than simply multiplying $b - 1$ times for all values of
 $b$ that are greater than three.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4590,7 +4590,7 @@
 computes the same exponentiation.  A group of $k$ bits from the exponent is called a \textit{window}.  That is it is a small window on only a
 portion of the entire exponent.  Consider the following modification to the basic left to right exponentiation algorithm.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4626,7 +4626,7 @@
 approach is to brute force search amongst the values $k = 2, 3, \ldots, 8$ for the lowest result.  Table~\ref{fig:OPTK} lists optimal values of $k$
 for various exponent sizes and compares the number of multiplication and squarings required against algorithm~\ref{fig:LTOR}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|c|c|c|c|c|c|}
@@ -4655,7 +4655,7 @@
 
 Table~\ref{fig:OPTK2} lists optimal values of $k$ for various exponent sizes and compares the work required against algorithm {\ref{fig:KARY}}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|c|c|c|c|c|c|}
@@ -4677,7 +4677,7 @@
 \label{fig:OPTK2}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4728,7 +4728,7 @@
 value of $(1/a) \mbox{ mod }c$ is computed using the modular inverse (\textit{see \ref{sec;modinv}}).  If no inverse exists the algorithm
 terminates with an error.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4780,7 +4780,7 @@
 
 \subsection{Barrett Modular Exponentiation}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4830,7 +4830,7 @@
 \caption{Algorithm s\_mp\_exptmod}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4944,7 +4944,7 @@
 Calculating $b = 2^a$ can be performed much quicker than with any of the previous algorithms.  Recall that a logical shift left $m << k$ is
 equivalent to $m \cdot 2^k$.  By this logic when $m = 1$ a quick power of two can be achieved.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4986,7 +4986,7 @@
 will be used.  Let $x$ represent the divisor and $y$ represent the dividend.  Let $q$ represent the integer quotient $\lfloor y / x \rfloor$ and
 let $r$ represent the remainder $r = y - x \lfloor y / x \rfloor$.  The following simple algorithm will be used to start the discussion.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5082,7 +5082,7 @@
 At most the quotient approaches $2\beta$, however, in practice this will not occur since that would imply the previous quotient digit was too small.
 
 \subsection{Radix-$\beta$ Division with Remainder}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5125,7 +5125,7 @@
 \caption{Algorithm mp\_div}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5248,7 +5248,7 @@
 Both addition and subtraction are performed by ``cheating'' and using mp\_set followed by the higher level addition or subtraction
 algorithms.   As a result these algorithms are subtantially simpler with a slight cost in performance.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5281,7 +5281,7 @@
 multiplication algorithm.  Essentially this algorithm is a modified version of algorithm s\_mp\_mul\_digs where one of the multiplicands
 only has one digit.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5323,7 +5323,7 @@
 Like the single digit multiplication algorithm, single digit division is also a fairly common algorithm used in radix conversion.  Since the
 divisor is only a single digit a specialized variant of the division algorithm can be used to compute the quotient.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5388,7 +5388,7 @@
 such as the real numbers.  As a result the root found can be above the true root by few and must be manually adjusted.  Ideally at the end of the
 algorithm the $n$'th root $b$ of an integer $a$ is desired such that $b^n \le a$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5441,7 +5441,7 @@
 factoring for example, can make use of random values as starting points to find factors of a composite integer.  In this case the algorithm presented
 is solely for simulations and not intended for cryptographic use.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5483,7 +5483,7 @@
 such that they are printable.  While outputting as base64 may not be too helpful for human operators it does allow communication via non binary
 mediums.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{cc|cc|cc|cc}
 \hline \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} &  \textbf{Value} & \textbf{Char} \\
@@ -5511,7 +5511,7 @@
 \label{fig:ASC}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5551,7 +5551,7 @@
 \subsection{Generating Radix-$n$ Output}
 Generating radix-$n$ output is fairly trivial with a division and remainder algorithm.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5620,7 +5620,7 @@
 The most common approach (cite) is to reduce one input modulo another.  That is if $a$ and $b$ are divisible by some integer $k$ and if $qa + r = b$ then
 $r$ is also divisible by $k$.  The reduction pattern follows $\left < a , b \right > \rightarrow \left < b, a \mbox{ mod } b \right >$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5646,7 +5646,7 @@
 greatest common divisors.  The faster approach is based on the observation that if $k$ divides both $a$ and $b$ it will also divide $a - b$.
 In particular, we would like $a - b$ to decrease in magnitude which implies that $b \ge a$.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5680,7 +5680,7 @@
 However, instead of factoring $b - a$ to find a suitable value of $p$ the powers of $p$ can be removed from $a$ and $b$ that are in common first.
 Then inside the loop whenever $b - a$ is divisible by some power of $p$ it can be safely removed.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5725,7 +5725,7 @@
 The algorithms presented so far cannot handle inputs which are zero or negative.  The following algorithm can handle all input cases properly
 and will produce the greatest common divisor.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5812,7 +5812,7 @@
 Linear Feedback Shift Registers (LFSR) tend to use registers with periods which are co-prime (\textit{e.g. the greatest common divisor is one.}).
 Similarly in number theory if a composite $n$ has two prime factors $p$ and $q$ then maximal order of any unit of $\Z/n\Z$ will be $[ p - 1, q - 1] $.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5935,7 +5935,7 @@
 factors of $p$ do not have to be known.  Furthermore, if $(a, p) = 1$ then the algorithm will terminate when the recursion requests the
 Jacobi symbol computation of $\left ( {1 \over a'} \right )$ which is simply $1$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6040,7 +6040,7 @@
 equation.
 
 \subsection{General Case}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6150,7 +6150,7 @@
 approximately $80\%$ of all candidate integers.  The constant \textbf{PRIME\_SIZE} is equal to the number of primes in the test base.  The
 array \_\_prime\_tab is an array of the first \textbf{PRIME\_SIZE} prime numbers.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6196,7 +6196,7 @@
 integers known as Carmichael numbers will be a pseudo-prime to all valid bases.  Fortunately such numbers are extremely rare as $n$ grows
 in size.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6228,7 +6228,7 @@
 value must be equal to $-1$.  The squarings are stopped as soon as $-1$ is observed.  If the value of $1$ is observed first it means that
 some value not congruent to $\pm 1$ when squared equals one which cannot occur if $n$ is prime.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
--- a/tommath.tex
+++ b/tommath.tex
@@ -175,7 +175,7 @@
 typical RSA modulus would be at least greater than $10^{309}$.  However, modern programming languages such as ISO C \cite{ISOC} and
 Java \cite{JAVA} only provide instrinsic support for integers which are relatively small and single precision.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{center}
 \begin{tabular}{|r|c|}
 \hline \textbf{Data Type} & \textbf{Range} \\
@@ -366,7 +366,7 @@
 exercises ranges from one (the easiest) to five (the hardest).  The following table sumarizes the
 scoring system used.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|c|l|}
@@ -534,7 +534,7 @@
 for new algorithms.  This methodology allows new algorithms to be tested in a complete framework with relative ease.
 
 \begin{center}
-\begin{figure}[here]
+\begin{figure}[h]
 \includegraphics{pics/design_process.ps}
 \caption{Design Flow of the First Few Original LibTomMath Functions.}
 \label{pic:design_process}
@@ -579,7 +579,7 @@
 used within LibTomMath.
 
 \index{mp\_int}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 %\begin{verbatim}
@@ -676,7 +676,7 @@
 \textbf{int} data type with one of the following values (fig \ref{fig:errcodes}).
 
 \index{MP\_OKAY} \index{MP\_VAL} \index{MP\_MEM}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|l|l|}
 \hline \textbf{Value} & \textbf{Meaning} \\
@@ -725,7 +725,7 @@
 structure are set to valid values.  The mp\_init algorithm will perform such an action.
 
 \index{mp\_init}
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_init}. \\
@@ -831,7 +831,7 @@
 When an mp\_int is no longer required by the application, the memory that has been allocated for its digits must be
 returned to the application's memory pool with the mp\_clear algorithm.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_clear}. \\
@@ -925,7 +925,7 @@
 is large enough to simply increase the \textbf{used} digit count.  However, when the size of the array is too small it
 must be re-sized appropriately to accomodate the result.  The mp\_grow algorithm will provide this functionality.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_grow}. \\
@@ -1022,7 +1022,7 @@
 of input mp\_ints to a given algorithm.  The purpose of algorithm mp\_init\_size is similar to mp\_init except that it
 will allocate \textit{at least} a specified number of digits.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -1108,7 +1108,7 @@
 The purpose of algorithm mp\_init\_multi is to initialize a variable length array of mp\_int structures in a single
 statement.  It is essentially a shortcut to multiple initializations.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_init\_multi}. \\
@@ -1212,7 +1212,7 @@
 positive number which means that if the \textbf{used} count is decremented to zero, the sign must be set to
 \textbf{MP\_ZPOS}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_clamp}. \\
@@ -1310,7 +1310,7 @@
 a copy for the purposes of this text.  The copy of the mp\_int will be a separate entity that represents the same
 value as the mp\_int it was copied from.  The mp\_copy algorithm provides this functionality.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_copy}. \\
@@ -1479,7 +1479,7 @@
 useful within functions that need to modify an argument but do not wish to actually modify the original copy.  The
 mp\_init\_copy algorithm has been designed to help perform this task.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_init\_copy}. \\
@@ -1527,7 +1527,7 @@
 Reseting an mp\_int to the default state is a common step in many algorithms.  The mp\_zero algorithm will be the algorithm used to
 perform this task.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_zero}. \\
@@ -1579,7 +1579,7 @@
 With the mp\_int representation of an integer, calculating the absolute value is trivial.  The mp\_abs algorithm will compute
 the absolute value of an mp\_int.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_abs}. \\
@@ -1640,7 +1640,7 @@
 With the mp\_int representation of an integer, calculating the negation is also trivial.  The mp\_neg algorithm will compute
 the negative of an mp\_int input.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_neg}. \\
@@ -1703,7 +1703,7 @@
 \subsection{Setting Small Constants}
 Often a mp\_int must be set to a relatively small value such as $1$ or $2$.  For these cases the mp\_set algorithm is useful.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_set}. \\
@@ -1759,7 +1759,7 @@
 To overcome the limitations of the mp\_set algorithm the mp\_set\_int algorithm is ideal.  It accepts a ``long''
 data type as input and will always treat it as a 32-bit integer.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_set\_int}. \\
@@ -1843,7 +1843,7 @@
 
 To facilitate working with the results of the comparison functions three constants are required.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|r|l|}
 \hline \textbf{Constant} & \textbf{Meaning} \\
@@ -1856,7 +1856,7 @@
 \caption{Comparison Return Codes}
 \end{figure}
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_cmp\_mag}. \\
@@ -1938,7 +1938,7 @@
 Comparing with sign considerations is also fairly critical in several routines (\textit{division for example}).  Based on an unsigned magnitude
 comparison a trivial signed comparison algorithm can be written.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_cmp}. \\
@@ -2047,7 +2047,7 @@
 Historically that convention stems from the MPI library where ``s\_'' stood for static functions that were hidden from the developer entirely.
 
 \newpage
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{center}
 \begin{small}
 \begin{tabular}{l}
@@ -2244,7 +2244,7 @@
 For example, the default for LibTomMath is to use a ``unsigned long'' for the mp\_digit ``type'' while $\beta = 2^{28}$.  In ISO C an ``unsigned long''
 data type must be able to represent $0 \le x < 2^{32}$ meaning that in this case $\gamma \ge 32$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{center}
 \begin{small}
 \begin{tabular}{l}
@@ -2411,7 +2411,7 @@
 Recall from section 5.2 that an mp\_int represents an integer with an unsigned mantissa (\textit{the array of digits}) and a \textbf{sign}
 flag.  A high level addition is actually performed as a series of eight separate cases which can be optimized down to three unique cases.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_add}. \\
@@ -2440,7 +2440,7 @@
 either \cite{TAOCPV2} or \cite{HAC} since they both only provide unsigned operations.  The algorithm is fairly
 straightforward but restricted since subtraction can only produce positive results.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|}
@@ -2529,7 +2529,7 @@
 \subsection{High Level Subtraction}
 The high level signed subtraction algorithm is essentially the same as the high level signed addition algorithm.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{center}
 \begin{tabular}{l}
 \hline Algorithm \textbf{mp\_sub}. \\
@@ -2561,7 +2561,7 @@
 \cite{HAC}.  Also this algorithm is restricted by algorithm s\_mp\_sub.  Chart \ref{fig:SubChart} lists the eight possible inputs and
 the operations required.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|}
@@ -2651,7 +2651,7 @@
 In a binary system where the radix is a power of two multiplication by two not only arises often in other algorithms it is a fairly efficient
 operation to perform.  A single precision logical shift left is sufficient to multiply a single digit by two.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2775,7 +2775,7 @@
 \subsection{Division by Two}
 A division by two can just as easily be accomplished with a logical shift right as multiplication by two can be with a logical shift left.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2886,7 +2886,7 @@
 degree.  In this case $f(x) \cdot x = a_n x^{n+1} + a_{n-1} x^n + ... + a_0 x$.  From a scalar basis point of view multiplying by $x$ is equivalent to
 multiplying by the integer $\beta$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -2929,7 +2929,7 @@
 
 \newpage
 \begin{center}
-\begin{figure}[here]
+\begin{figure}[h]
 \includegraphics{pics/sliding_window.ps}
 \caption{Sliding Window Movement}
 \label{pic:sliding_window}
@@ -3001,7 +3001,7 @@
 
 Division by powers of $x$ is easily achieved by shifting the digits right and removing any that will end up to the right of the zero'th digit.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3115,7 +3115,7 @@
 
 \subsection{Multiplication by Power of Two}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3249,7 +3249,7 @@
 
 \subsection{Division by Power of Two}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3387,7 +3387,7 @@
 The last algorithm in the series of polynomial basis power of two algorithms is calculating the remainder of division by $2^b$.  This
 algorithm benefits from the fact that in twos complement arithmetic $a \mbox{ (mod }2^b\mbox{)}$ is the same as $a$ AND $2^b - 1$.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3541,7 +3541,7 @@
 include $\alpha$ which shall represent the number of bits in the type \textbf{mp\_word}.  This implies that $2^{\alpha} > 2 \cdot \beta^2$.  The
 constant $\delta = 2^{\alpha - 2lg(\beta)}$ will represent the maximal weight of any column in a product (\textit{see sub-section 5.2.2 for more information}).
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3600,7 +3600,7 @@
 For example, consider multiplying $576$ by $241$.  That is equivalent to computing $10^0(1)(576) + 10^1(4)(576) + 10^2(2)(576)$ which is best
 visualized in the following table.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|c|l|}
 \hline   &&          & 5 & 7 & 6 & \\
@@ -3753,7 +3753,7 @@
 Where $\vec x_n$ is the $n'th$ column of the output vector.  Consider the following example which computes the vector $\vec x$ for the multiplication
 of $576$ and $241$.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|c|c|c|c|c|}
@@ -3774,7 +3774,7 @@
 Now the columns must be fixed by propagating the carry upwards.  The resultant vector will have one extra dimension over the input vector which is
 congruent to adding a leading zero digit.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -3830,7 +3830,7 @@
 the smaller input may not have more than $256$ digits if the Comba method is to be used.  This is quite satisfactory for most applications since
 $256$ digits would allow for numbers in the range of $0 \le x < 2^{7168}$ which, is much larger than most public key cryptographic algorithms require.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4129,7 +4129,7 @@
 of this system of equations has made Karatsuba fairly popular.  In fact the cutoff point is often fairly low\footnote{With LibTomMath 0.18 it is 70 and 109 digits for the Intel P4 and AMD Athlon respectively.}
 making it an ideal algorithm to speed up certain public key cryptosystems such as RSA and Diffie-Hellman.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4387,7 +4387,7 @@
 the algorithm can be faster than a baseline multiplication.  However, the greater complexity of this algorithm places the cutoff point
 (\textbf{TOOM\_MUL\_CUTOFF}) where Toom-Cook becomes more efficient much higher than the Karatsuba cutoff point.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4424,7 +4424,7 @@
 \caption{Algorithm mp\_toom\_mul}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4768,7 +4768,7 @@
 Now that algorithms to handle multiplications of every useful dimensions have been developed, a rather simple finishing touch is required.  So far all
 of the multiplication algorithms have been unsigned multiplications which leaves only a signed multiplication algorithm to be established.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -4875,7 +4875,7 @@
 For any $n$-digit input, there are ${{\left (n^2 + n \right)}\over 2}$ possible unique single precision multiplications required compared to the $n^2$
 required for multiplication.  The following diagram gives an example of the operations required.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{tabular}{ccccc|c}
 &&1&2&3&\\
@@ -4903,7 +4903,7 @@
 The baseline squaring algorithm is meant to be a catch-all squaring algorithm.  It will handle any of the input sizes that the faster routines
 will not handle.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5052,7 +5052,7 @@
 mp\_word arrays.  One array will hold the squares and the other array will hold the double products.  With both arrays the doubling and
 carry propagation can be moved to a $O(n)$ work level outside the $O(n^2)$ level.  In this case, we have an even simpler solution in mind.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5242,7 +5242,7 @@
 The 100 digit halves will not be squared using Karatsuba, but instead using the faster Comba based squaring algorithm.  If Karatsuba multiplication
 were used instead, the 100 digit numbers would be squared with a slower Comba based multiplication.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5442,7 +5442,7 @@
 derive their own Toom-Cook squaring algorithm.
 
 \subsection{High Level Squaring}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5705,7 +5705,7 @@
 is considerably faster than the straightforward $3m^2$ method.
 
 \subsection{The Barrett Algorithm}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5865,7 +5865,7 @@
 In order to use algorithm mp\_reduce the value of $\mu$ must be calculated in advance.  Ideally this value should be computed once and stored for
 future use so that the Barrett algorithm can be used without delay.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5931,7 +5931,7 @@
 
 From these two simple facts the following simple algorithm can be derived.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -5957,7 +5957,7 @@
 final result of the Montgomery algorithm.  If $k > lg(n)$ and $0 \le x < n^2$ then the final result is limited to
 $0 \le r < \lfloor x/2^k \rfloor + n$.  As a result at most a single subtraction is required to get the residue desired.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|l|}
@@ -5987,7 +5987,7 @@
 and $k^2$ single precision additions.  At this rate the algorithm is most certainly slower than Barrett reduction and not terribly useful.
 Fortunately there exists an alternative representation of the algorithm.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6009,7 +6009,7 @@
 This algorithm is equivalent since $2^tn$ is a multiple of $n$ and the lower $k$ bits of $x$ are zero by step 2.  The number of single
 precision shifts has now been reduced from $2k^2$ to $k^2 + k$ which is only a small improvement.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{small}
 \begin{center}
 \begin{tabular}{|c|l|r|}
@@ -6042,7 +6042,7 @@
 Instead of computing the reduction on a bit-by-bit basis it is actually much faster to compute it on digit-by-digit basis.  Consider the
 previous algorithm re-written to compute the Montgomery reduction in this new fashion.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6100,7 +6100,7 @@
 The baseline Montgomery reduction algorithm will produce the residue for any size input.  It is designed to be a catch-all algororithm for
 Montgomery reductions.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6287,7 +6287,7 @@
 With this change in place the Montgomery reduction algorithm can be performed with a Comba style multiplication loop which substantially increases
 the speed of the algorithm.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6526,7 +6526,7 @@
 \subsection{Montgomery Setup}
 To calculate the variable $\rho$ a relatively simple algorithm will be required.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6627,7 +6627,7 @@
 The variable $n$ reduces modulo $n - k$ to $k$.  By putting $q = \lfloor x/n \rfloor$ and $r = x \mbox{ mod } n$
 into the equation the original congruence is reproduced, thus concluding the proof.  The following algorithm is based on this observation.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6740,7 +6740,7 @@
 of $x$ and $q$.  The resulting algorithm is very efficient and can lead to substantial improvements over Barrett and Montgomery reduction when modular
 exponentiations are performed.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6888,7 +6888,7 @@
 To setup the restricted Diminished Radix algorithm the value $k = \beta - n_0$ is required.  This algorithm is not really complicated but provided for
 completeness.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6928,7 +6928,7 @@
 Another algorithm which will be useful is the ability to detect a restricted Diminished Radix modulus.  An integer is said to be
 of restricted Diminished Radix form if all of the digits are equal to $\beta - 1$ except the trailing digit which may be any value.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -6990,7 +6990,7 @@
 In general the restricted Diminished Radix reduction algorithm is much faster since it has considerably lower overhead.  However, this new
 algorithm is much faster than either Montgomery or Barrett reduction when the moduli are of the appropriate form.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7081,7 +7081,7 @@
 \subsubsection{Unrestricted Setup}
 To setup this reduction algorithm the value of $k = 2^p - n$ is required.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7153,7 +7153,7 @@
 that there will be value of $k$ that when added to the modulus causes a carry in the first digit which propagates all the way to the most
 significant bit.  The resulting sum will be a power of two.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7293,7 +7293,7 @@
 While this current method is a considerable speed up there are further improvements to be made.  For example, the $a^{2^i}$ term does not need to
 be computed in an auxilary variable.  Consider the following equivalent algorithm.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7345,7 +7345,7 @@
 to be used when a small power of an input is required (\textit{e.g. $a^5$}).  It is faster than simply multiplying $b - 1$ times for all values of
 $b$ that are greater than three.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7465,7 +7465,7 @@
 computes the same exponentiation.  A group of $k$ bits from the exponent is called a \textit{window}.  That is it is a small window on only a
 portion of the entire exponent.  Consider the following modification to the basic left to right exponentiation algorithm.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7501,7 +7501,7 @@
 approach is to brute force search amongst the values $k = 2, 3, \ldots, 8$ for the lowest result.  Table~\ref{fig:OPTK} lists optimal values of $k$
 for various exponent sizes and compares the number of multiplication and squarings required against algorithm~\ref{fig:LTOR}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|c|c|c|c|c|c|}
@@ -7530,7 +7530,7 @@
 
 Table~\ref{fig:OPTK2} lists optimal values of $k$ for various exponent sizes and compares the work required against algorithm {\ref{fig:KARY}}.
 
-\begin{figure}[here]
+\begin{figure}[h]
 \begin{center}
 \begin{small}
 \begin{tabular}{|c|c|c|c|c|c|}
@@ -7552,7 +7552,7 @@
 \label{fig:OPTK2}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7603,7 +7603,7 @@
 value of $(1/a) \mbox{ mod }c$ is computed using the modular inverse (\textit{see \ref{sec;modinv}}).  If no inverse exists the algorithm
 terminates with an error.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7754,7 +7754,7 @@
 
 \subsection{Barrett Modular Exponentiation}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7804,7 +7804,7 @@
 \caption{Algorithm s\_mp\_exptmod}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -7896,7 +7896,7 @@
 the two cases of $mode = 1$ and $mode = 2$ respectively.
 
 \begin{center}
-\begin{figure}[here]
+\begin{figure}[h]
 \includegraphics{pics/expt_state.ps}
 \caption{Sliding Window State Diagram}
 \label{pic:expt_state}
@@ -8163,7 +8163,7 @@
 Calculating $b = 2^a$ can be performed much quicker than with any of the previous algorithms.  Recall that a logical shift left $m << k$ is
 equivalent to $m \cdot 2^k$.  By this logic when $m = 1$ a quick power of two can be achieved.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -8239,7 +8239,7 @@
 will be used.  Let $x$ represent the divisor and $y$ represent the dividend.  Let $q$ represent the integer quotient $\lfloor y / x \rfloor$ and
 let $r$ represent the remainder $r = y - x \lfloor y / x \rfloor$.  The following simple algorithm will be used to start the discussion.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -8335,7 +8335,7 @@
 At most the quotient approaches $2\beta$, however, in practice this will not occur since that would imply the previous quotient digit was too small.
 
 \subsection{Radix-$\beta$ Division with Remainder}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -8378,7 +8378,7 @@
 \caption{Algorithm mp\_div}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -8782,7 +8782,7 @@
 Both addition and subtraction are performed by ``cheating'' and using mp\_set followed by the higher level addition or subtraction
 algorithms.   As a result these algorithms are subtantially simpler with a slight cost in performance.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -8913,7 +8913,7 @@
 multiplication algorithm.  Essentially this algorithm is a modified version of algorithm s\_mp\_mul\_digs where one of the multiplicands
 only has one digit.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9020,7 +9020,7 @@
 Like the single digit multiplication algorithm, single digit division is also a fairly common algorithm used in radix conversion.  Since the
 divisor is only a single digit a specialized variant of the division algorithm can be used to compute the quotient.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9186,7 +9186,7 @@
 such as the real numbers.  As a result the root found can be above the true root by few and must be manually adjusted.  Ideally at the end of the
 algorithm the $n$'th root $b$ of an integer $a$ is desired such that $b^n \le a$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9255,7 +9255,7 @@
 factoring for example, can make use of random values as starting points to find factors of a composite integer.  In this case the algorithm presented
 is solely for simulations and not intended for cryptographic use.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9339,7 +9339,7 @@
 such that they are printable.  While outputting as base64 may not be too helpful for human operators it does allow communication via non binary
 mediums.
 
-\newpage\begin{figure}[here]
+\newpage\begin{figure}[h]
 \begin{center}
 \begin{tabular}{cc|cc|cc|cc}
 \hline \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} & \textbf{Value} & \textbf{Char} &  \textbf{Value} & \textbf{Char} \\
@@ -9367,7 +9367,7 @@
 \label{fig:ASC}
 \end{figure}
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9478,7 +9478,7 @@
 \subsection{Generating Radix-$n$ Output}
 Generating radix-$n$ output is fairly trivial with a division and remainder algorithm.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9608,7 +9608,7 @@
 The most common approach (cite) is to reduce one input modulo another.  That is if $a$ and $b$ are divisible by some integer $k$ and if $qa + r = b$ then
 $r$ is also divisible by $k$.  The reduction pattern follows $\left < a , b \right > \rightarrow \left < b, a \mbox{ mod } b \right >$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9634,7 +9634,7 @@
 greatest common divisors.  The faster approach is based on the observation that if $k$ divides both $a$ and $b$ it will also divide $a - b$.
 In particular, we would like $a - b$ to decrease in magnitude which implies that $b \ge a$.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9668,7 +9668,7 @@
 However, instead of factoring $b - a$ to find a suitable value of $p$ the powers of $p$ can be removed from $a$ and $b$ that are in common first.
 Then inside the loop whenever $b - a$ is divisible by some power of $p$ it can be safely removed.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9713,7 +9713,7 @@
 The algorithms presented so far cannot handle inputs which are zero or negative.  The following algorithm can handle all input cases properly
 and will produce the greatest common divisor.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -9891,7 +9891,7 @@
 Linear Feedback Shift Registers (LFSR) tend to use registers with periods which are co-prime (\textit{e.g. the greatest common divisor is one.}).
 Similarly in number theory if a composite $n$ has two prime factors $p$ and $q$ then maximal order of any unit of $\Z/n\Z$ will be $[ p - 1, q - 1] $.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -10060,7 +10060,7 @@
 factors of $p$ do not have to be known.  Furthermore, if $(a, p) = 1$ then the algorithm will terminate when the recursion requests the
 Jacobi symbol computation of $\left ( {1 \over a'} \right )$ which is simply $1$.
 
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -10268,7 +10268,7 @@
 equation.
 
 \subsection{General Case}
-\newpage\begin{figure}[!here]
+\newpage\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -10407,7 +10407,7 @@
 approximately $80\%$ of all candidate integers.  The constant \textbf{PRIME\_SIZE} is equal to the number of primes in the test base.  The
 array \_\_prime\_tab is an array of the first \textbf{PRIME\_SIZE} prime numbers.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -10536,7 +10536,7 @@
 integers known as Carmichael numbers will be a pseudo-prime to all valid bases.  Fortunately such numbers are extremely rare as $n$ grows
 in size.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}
@@ -10616,7 +10616,7 @@
 value must be equal to $-1$.  The squarings are stopped as soon as $-1$ is observed.  If the value of $1$ is observed first it means that
 some value not congruent to $\pm 1$ when squared equals one which cannot occur if $n$ is prime.
 
-\begin{figure}[!here]
+\begin{figure}[!h]
 \begin{small}
 \begin{center}
 \begin{tabular}{l}