# Conversion between Number Systems in Membrane Computing
## 3 Conversion between Decimal and Binary
### n-Bit m Decimal to Decimal
We assume that the value of \(\rm A_{s}\) is equal to \(h\) (\(0\leq h\leq m-1\)). According to the different values of \(\rm A_{s}\), it can be divided into the following situations:  
Case 1: When \(\rm A_{s}\) is '\(0\)', the rules in \(\rm R\) are executed as follows:  
1 Rule \(\rm r_{m+1}\) and \(\rm r_{2m+1}\) in \(\rm R_{2}\) will be applied. Rule \(\rm r_{m+1}\) will generate \(1\) object \(p\) and \(m^{n-1}\) objects \(x\) and \(c\), meanwhile, \(1\) object \(t\) will enter membrane \(2\) to membrane \(m-1\). Rule \(\rm r_{2m+1}\) consume \(m^{s-2}\) objects \(e\) and produce \(m^{s-2}\) objects \(v\), \(m^{s-2}\) objects \(u\) enters membrane \(2\), \(3\), \(\ldots\), \(m-1\) at the same time. 2 Rules \(\rm r_{2m+2}\), \(\rm r_{2m+4}\), \(\rm r_{2m+5}\) in \(\rm R_{3}\) and \(\rm r_{2m+14}\) in \(\rm R_{6}\), execute in parallel. This operation does not produce object \(r\), so \(|\,r\,|\) remains unchanged. Rule \(\rm r_{2m+14}\) eliminates object t, dissolves the membrane, and releases all objects \(u\) inside the membrane to membrane \(1\). Rule \(\rm r_{2m+4}\) and \(\rm r_{2m+5}\) convert all objects \(x\) and \(p\) in the system to the same number of objects \(y\) and \(q\) respectively. 3 Rules \(\rm r_{2m+6}\), \(\rm r_{2m+7}\) and \(\rm r_{2m+9}\) in \(\rm R_{4}\) and \(\rm r_{2m+15}\) in \(\rm R_{7}\) will be executed in this step. Rule \(\rm r_{2m+6}\) 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 \(\rm m^{s-1}\) objects \(e\) in the system after \(\rm r_{2m+6}\) is applied. Rule \(\rm r_{2m+7}\) eliminate all objects \(c\) and \(y\) in the system. Rule \(\rm r_{2m+9}\) consumes object \(q\) to generate object \(b\) in preparation for converting the next binary input. Rule \(\rm r_{2m+15}\) eliminates all objects \(u\) in \(\rm\Pi_{m\_10}\). Case 2: When \(\rm A_{s}\) is '\(1\)', the execution process is as follows:  
1 Rules \(\rm r_{m+2}\) and \(\rm r_{2m+1}\) in \(\rm R_{2}\) will be execute. Rule \(\rm r_{m+2}\) generate \(1\) object \(pmn^{n-1}\) objects \(x\) and \(d\) in membrane \(1\), meanwhile generate \(1\) object and enters membrane \(2\), \(3\), \(\ldots\), \(m-1\). The execution of \(\rm r_{2m+1}\) is the same as 1 in Case 1. 2 Rules \(\rm r_{2m+3}\), \(\rm r_{2m+4}\) and \(\rm r_{2m+5}\) in \(\rm R_{3}\) and \(\rm r_{2m+14}\) in \(\rm R_{6}\) are applied. The system will generate \(\rm m^{s-1}\) objects \(r\); therefore, \(|\,r\,|=|\,r\,|\,+m^{s-1}\) after \(\rm r_{2m+3}\) executes. Rules \(\rm r_{2m+4}\), \(\rm r_{2m+5}\) and \(\rm r_{2m+14}\) is executed exactly like 2 in Case 1. Figure 5: P system for n-bit m deciaml to decimal. 3. Rules \(\tau_{2m+6}\), \(r_{2m+8}\) and \(r_{2m+9}\) in R\({}_{4}\) and \(r_{2m+15}\) in R\({}_{7}\) execute in parallel. Rule r\({}_{2m+8}\) eliminate all objects \(c\) and \(y\) in the system. The execution of r\({}_{2m+6}\), r\({}_{2m+9}\) and r\({}_{2m+15}\) is specified in 3. of Case 1. Case 3: When A\({}_{\rm s}\) is 'h' and \(2\leq{\rm h}\leq{\rm m}-1\), the execution process is as follows:  
1. Rules r\({}_{\rm h+m+1}\) and r\({}_{2m+1}\) in R\({}_{2}\) are applied in this step. The system will generate 1 object \(p\), \(m^{n-1}\) objects \(x\) and \(d\) in membrane 1, meanwhile 1 object \(p\),\(m^{n-1}\) objects \(x\) and \(d\) enters membrane 2, 3, \(\ldots\), \(h\) after r\({}_{\rm h+m+1}\) execute. The execution of r\({}_{2m+1}\) is the same as 1 in Case 1. Rule r\({}_{2m+1}\) consume \(m^{s-2}\) objects \(e\) and produce \(m^{s-2}\) objects \(v\), \(m^{s-2}\) objects \(u\) enters membrane 2, 3, \(\ldots\), \(m-1\) at the same time. 2. Rules r\({}_{2m+3}\), r\({}_{2m+4}\) and r\({}_{2m+5}\) in R\({}_{3}\) and r\({}_{2m+10}\), r\({}_{2m+11}\) and r\({}_{2m+12}\) in R\({}_{5}\) will be executed in parallel (only R\({}_{5}\) from membrane 2 to membrane \(h\) can be executed).