A program to toggle between prefixes
|
04-23-2016, 09:09 PM
Post: #1
|
|||
|
|||
A program to toggle between prefixes
hi everybody,
I need an easy way to toggle between prefixes (a,f,p,n,µ,m ... k,M,G,T,P,E) and write them after a number. For example: I have 0.135 and I would like to toggle: 135 m, 135000 µ, 135000000 n ... or I have 135000 and I would like to toggle 135 k, 0.135 M, 0.000135 G and so on... This purpose having or not having regard to the unit of measure (i.e. V, F, ohm...), like in some Casio calculator (with the ←ENG and ENG→ buttons)... I mean to toggle back and forward from any number in a simple way (like with user keystrokes or other way with *very few* keystroke pressing)... Any idea? Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
04-23-2016, 09:49 PM
(This post was last modified: 04-23-2016 10:02 PM by StephenG1CMZ.)
Post: #2
|
|||
|
|||
RE: A program to toggle between prefixes
That sounds like it would be very useful to have.
Perhaps some of the code in my Z UNITS program will inspire someone to find a good solution. That program supports prefixes, but as it stands it's not what you want: 1 - it is a standalone program (so you'd need to retype your number) 2 -- it is unit specific. So, as it stands, the program should let you convert, say, 3*MEGA V to V (with my program recognising MEGA as a numerical value) ..but will only do the reverse 3 V to MV If MV is a calculator-supported unit conversion. But perhaps there is something in there that will help towards a better solution. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
04-23-2016, 09:52 PM
(This post was last modified: 04-23-2016 09:56 PM by salvomic.)
Post: #3
|
|||
|
|||
RE: A program to toggle between prefixes
(04-23-2016 09:49 PM)StephenG1CMZ Wrote: That sounds like it would be very useful to have. Hi Stephen, I'll see the code in your program, thank you. Salvo Update: checked, but I get error at line 224... ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
04-23-2016, 10:16 PM
Post: #4
|
|||
|
|||
RE: A program to toggle between prefixes
(04-23-2016 09:52 PM)salvomic Wrote:(04-23-2016 09:49 PM)StephenG1CMZ Wrote: That sounds like it would be very useful to have. I can't see line numbers on my Android, but at a guess that is a long line... I have seen an issue before with cut and paste putting in the occasional wrong kind of Unicode space. Just deleting the space or deleting it and retyping it will probably make the error go away. If that doesn't help, there is a slightly older version of Z UNITS within an old version of ZIPP - you could try that. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
04-23-2016, 10:21 PM
(This post was last modified: 04-23-2016 10:30 PM by salvomic.)
Post: #5
|
|||
|
|||
RE: A program to toggle between prefixes
(04-23-2016 10:16 PM)StephenG1CMZ Wrote: I can't see line numbers on my Android, but at a guess that is a long line... maybe the error is about here Code:
Better, I need something between your Z Units program and this ENG program (ENG) to toggle ENG powers and prefixes... ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
04-23-2016, 10:30 PM
(This post was last modified: 04-23-2016 10:58 PM by StephenG1CMZ.)
Post: #6
|
|||
|
|||
RE: A program to toggle between prefixes
(04-23-2016 10:21 PM)salvomic Wrote:(04-23-2016 10:16 PM)StephenG1CMZ Wrote: I can't see line numbers on my Android, but at a guess that is a long line... I just checked it - there are about 6 lines that need changing. All are spaces that shouldn't be there. HLP3 (SL) should be HLP3(SL) (three lines, each with a differently positioned space) a cre should be acre 1_ gal should be 1_gal 1_th erm should be 1_therm When I download my version to Android, I see those extra spaces... Hope it helps Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
04-23-2016, 10:40 PM
Post: #7
|
|||
|
|||
RE: A program to toggle between prefixes
there was some invisible spaces...
this should works Code:
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
04-23-2016, 11:12 PM
Post: #8
|
|||
|
|||
RE: A program to toggle between prefixes
For me, that version still has the unwanted visible spaces - or the Android is putting them back in. I find I need to manually edit the 6 lines after downloading.
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
04-24-2016, 07:26 AM
Post: #9
|
|||
|
|||
RE: A program to toggle between prefixes
(04-23-2016 11:12 PM)StephenG1CMZ Wrote: For me, that version still has the unwanted visible spaces - or the Android is putting them back in. I find I need to manually edit the 6 lines after downloading. maybe Android put in again the invisible space, I've pasted here in Mac OS X via Parallels Windows 10, as I do always... Salvo ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
04-24-2016, 11:57 AM
Post: #10
|
|||
|
|||
RE: A program to toggle between prefixes
Hi Salvomic,
The scientific notation exponent on base 10 of a value could be matched with the corresponding value in an SI prefix list, and append the prefix abbreviation, or name, on returning corresponding value. I haven't coded a routine for this, but you might have some ideas to expand on this theme. Here is an SI prefix list you might find useful, (omitting 1e0, which could be the default case) : Code:
-Dale- |
|||
04-24-2016, 01:24 PM
Post: #11
|
|||
|
|||
RE: A program to toggle between prefixes
How about loading the number into a spreadsheet...
And having adjacent cells showing all the alternatives. Not as easy as a built-in toggle, but it might help. Apologies for cluttering up so much of this thread with my program. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
04-24-2016, 09:16 PM
(This post was last modified: 04-25-2016 02:43 PM by salvomic.)
Post: #12
|
|||
|
|||
RE: A program to toggle between prefixes
thank you Dale and Stephen,
I could do something like this code (modifying the program of user cclinus in this post (this code begin to work like the original "ENG" simulation, that I've modified to handle from E-24 to E24)... shift-Help / lower "ENG, shift-Help * increase, shift-Help + return the normal number, shift-Help - change "Exx" into prefix... It's a first attempt... Code:
with this code for the user key Code:
But this code need to be modified in three ways: 1. deleting the leading zeroes at the end, i.e. "1.2530000000E9" should be "1.253E9" without zeroes... 2. avoiding to have ENGA(Ans), ENGB(Ans) and prefix(Ans): for a real "ENG key" simulation it would be better don't show them 3. implementing back and forward also for prefixes like in ←ENG and ENG→ of the (modified) original program (if one want to have both systems ENG and prefixes) Any hints? Salvo (IT9CLU) ∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)