Post Reply 
How to change bases?
04-08-2019, 01:36 AM
Post: #6
RE: How to change bases?
(04-08-2019 01:14 AM)Joe Horn Wrote:  Is this undocumented? Prime can convert any base-10 integer to any other base, and any number in any base to base 10. The only caveats are that you have to do it in CAS (not Home), you have to type the CONVERT command in lowercase letters, and you have to remember that the non-decimal base numbers are represented as arrays of integers in backwards order.

Examples in CAS:

convert(12345,base,6) --> [3,5,0,3,3,1]
... this means that 12345 in base 10 = "133053" in base 6

convert([3,5,0,3,3,1],base,6) --> 12345
... this means that "133053" in base 6 = 12345 in base 10
If you wish, you may use a list instead of an array here; both seem to work fine.

Since there is no upper limit for the base you specify, Prime does not use letters or other characters to stand for digit values above 9. It just gives you their decimal value, like this:

convert(1234,base,16) --> [2,13,4]
... this means that 1234 (base 10) = "4D2" in hex, with the "D" being shown as 13.

For me, Joe's comments, while undoubtedly correct, confirms my initial post, that Prime does not support other bases. Dodgy

Arrays of integers in backward order? Really? It's no wonder this isn't documented...

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How to change bases? - kevin3g - 04-07-2019, 02:45 PM
RE: How to change bases? - rprosperi - 04-07-2019, 03:31 PM
RE: How to change bases? - Aries - 04-07-2019, 03:50 PM
RE: How to change bases? - Don Shepherd - 04-08-2019, 12:44 AM
RE: How to change bases? - toml_12953 - 04-10-2019, 12:46 AM
RE: How to change bases? - Albert Chan - 04-27-2019, 06:52 PM
RE: How to change bases? - Joe Horn - 04-08-2019, 01:14 AM
RE: How to change bases? - rprosperi - 04-08-2019 01:36 AM
RE: How to change bases? - Joe Horn - 04-08-2019, 02:12 AM
RE: How to change bases? - John Keith - 04-08-2019, 01:11 PM
RE: How to change bases? - rprosperi - 04-08-2019, 07:39 PM
RE: How to change bases? - parisse - 04-08-2019, 09:29 AM
RE: How to change bases? - Joe Horn - 11-29-2019, 06:34 PM
RE: How to change bases? - toml_12953 - 11-30-2019, 04:48 AM
RE: How to change bases? - Joe Horn - 11-30-2019, 01:01 PM
RE: How to change bases? - rprosperi - 11-30-2019, 02:41 PM
RE: How to change bases? - toml_12953 - 11-30-2019, 03:16 PM
RE: How to change bases? - Steve Simpkin - 11-30-2019, 06:26 PM
RE: How to change bases? - Joe Horn - 11-30-2019, 07:21 PM
RE: How to change bases? - toml_12953 - 11-30-2019, 08:34 PM
RE: How to change bases? - Didier Lachieze - 12-01-2019, 08:43 AM
RE: How to change bases? - rprosperi - 12-01-2019, 02:42 PM
RE: How to change bases? - Tim Wessman - 12-02-2019, 06:16 AM
RE: How to change bases? - YEDERF - 12-03-2019, 02:05 AM



User(s) browsing this thread: 6 Guest(s)