(User.programs) Item: 145 by _rjs at hpcvbbs.UUCP Author: [rj schwartz] Subj: BASE OF NATURAL LOG (e) TO N PLACES Date: Tue Nov 06 1990 10:49 BASE OF NATURAL LOG (e) TO N PLACES... The program below produces a vector containing 10 digit integers which represent the fractional part of 'e' (.71828...). The program takes a single argument (from level 1) which is a positive integer divisible by 10. The argument specifies the number of decimal places that are to be determined. Note - due to truncation the last few decimal places may be incorrect - for up to 150 digits the last 2 may be incorrect, above that and up to 2500 digits the last 3 may be incorrect and above that and up to 35000 digits the last 4 may be incorrect. The time to produce 30 digits (28 accurately) on the HP48SX w/ROM-D is 30 secs. A similar program written some years ago for the HP-65 took 210 secs to produce 32 digits. I've written a PC based programmable calculator program which, when run on a 33MHz 80386/80387, will generate 2000 digits in a little over 30 mins. An assembly language routine using the same algorithm and run on the same machine takes 1.2 secs. I estimate that the HP48SX would take on the order of 15 hrs. to produce this many digits and the result may be incorrect - it depends on the precision of the internal floating point representation. Does anyone know what the internal representation is? The correct fractional part to 2000 decimal places (actually 1996) follows the program listing. Also, let me know if you're interested in obtaining a copy of the PC based calculator mentioned above. The documentation is incomplete, but I'll finish it if there's enough interest. A brief description of the program features follows: PC - Personal Computer Programmable Calculator (c) 1989 RJ Schwartz LIST OF FEATURES . Reverse Polish Notation (RPN) with 4 register stack plus "Last x" register. . 15 - 16 digit accuracy, range - 1.E-308 to 1.E308, user defined display precision. . 8000 data registers addressable directly or indirectly, 4 function register arithmetic, increment (decrement) register. . 100 general purpose flag (Boolean) registers: 1 - 19 System flags 20 - 39 Unaffected by flag test 40 - 59 Cleared by flag test 60 - 79 Set by flag test 80 - 99 Complemented by flag test Flag operations - set, complement, test on, test off. System flags indicate data entry, stack lift status, print enable, print to file, error conditions. . Built in functions include trigonometrics in degree, radian, gradian or hyperbolic modes, e^x, ln x, 10^x, log x, abs, sgn, factorial, combinations and permutations, rect <-> polar conversions, integer, fraction, remainder, round, random number generator, reciprocal, square root, add, subtract, multiply, divide, exponentiate and more. All functions can be included in programs. . 10000 step program capacity - 6 conditional tests, 100 levels of nested subroutines, GOTO label, GOTO prog. step, relative jump, decrement or increment any data register with variable length jump on zero or non-zero. . Trace and/or time execution, single step, set breakpoint, variable length pause. . 40 user defined keystroke Macros (up to 40 characters each). . Save (Load) registers, macros and/or flags to (from) disk. . Formatted print (numeric or string data) to printer or to disk. . Display graphs of user defined functions. . Variable length BEEP and TONE functions. . Statistical functions including mean, standard deviation, and linear regression. . Executes over 3000 program steps per second on an 80386 CPU @ 20 MHZ. HARDWARE REQUIREMENTS/RECOMENDATIONS . Requires computer with Intel 8088 or 80x86 CPU, Microsoft DOS version 3.1 or higher, IBM compatible BIOS and CGA, EGA or VGA graphics. . Recommended are math coprocessor (80x87), a fast CPU and EGA or VGA graphics cards with color display. REQUEST FOR ASSISTANCE I've just purchased the HP48 after many years away from HP calculators. (My last was the HP-65, which, incidentally, was stolen - does anyone have one for sale?). Anyway, I see from comments on this BBS, that low level programming is now possible on HP48 and some of its predecessors. Can someone please direct me to information on the following for the HP48: 1. The CPU architecture (including register sizes). 2. The interrupt capabilities (is that what controls the clock and the keyboard?). 3. The instruction set (I've seen some listings on this BBS but the adressing modes are foreign to me. eg. add.a c,a). 4. A list of ROM entry points (again I've seen partial listings but there seems to be much more information available). 5. The internal structure of HP48 objects. Thanks in advance [RJ: I'll bet Voyager is exactly what you've been waiting for! -jkh-]