HP Forums
(Free42) Utilities to view all digits - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (Free42) Utilities to view all digits (/thread-6872.html)



(Free42) Utilities to view all digits - Werner - 09-17-2016 01:53 PM

These utilities show all 34 digits of a number in scientific notation.
All are written specifically for Free42, relying on its blazing speed.

1.SMX: split a number into signed mantissa and exponent


A subroutine used in all utilities

In:
X: s.m.10^x
Out:
Y: s.m
X: x

Code:
00 { 48-Byte Prgm }
01>LBL "SMX"
02 ENTER
03 XEQ 10
04 RCL ST Y
05 SIGN
06 x
07 X!=0?
08 STO/ ST Y
09 X<>Y
10 X!=0?
11 LOG
12 RTN
13>LBL "MANT"        subroutine courtesy of Dieter
14>LBL 10        s.m.10^x -> m
15 ABS
16 1
17 X<Y?
18 10^X
19 /
20 ENTER
21 X!=0?
22 LOG
23 IP
24 10^X
25 /
26 1
27 X>Y?
28 10^X
29 x
30 END

2.SHOW: Show all digits in ALPHA

A straightforward approach using the Alpha register:
will only work for reals.

Code:
00 { 50-Byte Prgm }
01>LBL "SHOW"
02 ENTER
03 CLA
04 XEQ "SMX"
05 X<>Y
06 AIP
07 ABS
08 FS? 28
09 +"."
10 FC? 28
11 +","
12 FP
13>LBL 10
14 10
15 x
16 AIP
17 FP
18 X>0?
19 GTO 10
20>LBL 00
21 Rv
22 +"E"        this is the small exponent E
23 AIP
24 AVIEW
25 Rv
26 END

3.D30: shows the 30 least significant digits in the menu.

.grouped digits make for easy reading
.small font
.handles real, complex, matrix (both real and complex)

Use EXIT for exiting.
When a complex number is shown, pressing any menu key will switch between real and imaginary part. You can use the built-in SHOW (shift-RS) to show 12 digits of both parts.
When a matrix is shown, use up and down arrows to navigate the matrix in a column-wise manner.

Code:
00 { 165-Byte Prgm }
01>LBL "D30"
02 CLMENU
03 KEY 9 GTO 09
04 MAT?
05 FS? 31        Always False Filler
06 GTO 03
07 KEY 7 GTO 07
08 KEY 8 GTO 08
09 EDIT

10>LBL 03
11 ENTER
12 REAL?
13 GTO 00
14 COMPLEX
15 Rv
16>LBL 00
17 XEQ 01

18>LBL 11
19 MENU
20 STOP
21 GTO 11

22>LBL 10
23 REAL?
24 GTO 11
25 ENTER
26 COMPLEX
27 X<>Y
28 Rv
29 XEQ 01

30>LBL 12
31 MENU
32 STOP
33 GTO 12

34>LBL 10
35 GTO 03

36>LBL 07
37 ^            up arrow
38 GTO 03

39>LBL 08
40 v            down arrow
41 GTO 03

42>LBL 09
43 EXITALL
44 RTN

45>LBL 01
46 XEQ "MANT"
47 1E3
48 STOx ST Y
49 X<>Y
50 XEQ 05
51 KEY 1 GTO 10
52 XEQ 05
53 KEY 2 GTO 10
54 XEQ 05
55 KEY 3 GTO 10
56 XEQ 05
57 KEY 4 GTO 10
58 XEQ 05
59 KEY 5 GTO 10
60 XEQ 05
61 KEY 6 GTO 10
62 Rv
63 Rv
64 RTN

65>LBL 05
66 CLA
67 FP
68 %
69 AIP
70 FP
71 %
72 AIP
73 FP
74 %
75 AIP
76 FP
77 %
78 AIP
79 FP
80 %
81 AIP
82 END


4.SB: Stack Browser

.shows X and Y stack levels at the same time
.use ENTER to alternate between most significant and least significant digits
.only reals, shows "NaN" for anything else
.medium font (4x6)
.use UP and DOWN arrows (or Rv) to roll up and down respectively.
.use Backspace (<-) to exit.

[attachment=3952]
[attachment=3951]

No listing provided as it's full of special characters..

Attachments contain all programs in .raw format

Cheers, Werner