CNV: A Function to Convert Units
|
10-27-2015, 08:34 PM
(This post was last modified: 04-24-2017 09:59 PM by epp.)
Post: #1
|
|||
|
|||
CNV: A Function to Convert Units
A program to convert units for length, volume, time, or weight. After installing CNV click on the Toolbox, select the USER tab, and choose CNV. The calculator may be in Textbook or RPN modes. Under Textbook specify the input as a function parameter:
CNV(5) With RPN enter the number, press ENTER, then invoke CNV: 5 ENTER CNV You will be prompted to indicate whether the conversion is for Length, Volume, Time, or Weight. Then indicate the units you are converting from and to. If units are specified on input then you will only be prompted to enter output units and the results will include units. The program remembers your selections for input and output units for the next time. CNV(1) --> 2.54 CNV(1_inch) --> 2.54_cm Code:
|
|||
10-30-2015, 08:58 AM
Post: #2
|
|||
|
|||
RE: CNV: A Function to Convert Units
I have also found it best to deal with temperature conversion myself rather than using CONVERT - and I use the Android emulator rather than actual hardware. Nice to see your program in the library.
Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
07-17-2017, 05:53 AM
Post: #3
|
|||
|
|||
RE: CNV: A Function to Convert Units
Nice!
|
|||
07-22-2017, 06:15 AM
(This post was last modified: 07-22-2017 06:24 AM by Skyblues.)
Post: #4
|
|||
|
|||
RE: CNV: A Function to Convert Units
I'm starting to play around with programming the Prime. I thought I'd start with an existing program that I like.
I was going to add an area conversion to this program. Can someone point me in the right direction? I looked over the code and tried a few things but nothing is working. I thought this may be a good educational exercise for me. Thanks |
|||
07-22-2017, 10:28 PM
(This post was last modified: 07-23-2017 12:37 AM by Skyblues.)
Post: #5
|
|||
|
|||
RE: CNV: A Function to Convert Units
This is my first attempt to expand on epp's "CNV: A Function to Convert Units" program.
All the unit conversions seem to be working except Speed. The only units that work in Speed are kph, mph and knot; the rest are creating "Error: Syntax Error". It doesn't seem to like anything with a "/" in the name and I can't find the problem. So I guess the question is, how do I get the code to accept a name with a "/" in it? I've been reading through the code to try to figure why m/s (for example) isn't being accepted although it's a valid unit in the Prime. Is there an IDE one can use to step through the code? Edit: In case anyone's interested, I discovered that anything with a "/" in it, must be enclosed in parentheses. I've tried out most of the unit conversions and they work. If anyone finds an error, please let me know. I edited my original code with my update. I find it very useful. Thanks for the original code, epp! Code: #pragma mode(separator(.,;) integer(h32)) |
|||
08-12-2017, 02:24 AM
Post: #6
|
|||
|
|||
RE: CNV: A Function to Convert Units
I'm posting my final version of epp's expanded "CNV: A Function to Convert Units"
I made one change based on some advise I got from Didier. Now, the temperature conversion works correctly. Code: #pragma mode(separator(.,;) integer(h32)) |
|||
10-24-2018, 01:37 PM
Post: #7
|
|||
|
|||
RE: CNV: A Function to Convert Units
thanks
|
|||
10-03-2023, 03:26 AM
Post: #8
|
|||
|
|||
RE: CNV: A Function to Convert Units
Thanks!
I find it useful to enter quantity then "of what unit" then "to what unit". |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)