information:highlighting, stylistic:tone
Base conversion

The conversion to a base b 2 {\displaystyle b_{2}} of an integer n represented in base b 1 {\displaystyle b_{1}} can be done by a succession of Euclidean divisions by b 2: {\displaystyle b_{2}:} the right-most digit in base b 2 {\displaystyle b_{2}} is the remainder of the division of n by b 2; {\displaystyle b_{2};} the second right-most digit is the remainder of the division of the quotient by b 2, {\displaystyle b_{2},} and so on. The left-most digit is the last quotient. In general, the k th digit from the right is the remainder of the division by b 2 {\displaystyle b_{2}} of the (k −1) th quotient.

For example: converting A10B to decimal (41227):

When converting to a larger base (such as from binary to decimal), the remainder represents b 2 {\displaystyle b_{2}} as a single digit, using digits from b 1 {\displaystyle b_{1}}. For example: converting 0b11111001 (binary) to 249 (decimal):

For the fractional part, conversion can be done by taking digits after the radix point (the numerator), and dividing it by the implied denominator in the target radix. Approximation may be needed due to a possibility of non-terminating digits if the reduced fraction's denominator has a prime factor other than any of the base's prime factor(s) to convert to. For example, 0.1 in decimal (1/10) is 0b1/0b1010 in binary, by dividing this in that radix, the result is 0b0.0 0011 (because one of the prime factors of 10 is 5). For more general fractions and bases see the algorithm for positive bases.

Alternatively, Horner's method can be used for base conversion using repeated multiplications, with the same computational complexity as repeated divisions. A number in positional notation can be thought of as a polynomial, where each digit is a coefficient. Coefficients can be larger than one digit, so an efficient way to convert bases is to convert each digit, then evaluate the polynomial via Horner's method within the target base. Converting each digit is a simple lookup table, removing the need for expensive division or modulus operations; and multiplication by x becomes right-shifting. However, other polynomial evaluation algorithms would work as well, like repeated squaring for single or sparse digits. Example: