For example, when calculating 2*3, the computer will first convert it into binary for calculation. If it is a different encoding form, does it correspond to a different binary?
Reply content:Yes, different encodings will have different methods of recording data, and of course they will also be similar.
Encoding mainly targets strings. Digital storage is also divided into big and small endian order, which are all manifestations of different binary data recording rules.
First of all, what you are talking about should be "2*3" in the source code. The character encoding of the source code files can be different, and their binary representations are also different. Then you mentioned "calculation", which must first be compiled to generate target code before it can be executed (whether it is interpreted or executed by cpu instructions). If you generate machine code, then on the same machine, the format of digital storage it's the same. If it is the bytecode generated by a virtual machine, the number format is the same as the encoding of the bytecode.
You must first figure out the type of data. Your calculation of 2*3 is a calculation of two integers, which is 10*11 (binary). There is no encoding. If you put it on different architectures, it just means that the length of the integers is different.
The encoding you mentioned is for characters. For example, the ASCII of 2 and 3 are 0110010 and 0110011 respectively. This is not used for calculation.
Yes, you can use any encoding and store it however you want.
But the calculation results must be the same.