Displaying A Binary Integer; Pad (Pad With Leading Spaces) - HP 48gII Advanced User's Reference Manual

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

Example: Calculate F
13
Select the VAR menu and do the calculation.
J
13 %FIBT%
F
is 233. FIB2 takes fewer seconds to execute than FIB1 (far fewer if n is large). (The times required for the
13
calculations depend on the contents of memory and other factors, so you may not get the exact times shown
above.)

Displaying a Binary Integer

This section contains three programs:
PAD is a utility program that converts an object to a string for right-justified display.
!
PRESERVE is a utility program for use in programs that change the calculator's status (angle mode, binary
!
base, and so on).
BDISP displays a binary integer in HEX, DEC, OCT, and BIN bases. It calls PAD to show the displayed
!
numbers right-justified, and it calls PRESERVE to preserve the binary base.

PAD (Pad with Leading Spaces)

PAD converts an object to a string, and if the string contains fewer than 22 characters, adds spaces to the
beginning of the string till the string reaches 22 characters.
When a short string is displayed with DISP, it appears left-justified: its first character appears at the left end of
the display. By adding spaces to the beginning of a short string, PAD moves the string to the right. When the
string (including leading spaces) reaches 22 characters, it appears right-justified: its last character appears at the
right end of the display. PAD has no effect on longer strings.
Techniques used in PAD
WHILE...REPEAT...END (indefinite loop). The WHILE clause contains a test that executes the
!
REPEAT clause and tests again (if true) or skips the REPEAT clause and exits (if false).
String operations. PAD demonstrates how to convert an object to string form, count the number of
!
characters, and combine two strings.
and compare the execution time for the two methods.
Level 1
object
"
Level 1
"object"
"
RPL Programming Examples 2-5

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents