CNV: A Function to Convert Units +- HP Forums (http://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: HP Prime Software Library (/forum-15.html) +--- Thread: CNV: A Function to Convert Units (/thread-5018.html) |
CNV: A Function to Convert Units - epp - 10-27-2015 03:34 PM 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 RE: CNV: A Function to Convert Units - Skyblues - 07-22-2017 05:28 PM 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! RE: CNV: A Function to Convert Units - Skyblues - 08-12-2017 09:24 PM 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. |