XUNIT - the reverse of UBASE for the HP48sx From: Lutz Vieweg (lv@muffel.hotb.sub.org) Newsgroups: comp.sources.hp48 Date: 15 Sep 91 21:43:24 GMT [Note: This includes self-modifying machine language! DO NOT EXECUTE FROM A LIBRARY OR FROM A WRITE-PROTECTED RAM CARD! -jkh-] When HP implemented the unit-calculation routines in their 48sx, they forgot a very often requested function - the inverse function to UBASE. If you calculate with units, you will face a monsterous term after a while, because the 48sx does not "shorten" the unit-fractions. This program fills the gap. You may type e.g. Your input Result ---------------------------------------------------- 2.34_F/V 1: 2.34_nF/mV UBASE 1: .00000234_A^3*s^7/(kg^2*m^4) XUNIT 1: .00000234_F/V I hope you can see the meaning of XUNIT. XUNIT is a directory, which consists of the following: XUNIT The main program. Uses XU.L, XU.A, U->A and ARRSUM XU.L Is a list of your favourite units. Edit this list, if you want to, then call XL->A to create XU.A out of the list. XUNIT will only try to use the units in this list. XL->A Creates the XU.A list from the XU.L list. This has to be done any time you change XU.L U->A A subroutine that creates an array from an unit-object representing the exponents of the basic units. NOTICE: This one uses self-modifying ML. Do not store this one into protected RAM or libraries! ARRSUM Simply does ABS with any member of an array. XU.A is used by XUNIT for internal use. This PGM is public domain. I would like to see any improvements, especcially speed-ups. cu, Lutz Vieweg.