Decimal to Base B

Routine Summary

Converts a decimal (base 10) number to a number in any other integer base B.

Inputs

A - The decimal number that you want to convert.
B/ - The base you want to convert A into.

Outputs

Ans - The base B representation of the decimal number, in list form.

Variables Used

{\$variable}

Calculator Compatibility

TI-83/84/+/SE

Author

imcoraline

``````:iPart(ln(A)/ln(B
:BfPart(int(AB^(cumSum(binomcdf(Ans,0))-Ans-1))/B``````

This routine takes a positive whole decimal number (base 10), stored in A, and converts it to the equivalent representation in base B. The representation will be in list form. For example, the decimal number 32 is the base 2 number 100000, meaning the routine would result in the list {1,0,0,0,0,0}.

Note: This routine will not work for A<B.

It also may be important to note that adding 0’s to the front of a number will not change the decimal equivalent. For example, both 01101012 and 1101012 are equivalent to 5310.

Error Conditions

• ERR:DATATYPE is thrown if A is complex or negative.
• ERR:DOMAIN is thrown if A is 0 or less than B.
• An error will not be thrown is A isn’t an integer. Nonetheless, the conversion will not work correctly.

.