1Math::Base::Convert::CaUlscePrP(C3o)ntributed Perl DocumMeanttha:t:iBoanse::Convert::CalcPP(3)
2
3
4
6 Math::Base::Convert::CalcPP - standard methods used by
7 Math::Base::Convert
8
10 This module contains the standard methods used by Math::Base::Convert
11 to convert from one base number to another base number.
12
13 • $carry = addbaseno($reg32ptr,$int)
14
15 This function adds an integer < 65536 to a long n*32 bit register
16 and returns the carry.
17
18 • multiply($reg32ptr,$int)
19
20 This function multiplies a long n*32 bit register by an integer <
21 65536
22
23 • ($qptr,$remainder) = dividebybase($reg32ptr,$int)
24
25 this function divides a long n*32 bit register by an integer <
26 65536 and returns a pointer to a long n*32 bit quotient and an
27 integer remainder.
28
29 • $bc->useFROMbaseto32wide
30
31 This method converts FROM an input base string to a long n*32 bit
32 register using an algorithim like:
33
34 $longnum = 0;
35 for $char ( $in_str =~ /./g ) {
36 $longnum *= $base;
37 $longnum += $value{$char)
38 }
39 return $number;
40
41 • $output = $bc->use32wideTObase
42
43 This method converts a long n*32 bit register TO a base number
44 using an algorithim like:
45
46 $output = '';
47 while( $longnum > 0 ) {
48 $output = ( $longnum % $base ) . $output;
49 $num = int( $longnum / $base );
50 }
51 return $output;
52
54 Michael Robinton, michael@bizsystems.com
55
57 Copyright 2012-15, Michael Robinton
58
59 This program is free software; you may redistribute it and/or modify it
60 under the same terms as Perl itself.
61
62 This program is distributed in the hope that it will be useful, but
63 WITHOUT ANY WARRANTY; without even the implied warranty of
64 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
65
66
67
68perl v5.32.1 2021-01-27 Math::Base::Convert::CalcPP(3)