CONVERT and variables for arguments
|
10-21-2015, 06:59 PM
Post: #21
|
|||
|
|||
RE: CONVERT and variables for arguments
IYou might be interested to know that I just asked in another thread about using unit prefixes (milli,nano etc. ) in user inputs.
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
10-22-2015, 11:35 AM
(This post was last modified: 10-27-2015 11:54 AM by epp.)
Post: #22
|
|||
|
|||
Conversions Implemented as a Function
Thought I'd re-invent the wheel again. Listed below is a function to convert, CNV(X), where X can be a real (20) or a unit (20_cm). Two unit conversions, for distance and volume, and a driver to do the selection are included. Usage:
RPN: 20 ENTER CNV TEXTBOOK: CNV(20) If the original number you are converting is in units the answer will be in terms of units. For example, when converting 18 from inches to feet we have 18_inch -> 1.5_ft 18 -> 1.5 The following code can easily be extended to include other data types. Code:
To place CNV on the command line choose Toolbox > User > CNV > CNV If you have previously visited this menu then choose Toolbox and keep pressing ENTER. Previous choices are saved by both the PRIME and the CNV program. Alternatively you can bind a key to insert "CNV" and then choose Shift > Help > KEY where KEY is the one you bind to CNV. The following code binds the Units key to CNV. Code:
On a small screen selecting menu items while running CNV can be a challenge. Instead use the rocker to navigate to the selection or use the keyboard and choose a number that corresponds to the selection. |
|||
10-22-2015, 11:12 PM
Post: #23
|
|||
|
|||
RE: CONVERT and variables for arguments
I have now implemented handling of SI prefixes in V0.2 of my ZIPP unit conversion utility.
The user can now type in inputs such as 3*NANO. Selecting Units/Prefixes is not useful in this program, the name has to be typed in. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
10-24-2015, 09:35 PM
(This post was last modified: 10-27-2015 09:19 PM by epp.)
Post: #24
|
|||
|
|||
RE: CONVERT and variables for arguments
By storing information in lists the code is shorter and modification is easier. The function, CNV(X), converts between units where X can be a real (18) or a unit (18_inch). Distance, Volume, and Weight have been implemented. Works under HOME and CAS.
RPN: 18 ENTER CNV TEXTBOOK: CNV(18) If the original number you are converting from is in units the answer will be in terms of units. For example, when converting 18 inches to feet we have CNV(18_inch) -> 1.5_ft CNV(18) -> 1.5 The following code can easily be modified to include other data types. Code:
To place CNV on the command line choose Toolbox > User > CNV > CNV If you have previously visited this menu then choose Toolbox and keep pressing ENTER. Previous choices are saved by both the calculator and the CNV program. Alternatively you can bind a key to insert "CNV" and then choose Shift > Help > KEY where KEY is the one you bind to CNV. The following code binds the Units key to CNV. Code:
On a small screen selecting menu items while running CNV can be a challenge. Instead use the rocker to navigate to the selection or use the keyboard and choose a number that corresponds to the selection. Implementing temperature conversions (Fahrenheit/Celsius) fail under firmware 8151 due to the lack of arithmetic support. |
|||
10-30-2015, 08:26 AM
Post: #25
|
|||
|
|||
RE: CONVERT and variables for arguments
Version 0.4 of my ZIPP program now handles temperature conversion too (though not the same way as other unit conversions). Nice to see your program is now in the library, epp.
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)