# Conversion between Number Systems in Membrane Computing
## 3 Conversion between Decimal and Binary
### Binary to Decimal
Rule \(\rm r_{5}\) executes consuming objects \(c\) and to generate object \(c\) and twice the number of object \(z\). When executed to the \(\rm A_{s}\), there are \(2^{s-2}\) objects \(e\) in the system; it produces \(2^{s-1}\) objects \(z\) after \(\rm r_{5}\) is applied, keeping \(\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left| \left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\right| \right|\right|\right|\right|\right|\right|\right|\right|\right|\right|\right| \right|\right|\right|\right|\right|\right|\). Rule \(\rm r_{7}\) executes the consumption object \(x\) to generate the object \(y\). Rule \(\rm r_{8}\) executes, consuming object \(p\) to generate object \(q\). 3 Rules \(\rm r_{9}\), \(\rm r_{10}\), and \(\rm r_{12}\) are applied in this step. Rule \(\rm r_{10}\) executes, consuming all objects \(d\) and \(y\) without generating new ones. Rule \(\rm r_{9}\) executes, consuming all objects \(z\) and converting them into the same number of objects \(e\), representing the weight of the current bit. According to the results in 2, there are \(2^{s-1}\) objects \(e\) in the system after \(\rm r_{9}\) is applied. Rule \(\rm r_{12}\) consumes object \(q\) to generate object \(b\) in preparation for converting the next binary input. Case 2: \(\rm A_{s}\) is '1' The rules in R are executed as follows:  
1 Rule \(\rm r_{4}\) in \(\rm R_{2}\) executes the consumption object \(b\) to generate object \(p\), \(2^{n-1}\) objects \(x\) and object \(d\). 2 Rule \(\rm r_{6}\), \(\rm r_{7}\) and \(\rm r_{8}\) in \(\rm R_{3}\) are applied. Rule \(\rm r_{6}\) performs the process of consuming objects \(d\) and \(e\) to generate object \(d\) and double the number of objects \(z\) and \(r\). When executed to the \(\rm A_{s}\), there are \(2^{s-2}\) objects \(e\) in \(\rm\Pi_{2\_10}\). So after \(\rm r_{6}\) is applied, there are \(2^{s-1}\) objects \(z\) and \(r\) in the system, where \(\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left| \left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\left|\right| \right|\right|\right|\right|\right|\right|\right|\right|\right|\right|\right| \right|\right|\right|\right|\). Rule \(\rm r_{7}\) executes the consumption object \(x\) to generate the object \(y\). Rule \(\rm r_{8}\) executes, consuming object \(p\) to generate object \(q\). 3 Rules \(\rm r_{9}\), \(\rm r_{11}\), and \(\rm r_{12}\) in \(\rm R_{4}\) will execute at the same time. Rule \(\rm r_{11}\) causes the system to eliminate objects d and y when the next binary bit executes the first step. Rules \(\rm r_{9}\) and \(\rm r_{11}\). The execution process of rules \(\rm r_{9}\) and \(\rm r_{12}\) is the same as that of \(\rm r_{9}\) and \(\rm r_{12}\) mentioned in the 3 of Case 1, and it will not be repeated here  
The result after completing step 3 in Case 1 or Case 2 is \(be^{s-1}\) and \(be^{s-1}\) will be used as the initial input when the next binary bit performs an operation in \(\rm\Pi_{2\_10}\). In summary, after the input of the binary string \(\rm A_{m}A_{m-1}\ldots A_{1}\) ends, the number of objects \(r\) in the system is \(\rm A_{1}+A_{2}\)\({}^{*}2+\ldots+A_{m}\)\({}^{*}2^{m-1}\). Therefore, \(\rm\Pi_{2\_10}\) can correctly realize the conversion from a binary number to a decimal number. From the analysis of the rule set of \(\rm\Pi_{2\_10}\) and its execution process, it is clear that it takes \(\rm 3(n-1)+1\) time slice to convert n-bit binary numbers to decimal numbers. The \(n\) here represents the actual number of bits in the binary string.