|
1 # This Source Code Form is subject to the terms of the Mozilla Public |
|
2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 |
|
5 =head1 NAME |
|
6 |
|
7 basecvt - radix conversion for arbitrary precision integers |
|
8 |
|
9 =head1 SYNOPSIS |
|
10 |
|
11 basecvt <ibase> <obase> [values] |
|
12 |
|
13 =head1 DESCRIPTION |
|
14 |
|
15 The B<basecvt> program is a command-line tool for converting integers |
|
16 of arbitrary precision from one radix to another. The current version |
|
17 supports radix values from 2 (binary) to 64, inclusive. The first two |
|
18 command line arguments specify the input and output radix, in base 10. |
|
19 Any further arguments are taken to be integers notated in the input |
|
20 radix, and these are converted to the output radix. The output is |
|
21 written, one integer per line, to standard output. |
|
22 |
|
23 When reading integers, only digits considered "valid" for the input |
|
24 radix are considered. Processing of an integer terminates when an |
|
25 invalid input digit is encountered. So, for example, if you set the |
|
26 input radix to 10 and enter '10ACF', B<basecvt> would assume that you |
|
27 had entered '10' and ignore the rest of the string. |
|
28 |
|
29 If no values are provided, no output is written, but the program |
|
30 simply terminates with a zero exit status. Error diagnostics are |
|
31 written to standard error in the event of out-of-range radix |
|
32 specifications. Regardless of the actual values of the input and |
|
33 output radix, the radix arguments are taken to be in base 10 (decimal) |
|
34 notation. |
|
35 |
|
36 =head1 DIGITS |
|
37 |
|
38 For radices from 2-10, standard ASCII decimal digits 0-9 are used for |
|
39 both input and output. For radices from 11-36, the ASCII letters A-Z |
|
40 are also included, following the convention used in hexadecimal. In |
|
41 this range, input is accepted in either upper or lower case, although |
|
42 on output only lower-case letters are used. |
|
43 |
|
44 For radices from 37-62, the output includes both upper- and lower-case |
|
45 ASCII letters, and case matters. In this range, case is distinguished |
|
46 both for input and for output values. |
|
47 |
|
48 For radices 63 and 64, the characters '+' (plus) and '/' (forward |
|
49 solidus) are also used. These are derived from the MIME base64 |
|
50 encoding scheme. The overall encoding is not the same as base64, |
|
51 because the ASCII digits are used for the bottom of the range, and the |
|
52 letters are shifted upward; however, the output will consist of the |
|
53 same character set. |
|
54 |
|
55 This input and output behaviour is inherited from the MPI library used |
|
56 by B<basecvt>, and so is not configurable at runtime. |
|
57 |
|
58 =head1 SEE ALSO |
|
59 |
|
60 dec2hex(1), hex2dec(1) |
|
61 |
|
62 =head1 AUTHOR |
|
63 |
|
64 Michael J. Fromberger <sting@linguist.dartmouth.edu> |
|
65 Thayer School of Engineering, Hanover, New Hampshire, USA |