TI-BASIC:Number Subset
Routine Summary
Returns a subset of a number.
Inputs
A - the number to get the subset from B - the starting position of the subset C - the length of the subset
Outputs
Ans - the subset of the number
Variables Used
A, B, C, Ans
Calculator Compatibility
TI-83/84/+/SE Author
WeregooseAuthors
@@URL: United TI Download
:10^(2-B+int(log(A :int((A-int(A/Ans)Ans)/Ans10^(C
With our number stored in A, and the staring position and length of the subset stored in B and C respectively, we get the subset of the number by first subtracting the number divided by 10 to the power of 2-B+int(log(A (which is used to get how many digits are in the number), and then dividing that result by multiplying 10 to the power of 2-B+int(log(A and 10 to the power of C (which is the length of the subset).
A simple example should help you understand this routine. Say you input the number 123, with a starting position of 2 and a length of 2, it will return a result of 23. You can also use negative and decimal numbers with the routine, and it will still work correctly: a number of 13579.02468 with a starting position of 4 and length 4 will return 7902.
This routine is comparable to the Sub( command that works with Strings.