0
|
1 <html>
|
|
2 <head>
|
|
3 <title>MayaChemTools:Documentation:ConversionsUtil.pm</title>
|
|
4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
|
|
5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css">
|
|
6 </head>
|
|
7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10">
|
|
8 <br/>
|
|
9 <center>
|
|
10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a>
|
|
11 </center>
|
|
12 <br/>
|
|
13 <div class="DocNav">
|
|
14 <table width="100%" border=0 cellpadding=0 cellspacing=2>
|
|
15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./Constants.html" title="Constants.html">Previous</a> <a href="./index.html" title="Table of Contents">TOC</a> <a href="./DBUtil.html" title="DBUtil.html">Next</a></td><td width="34%" align="middle"><strong>ConversionsUtil.pm</strong></td><td width="33%" align="right"><a href="././code/ConversionsUtil.html" title="View source code">Code</a> | <a href="./../pdf/ConversionsUtil.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/ConversionsUtil.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/ConversionsUtil.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/ConversionsUtil.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr>
|
|
16 </table>
|
|
17 </div>
|
|
18 <p>
|
|
19 </p>
|
|
20 <h2>NAME</h2>
|
|
21 <p>ConversionsUtil</p>
|
|
22 <p>
|
|
23 </p>
|
|
24 <h2>SYNOPSIS</h2>
|
|
25 <p>use ConversionsUtil;</p>
|
|
26 <p>use ConversionsUtil qw(:math);</p>
|
|
27 <p>use ConversionsUtil qw(:all);</p>
|
|
28 <p>
|
|
29 </p>
|
|
30 <h2>DESCRIPTION</h2>
|
|
31 <p><strong>ConversionsUtil</strong> module provides the following functions:</p>
|
|
32 <p> <a href="#binarytodecimal">BinaryToDecimal</a>, <a href="#binarytohexadecimal">BinaryToHexadecimal</a>, <a href="#decimaltobinary">DecimalToBinary</a>, <a href="#decimaltohexadecimal">DecimalToHexadecimal</a>
|
|
33 , <a href="#decimaltooctal">DecimalToOctal</a>, <a href="#degreestoradians">DegreesToRadians</a>, <a href="#hexadecimaltobinary">HexadecimalToBinary</a>, <a href="#hexadecimaltodecimal">HexadecimalToDecimal</a>
|
|
34 , <a href="#hexadecimaltooctal">HexadecimalToOctal</a>, <a href="#octaltodecimal">OctalToDecimal</a>, <a href="#octaltohexadecimal">OctalToHexadecimal</a>, <a href="#radianstodegrees">RadiansToDegrees</a>
|
|
35 , <a href="#stringtobinary">StringToBinary</a>, <a href="#stringtohexadecimal">StringToHexadecimal</a>
|
|
36 </p><p>
|
|
37 </p>
|
|
38 <h2>FUNCTIONS</h2>
|
|
39 <dl>
|
|
40 <dt><strong><a name="binarytodecimal" class="item"><strong>BinaryToDecimal</strong></a></strong></dt>
|
|
41 <dd>
|
|
42 <div class="OptionsBox">
|
|
43 $Decimal = BinaryToDecimal($Binary);</div>
|
|
44 <p>Converts a <em>Binary</em> string to <strong>Decimal</strong> string.</p>
|
|
45 </dd>
|
|
46 <dt><strong><a name="binarytohexadecimal" class="item"><strong>BinaryToHexadecimal</strong></a></strong></dt>
|
|
47 <dd>
|
|
48 <div class="OptionsBox">
|
|
49 $Hexadecimal = BinaryToHexadecimal($Binary);</div>
|
|
50 <p>Converts a <em>Binary</em> string to <strong>Hexadecimal</strong> string.</p>
|
|
51 </dd>
|
|
52 <dt><strong><a name="decimaltobinary" class="item"><strong>DecimalToBinary</strong></a></strong></dt>
|
|
53 <dd>
|
|
54 <div class="OptionsBox">
|
|
55 $Binary = DecimalToBinary($Decimal);</div>
|
|
56 <p>Converts a <em>Decimal</em> string to <strong>Binary</strong> string.</p>
|
|
57 </dd>
|
|
58 <dt><strong><a name="decimaltohexadecimal" class="item"><strong>DecimalToHexadecimal</strong></a></strong></dt>
|
|
59 <dd>
|
|
60 <div class="OptionsBox">
|
|
61 $Hexadecimal = DecimalToHexadecimal($Decimal);</div>
|
|
62 <p>Converts a <em>Decimal</em> string to <strong>Hexadecimal</strong> string.</p>
|
|
63 </dd>
|
|
64 <dt><strong><a name="decimaltooctal" class="item"><strong>DecimalToOctal</strong></a></strong></dt>
|
|
65 <dd>
|
|
66 <div class="OptionsBox">
|
|
67 $Octal = DecimalToOctal($Decimal);</div>
|
|
68 <p>Converts a <em>Decimal</em> string to <strong>Octal</strong> string.</p>
|
|
69 </dd>
|
|
70 <dt><strong><a name="degreestoradians" class="item"><strong>DegreesToRadians</strong></a></strong></dt>
|
|
71 <dd>
|
|
72 <div class="OptionsBox">
|
|
73 $Radians = DegreesToRadians($Degrees, [$DoNotWrapValue]);</div>
|
|
74 <p>Converts degrees to radians in the range from 0 to 2PI or to corresponding radians without
|
|
75 wrapping the converted value to 0 to 2PI. Default is to wrap the converted value.</p>
|
|
76 </dd>
|
|
77 <dt><strong><a name="hexadecimaltobinary" class="item"><strong>HexadecimalToBinary</strong></a></strong></dt>
|
|
78 <dd>
|
|
79 <div class="OptionsBox">
|
|
80 $Binary = HexadecimalToBinary($Hexadecimal);</div>
|
|
81 <p>Converts a <em>Hexadecimal</em> string to <strong>Binary</strong> string.</p>
|
|
82 </dd>
|
|
83 <dt><strong><a name="hexadecimaltodecimal" class="item"><strong>HexadecimalToDecimal</strong></a></strong></dt>
|
|
84 <dd>
|
|
85 <div class="OptionsBox">
|
|
86 $Decimal = HexadecimalToDecimal($Hexadecimal);</div>
|
|
87 <p>Converts a <em>Hexadecimal</em> string to <strong>Decimal</strong> string.</p>
|
|
88 </dd>
|
|
89 <dt><strong><a name="hexadecimaltooctal" class="item"><strong>HexadecimalToOctal</strong></a></strong></dt>
|
|
90 <dd>
|
|
91 <div class="OptionsBox">
|
|
92 $Octal = HexadecimalToOctal($Hexadecimal);</div>
|
|
93 <p>Converts a <em>Hexadecimal</em> string to <strong>Octal</strong> string.</p>
|
|
94 </dd>
|
|
95 <dt><strong><a name="octaltodecimal" class="item"><strong>OctalToDecimal</strong></a></strong></dt>
|
|
96 <dd>
|
|
97 <div class="OptionsBox">
|
|
98 $Decimal = OctalToDecimal($Octal);</div>
|
|
99 <p>Converts a <em>Octal</em> string to <strong>Decimal</strong> string.</p>
|
|
100 </dd>
|
|
101 <dt><strong><a name="octaltohexadecimal" class="item"><strong>OctalToHexadecimal</strong></a></strong></dt>
|
|
102 <dd>
|
|
103 <div class="OptionsBox">
|
|
104 $Hexadecimal = OctalToHexadecimal($Octal);</div>
|
|
105 <p>Converts a <em>Octal</em> string to <strong>Hexadecimal</strong> string.</p>
|
|
106 </dd>
|
|
107 <dt><strong><a name="radianstodegrees" class="item"><strong>RadiansToDegrees</strong></a></strong></dt>
|
|
108 <dd>
|
|
109 <div class="OptionsBox">
|
|
110 $Degrees = RadiansToDegrees($Radians, [$DoNotWrapValue]);</div>
|
|
111 <p>Converts radians to degrees in the range from 0 to 360 or to corresponding degrees without
|
|
112 wrapping the converted value to 0 to 360. Default is to wrap the converted value.</p>
|
|
113 </dd>
|
|
114 <dt><strong><a name="stringtobinary" class="item"><strong>StringToBinary</strong></a></strong></dt>
|
|
115 <dd>
|
|
116 <div class="OptionsBox">
|
|
117 $BinaryString = StringToBinary($String, [$UseReverseBitOrder]);</div>
|
|
118 <p>Converts specified <em>String</em> into a <strong>Binarystring</strong>. Going from left to right, two ways of arranging
|
|
119 bits inside each byte are available: Most Significat Bits (MSB) first or Least Significat Bits (LSB) first.
|
|
120 Default is MSB corresponding to descending bits order (PerlSpeak) inside each each packed byte
|
|
121 (Most singificat bits first).</p>
|
|
122 </dd>
|
|
123 <dt><strong><a name="stringtohexadecimal" class="item"><strong>StringToHexadecimal</strong></a></strong></dt>
|
|
124 <dd>
|
|
125 <div class="OptionsBox">
|
|
126 $HexadecimalString = StringToHexadecimal($String,
|
|
127 [$UseReverseBitOrder]);</div>
|
|
128 <p>Convert string into a hexadecimal string. Two ways of arranging nybbles (pair of 4 bits in each
|
|
129 byte) are available: high nybbles first or low nybbles first. Default is MSB corresponding to high
|
|
130 nybbles (PerlSpeak) first. Low and high nybbles correspond to pair of a low and high four bits in a byte.</p>
|
|
131 </dd>
|
|
132 </dl>
|
|
133 <p>
|
|
134 </p>
|
|
135 <h2>AUTHOR</h2>
|
|
136 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
|
|
137 <p>
|
|
138 </p>
|
|
139 <h2>SEE ALSO</h2>
|
|
140 <p><a href="./Constants.html">Constants.pm</a>, <a href="./MathUtil.html">MathUtil.pm</a>
|
|
141 </p>
|
|
142 <p>
|
|
143 </p>
|
|
144 <h2>COPYRIGHT</h2>
|
|
145 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
|
|
146 <p>This file is part of MayaChemTools.</p>
|
|
147 <p>MayaChemTools is free software; you can redistribute it and/or modify it under
|
|
148 the terms of the GNU Lesser General Public License as published by the Free
|
|
149 Software Foundation; either version 3 of the License, or (at your option)
|
|
150 any later version.</p>
|
|
151 <p> </p><p> </p><div class="DocNav">
|
|
152 <table width="100%" border=0 cellpadding=0 cellspacing=2>
|
|
153 <tr align="left" valign="top"><td width="33%" align="left"><a href="./Constants.html" title="Constants.html">Previous</a> <a href="./index.html" title="Table of Contents">TOC</a> <a href="./DBUtil.html" title="DBUtil.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>ConversionsUtil.pm</strong></td></tr>
|
|
154 </table>
|
|
155 </div>
|
|
156 <br />
|
|
157 <center>
|
|
158 <img src="../../images/h2o2.png">
|
|
159 </center>
|
|
160 </body>
|
|
161 </html>
|