Base Conversions (to any base 2-36)
|
12-28-2019, 06:27 PM
Post: #1
|
|||
|
|||
Base Conversions (to any base 2-36)
Blog Link: http://edspi31415.blogspot.com/2019/12/h...sions.html
Introduction The program BASEDEC converts a number in a base representation to decimal (base 10). BASEDEC accepts any positive number, including non-integers up to base 36. Each of the letters of alphabet represents a value: A = 10 B = 11 C = 12 D = 13 E = 14 F = 15 ... Z = 35 BASEDEC takes two arguments: number to be converted, entered as a string; and the base representation of the number. Examples: BASEDEC("531",8) converts 531_8 to decimal. Result: 345 BASEDEC("63.95A", 11) converts 63.95A_11 to decimal. Result: 69.86701728 BASEDEC("4H", 18) converts 4H_18 to decimal. Result: 89 (H = 17) HP Prime Program BASEDEC Code:
Introduction Part II The program DECBASE converts a number in decimal form to any base you want. DECBASE works will all positive real numbers. There are three arguments to DECBASE: * The number in decimal form * The desired base * Accuracy: how many decimal points do you want. Conversions from decimal to other bases are approximations. If the number is a integer (frac(number) = 0), then this argument is ignored (put 0). The result is returned as a string. Examples: DECBASE(69, 6, 0) converts 69 to base 6. Result: "153" DECBASE(5.875, 8, 4) converts 5.875 to base 8 to four decimals. Result: "5.7000" (exact: 5.7_8) DECBASE(635.05, 12, 12) converts 635.05 to base 12 to twelve decimals. Result: "44B.072497249724" (exact: 44B.07249..._12 (7249 repeats)) HP Prime Program DECBASE Code:
|
|||
12-29-2019, 04:48 PM
Post: #2
|
|||
|
|||
RE: Base Conversions (to any base 2-36)
Nice programs!
if I run the program using Shift Program and use the fill form all is well, but if I run from home screen as BASEDEC("531",8) I get Code: 0+when(al>64,al-55,EXPR(sd))*324+when(al>64,al-55,EXPR(sd))*18+when(al>64,al-55,EXPR(sd))*1 This is on android 2.1.14346 (2019 11 21) Wonder why the when() statements not being evaluated? |
|||
12-30-2019, 04:26 PM
Post: #3
|
|||
|
|||
RE: Base Conversions (to any base 2-36)
That's a strange result. Possibly a bug?
Thank you for the compliment! |
|||
01-01-2020, 05:42 AM
Post: #4
|
|||
|
|||
RE: Base Conversions (to any base 2-36)
Happy 2PI! (in base 26)
<0|ΙΈ|0> -Joe- |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)