How to change bases?
|
04-10-2019, 12:46 AM
(This post was last modified: 04-10-2019 12:47 AM by toml_12953.)
Post: #11
|
|||
|
|||
RE: How to change bases?
(04-08-2019 12:44 AM)Don Shepherd Wrote:(04-07-2019 02:45 PM)kevin3g Wrote: Say I have a number in base 3 and want to convert it to base 6 or any base conversion. How would I do this?There may be a better way, but whenever I have written a base conversion program to convert from one base to another, if neither base is 10, I first convert the number to base 10, then to the other base. To convert 45 base 8 to base 16 you could nest converts like this: convert(convert([5 4],base,8),base,16) which would put out [5 2] since 25 is the hex equivalent of 45 octal. I know the Prime has these bases built-in but the power of this method is that you can use any bases, not just 8 and 16. Tom L Cui bono? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)