Fix various syntax errors in the built-in equations contributed by @Wiljea. Also some changes in units: * use `Ω` (Unicode 937) character instead of `Ω` (Unicode 8486) for the Ohm unit. There is a dedicated Unicode codepoint, but since we don't use special characters for `m` or `s` units, there is no reason we should make things more difficult for Ohm. * Use metric units consistently, i.e. replace `_lb` with `_kg`, `_in` with `_cm`, `_lbf` with `_N` and so on. It might be worth it later to make a metric and an imperial variant of this file. * Use degrees for user angles input in equations. * Rename variables that are reserved words, e.g. `Re` and `vx`. This is because DB48X is by default case-insensitive. Note that we could have a prefix character forcing a symbol for reserved names (much like we have a prefix for constants). Fixes: #1162 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
286 KiB
Overview
DB48X on DM42
The DB48X project intends to rebuild and improve the user experience of the legendary HP48 family of calculators, notably their "Reverse Polish Lisp" (RPL) language with its rich set of data types and built-in functions.
This project is presently targeting the SwissMicro DM42 calculator and leveraging its built-in software platform, known as DMCP. This is presumably the calculator you are currently running this software on. You can also try it in your browser.
Table of contents
- Using the on-line help
- Quickstart guide
- State of the project
- Design overview
- Keyboard interaction
- Soft menus
- Differences with other RPLs
- Built-in help
- Acknowledgements and credits
- Release notes
- Performance
State of the project
This is currently SEMI-STABLE software, meaning that the implemented features appear to work somewhat reliably, but that some features are still being added with each new release. This is NOT PRODUCTION READY and should not be used for any mission-critical computation.
At this point in time, you should only installing this if you are interested in contributing to the project, whether it is in the form of code, feedback or documentation changes. Please refer to the web site of the project on GitHub or GitLab for details and updates. The best way to report an issue, request an improvement or submit a proposed change is on the project's GitHub page.
The implementation status section categorizes all the RPL commands in the HP50G and in DB48X into "implemented", "not implemented" and "DB48X only" lists.
Design overview
The objective is to re-create an RPL-like experience, but to optimize it for the existing DM42 physical hardware. Ideally, DB48X should be fully usable without a keyboard overlay. though one is being worked on.
Compared to the original HP48, the DM42 has a much larger screen, but no annunciators (it is a fully bitmap screen). It has a keyboard with dedicated soft-menu (function) keys, but only one shift key (whereas the HP48 has two), lacks a dedicated alpha key, does not provides left or right arrow keys (only up and down), and has no space key (SPC on the HP48).
Keyboard interaction
The keyboard differences force us to revisit the user interaction with the calculator compared to the HP48:
-
When running DB48X on the DM42, the single yellow shift key cycles between three states, Shift (shown in the documentation as 🟨), Right Shift (shown in the documentation as 🟦), and no shift. This double-shift shortcut appears necessary because RPL calculators like the HP48 have a rather full keyboard even with two shift keys.
-
A first press on the shift key is shown as 🟨 in the documentation, and activates functions shown in yellow in the keyboard overlay. A second press is shown as 🟦 in the documentation, and activates functions shown in blue in the keyboard overlay. On the screen, the shift state is indicated in the header area. When a soft menu is visible on the screen, the selected row of functions is highlighed.
In the rest of this document, the shift key is referred to as 🟨, and pressing it twice is referred to as 🟦, irrespective of the appearance of the physical shift key on your particular hardware. While running the firmware, this will display in the annunciator area as follows:
Other aspects of the keyboard interaction are fine-tuned for RPL usage:
-
Since RPL uses alphabetic entry (also called Alpha mode) a lot more frequently than on RPN models like the HP41 or HP42, making it quickly accessible seems important, so there are three distinct ways to activate it.
-
The ▲ and ▼ keys move the cursor left and right while editing instead of up and down. These cursor movements are much more useful for a text-based program editing as found in RPL. In the rest of this document, they are described as ◀︎ and ▶︎ respectively.
-
Using 🟨 ◀︎ and 🟨 ▶︎ moves the cursor up and down. When not editing, ◀︎ and ▶︎ behave like ▲ and ▼ on the HP48, i.e. ◀︎ enters the interactive stack (not yet implemented) and ▶︎ edits the object on the first level of the stack.
-
Long-pressing arrow keys, the ← (also known as Backspace) or text entry keys in Alpha mode activates auto-repeat.
-
Long-pressing keys that would directly trigger a function (e.g. SIN), including function keys associated with a soft-menu, will show up the built-in help for the corresponding function.
Alpha mode
Entering alphabetic characters is done using Alpha mode. These alphabetic characters are labeled on the right of each key on the DM42's keyboard.
When Alpha mode is active, an ABC indicator shows up in the annunciator area at the top of the screen. For lowercase entry, the indicator changes to abc.
There are three ways to enter Alpha mode:
-
The first method is to use 🟨 ENTER as indicated by the ALPHA yellow label on the DM42 ENTER key. This cycles between Alpha ABC, Lowercase abc and Normal entry modes.
-
The second method is to hold 🟨 for more than half a second. This cycles between Alpha ABC and Normal entry modes, and cannot be used to type lowercase characters.
-
The third method is to hold one of the arrow keys ◀︎ or ▶︎ while typing on the keyboard. This is called transient alpha mode because Alpha mode ends as soon as the arrow key is released. Using ◀︎ enters uppercase characters, while ▶︎ uses lowercase characters.
There is no equivalent of the HP48's "single-Alpha" mode. Alpha mode is either transient (when you hold one of the arrow keys) or sticky (with 🟨 ENTER or by holding 🟨).
Alpha mode is cancelled when pressing ENTER or EXIT.
Since the DM42's alphabetic keys overlap with the numeric keys (unlike the HP48), as well as with operations such as × and ÷, using 🟨 in Alpha mode brings back numbers. This means 🟨 cannot be used for lowercase, but as indicated above, there are two other methods to enter lowercase characters.
Using 🟨 or 🟦 in combination with keys other than the numeric keypad gives a variety of special characters.
Key mapping
The layout of keys on DB48X was carefully chosen to offer a good compromise between immediate applicability for calculations and giving access to numerous advanced functions through menus.
DB48X keyboard overlays for DM-42 and DM-32 SwissMicros calculators are already available.
In the rest of this document, keys bindings will usually be described using the
alphabetic key, to make it easier to locate on the keyboard, followed by the
standard label on the DB48X layout. For example, the assignment for the sin
function will be described as J (SIN). The shifted functions of the same key
will be described as 🟨 J (SIN⁻¹) or 🟦 J (HYP) respectively.
In some cases, the label between parentheses may refer to another calculator model, which will be indicated as follows. For example, the A key can be described as A (⚙️, DM-42 Σ+, DM-32 √x).
However, if you are using DB48X on a DM42, it is possible to do it without a keyboard overlay, because great care was taken to have the DB48X keboard layout remain close to that of the DM42, in order to preserve muscle memory. New features were positioned on the keyboard at positions that are close to what is familiar in the original DM42 firmware.
A few keys that have little use in RPL are reassigned to features that you should be able to quickly remember. For example, the DM-42 RCL key is used for the DB48X VAR key, which invokes the VariablesMenu.
Note that the LOG and e^x keys are swapped relative to the DM-42. The HP42 has LOG and LN with shifted 10^x and e^x. DB48X has e^x and LN with shifted 10^X and LOG, so that the more frequently used mathematical functions are available without shifting. Note that in the future, full keyboard remapping similar to the HP41 or HP48 will allow you to change that if you prefer.
Here are a few of the interesting RPL-specific key mappings:
-
A (⚙️, DM-42 Σ+, DM-32 √x) is used to invoke a context-sensitive ToolsMenu, which select a softkey menu based on what is on the stack and other context.
-
🟨 A (←MENU, DM-42 Σ-, DM-32 x²) selects the LastMenu command, which displays the previously selected menu.
-
🟦 A (MAIN, DM-32 PARTS) selects the MainMenu, a top-level menu giving indicrect access to all other menus and features in DB48X (see also the Catalog feature).
-
F (' (), DM-42 XEQ, DM-32 Σ+) opens an algebraic expression, i.e. it shows
''
on the command-line and switches to equation entry. If already inside an equation, it inserts a pair of parentheses. This can be used to evaluate expressions in algebraic mode instead of RPN. -
🟨 G (CPLX, DM-42 COMPLEX, DM-32 CMPLX) lets you work with complex numbers. It opens the ComplexMenu, which can be used to enter complex numbers in rectangular or polar form, and perform common operations on these numbers. The same menu can be accessed without shift using A (⚙️) when there is a complex number on the stack.
-
H (VAR, DM-42 and DM-32 RCL) opens the VariablesMenu showing user variables in the current directory.
-
I (STK, DM-42 and DM-32 R↓) will open the StackMenu, giving access to stack operations.
-
🟨 I (CONST, DM-42 π, DM-32 HYP) shows a ConstantsMenu giving access to various constants. You can provide your own constants in a
config/constants.csv
file on disk. -
M (X⇆Y) executes the RPL Swap function
-
🟨 M (LAST, DM-42 LAST x, DM-32 MEM) is LastArg, which recalls the arguments of the last command.
-
🟦 M (Undo, DM-32 X⇆) restores the previous state of the stack. This is like
Last Stack
on the HP48, but on DB48X, it is a real command that can be used in programs. -
N (+/-) executes the equivalent RPL
Negate
function. While editing, it changes the sign of the current number on the command-line. -
O (×10ⁿ, EEX or E depending on keyboard labeling, referred to as ×10ⁿ in the rest of this document) is used to enter the exponent of a number in scientific notation. However, when not entering or editing values, it invokes the Cycle command, which cycles between various representations of a number, for example polar and rectangular for a complex number, or fraction and decimal for a decimal number.
-
EXIT (DM-32 ON) corresponds to what the HP48 manual calls Attn, and typically cancels the current activity. It can also be used to interrupt a running program.
-
🟨 EXIT (OFF) shuts down the calculator. The state of the calculator is preserved.
-
🟦 EXIT (SAVE) saves the current state of the calculator to disk. This state can be transferred to another machine, and survives system reset or firmware upgrades.
-
🟨 0 (SETUP) shows the firmware's SystemMenu, for example to load the original DM-42 or DM-32 program, activate USB disk, and to access some calculator preferences.
-
The R/S keys inserts a space in the editor, an
=
sign inside equations, and maps to Evaluate otherwise. -
🟨 R/S («PROG», DM-42 and DM-32 PRGM) inserts the delimiters for an RPL program,
«
and»
, while 🟦 R/S ({LIST}) inserts the list delimiters,{
and}
. -
🟨 + (CAT, DM-42 CATALOG, DM-32 LBL) shows a complete context-sensitive catalog of all available functions, and enables auto-completion using the soft-menu keys. Note that the
+
key alone (without shift) activates the catalog while in Alpha mode. When inside text, the catalog presents alternates for the character at the left of the cursor, providing a convenient way to select diacritics and accents.. -
🟦 + (HELP, DM-32 RTN) activates the context-sensitive help system.
Soft menus
The DM42 has 6 dedicated soft-menu keys at the top of the keyboard. Most of the advanced features of DB48X can be accessed through these soft menus. Soft menu keys have no label on the physical calculator, but in this documentation, they may sometimes be referred to as F1 through F6.
All built-in soft-key menus are named, with names ending in Menu. For example, the VariablesMenu is the menu listing global variables in the current directory. Unlike HP RPL calculators, menus cannot be accessed by number, but they can be accessed by name. In a future version of the firmware, a Menu special variable will return the name of the current menu. The LastMenu command selects the previous menu.
Menus are organized internally as a hierarchy, where menus can refer to other menus. A special menu, MainMenu, accessible via the 🟦 A, contains all other menus.
Menus can contain up to 18 entries at once, 6 being directly accessible, 6 more being shown when using the 🟨 key, and 6 more with 🟦. Three rows of functions are shown on screen, with the active row highlighted.
A long press on a function key invokes the on-line help for the associated function.
When a menu contains more than 18 entries, then the F6 function key turns into
a ▶︎
, and 🟨 F6 turns into ◀
︎. These keys can be used to
navigate across the available menu entries. This replaces the NXT and PREV
keys on HP calculators.
The VariablesMenu is used to access global varibales. It is invoked using the H key, which is labeled RCL on SwissMicros hardware. This menu is special in the sense that:
-
Selecting an entry evaluates that menu entry, for example to run a program
-
The 🟨 function recalls its name without evaluating it.
-
The 🟦 function stores into the variable.
Differences with other RPLs
Multiple implementations of RPL exist, most of them from Hewlett-Packard. A good reference to understand the differences between the various existing implementations from HP is the HP50G Advanced User's Reference Manual.
There are a number of intentional differences in design between DB48X and the HP48, HP49 or HP50G's implementations of RPL. There are also a number of unintentional differences, since the implementation is completely new.
User interface
-
DB48X features an extensive built-in help system, which you are presently using. Information for that help system is stored using a regular markdown file named
/help/db48x.md
, stored in the calculator's flash storage. -
DB48X features auto-completion for commands while typing, through the CAT key (a Catalog of all commands).
-
Many RPL words exist in short and long form, and a user preference selects how a program shows. For example, the Negate command, which the HP48 calls
NEG
, can display, based on user preferences, asNEG
,neg
,Neg
orNegate
. In the help, it will be shown as Negate (NEG). -
The DB48X dialect of RPL is not case sensitive, but it is case-respecting. For example, if your preference is to display built-in functions in long form, typing
inv
orINV
will show up asInvert
in the resulting program. This means that the space of "reserved words" is larger in DB48X than in other RPL implementations. Notably, on HP's implementations,DUP
is a keyword but you can useDuP
as a valid variable name. This is not possible in DB48X. -
The saving of the stack arguments for the
LastArg
command is controled independently by two distinct settings,SaveLastArg
andSaveLastArgInPrograms
. The first one controls ifLastArg
is saved for interactive operations, and is enabled by default. The second one controls ifLastArg
is saved before executing commands while running a program or evaluating an expression, and is disabled by default. This impacts commands that evaluate programs, such asROOT
. On the HP48,LastArg
after runningROOT
interactively gives arguments used by some operation withinROOT
, whereas on DB48X with the default settings, it returns the arguments toROOT
. -
When parsing the
Σ
(sum
) function (as well as the∏
(product
) function which the HP calculators do not have), all arguments are separated by semi-colons like for all other functions. HP calculators have a special syntax in that case, where an=
sign separates the index and its initial value. In other words, where an HP calculator would showΣ(i=1;10;i^2)
, which corresponds to the 4-argument sequencei 1 10 'i^2' Σ
, the DB48X implementation shows and requires theΣ(i;1;10;i^2)
syntax. Note that an=
sign may appear inside an expression, but it always denotes equality.
Evaluation
-
Local names are evaluated on DB48X, unlike in the HP versions of RPL. This makes it easier to use local subprograms in larger programs as if they were normal operations. In the less frequent case where you do not want evaluation, you need to use
RCL
like for global variables. -
Lists do not evaluate as programs by default, like on the HP28, but unlike on the HP48 and later HP models. This can be controlled using the
ListEvaluation
setting. Note that a list can be converted to a program using theCycle
command, which makes it easy to build programs from lists. -
The
case
statement can containwhen
clauses as a shortcut for the frequent combination of duplicating the value and testing against a reference. For example,case dup "A" = then "Alpha" end
can be replaced withcase "A" when "Alpha" end
. -
There are no compiled local variables. The a program like
→ ←x « Prog »
might perform incorrectly ifProg
attempts to access←x
. Compiled local variables are a rather obscure feature with a very limited use, and might be replaced with true closures (which have a well-defined meaning) if there is enough demand.
Numbers
-
DB48X has several separate representations for numbers: integers, fractions and decimal. Notably, it keeps integer values and fractions in exact form for as long as possible to optimize both performance and memory usage. This is closer to the HP50G in exact mode than to the HP48. Like the HP50G, DB48X will distinguish
1
(an integer) from1.
(a decimal value), and theTYPE
command will return distinct values. -
Integer and fraction arithmetic can be performed with arbitrary precision, similar to the HP50G. The
MaxNumberBits
setting controls how much memory can be used for integer arithmetic. -
DB48X has true fractions. From a user's perspective, this is somewhat similar to fractions on the HP50G, except that fractions are first-class numbers, whereas the HP50G treats them like expressions. On the HP50G,
1 3 / TYPE
returns9.
, like for'A + B'
. On DB48X, theTYPE
for fractions is different than for expressions. Fractions can be shown either asMixedFractions
orImproperFractions
. -
On HP50G, decimal numbers often outperform integers or fractions, and benchmark code will contain
1.
instead of1
for that reason. On DB48X, arithmetic on integers and fractions is generally faster. -
Like the HP Prime, DB48X displays a leading zero for decimal values, whereas HP RPL calculators do not. For example, it will display
0.5
and not.5
. -
DB48X has two distinct representations for complex numbers, polar and rectangular, and transparently converts between the two formats as needed. The polar representation internally uses fractions of pi for the angle, which allows exact computations. By contrast, HP RPL implementations always represent complex numbers in rectangular form internally, possibly converting it to polar form at display time.
-
DB48X features arbitrary-precision decimal floating-point. The
Precision
command (in theDisplayModesMenu
) can be used to select the precision for numerical operations. In addition, it supports 32-bit and 64-bit hardware-accelerated binary floating-point. -
Based numbers with an explicit base, like
#123h
keep their base, which makes it possible to show on stack binary and decimal numbers side by side. Mixed operations convert to the base in stack level X, so that#10d #A0h +
evaluates as#AAh
. Based numbers without an explicit base change base depending on the Base setting, much like based numbers on the HP48, but with the option to any base between 2 and 36. In addition to the HP-compatible trailing letter syntax (e.g.#1Ah
), the base can be given before the number (e.g.16#1A
), which works for all supported bases.
Representation of objects
-
The storage of data in memory uses a denser format than on the HP48. Therefore, objects will almost always use less space on DB48X. Notably, the most frequently used functions and data types consume only one byte on DB48X, as opposed to 5 nibbles (2.5 bytes) on the HP48. A number like
123
consumes 2 bytes on DB48X vs. 7 on the HP50 and 10.5 on the HP48. -
Numerical equality can be tested with
=
, whereas object equality is tested using==
. For example,0=0.0
is true, but0==0.0
is false, because0
is an integer whereas0.0
is a floating-point. -
Because of differences in internal representation that would require expensive computations to mimic the HP50G behaviour with limited benefit,
Size
returns 1 for integers, algebraic expressions and unit objects. -
The
Type
command can return HP-compatible values that are sometimes imprecise (e.g. it cannot distinguish between polar and rectangular complex values), or numerical values that distinguish all the types in DB48X. This is controlled by theCompatibleTypes
setting. TheTypeName
command is a DB48X-only extension that returns more precise textual information, and should be preferred both for readability and future compatibility. -
DB48X has a dedicated data type to represent multi-variate polynomials, in addition to the classical RPL-based algebraic expressions.
Alignment with SwissMicros calculators
-
DB48X will borrow to the DM-42 the idea of special variables for settings, which are variables with a special meaning. For example, the
Precision
special variable is the current operating precision for floating point, in number of digits. While there is aPrecision
command that sets the value, it is also possible to use'Precision' STO
to set it, and'Precision' RCL
to fetch the current value. This does not imply that there is an internalPrecision
variable somewhere. This applies to all settings and flags. Additionally, binary settings can be set withSF
andCF
, and queried withSF?
andCF?
. For example,'HideDate' CF
will clear theHideDate
flag, meaning that the date will show in the header. -
The DB48X also provides full-screen setup menus, taking advantage of the DM42 existing system menus. It is likely that the same menu objects used for softkey menus will be able to control system menus, with a different function to start the interaction.
-
The whole banking and flash access storage mechanism of the HP48 will be replaced with a system that works well with FAT USB storage. It should be possible to directly use a part of the flash storage to store RPL programs, either in source or compiled form. As an example, using a text argument to
STO
andRCL
accesses files on the USB disk, e.g.1 "FOO.TXT" STO
stores the text representation of1
in a file namedDATA/FOO.TXT
on the USB flash storage.
List operation differences
The application of a same operation on arrays or matrices has never been very consistent nor logical across RPL models from HP.
-
On HP48 and HP50,
{ 1 2 3 } 4 +
gives{1 2 3 4}
. However,{ 1 2 3} 4 *
gives a type error on the HP48 but applies the operation to list elements on the HP50, yielding{ 4 8 12}
. -
For arrays,
[ 1 2 3 ] 4 +
fails on both the HP48 and HP50, but[ 1 2 3 ] 4 *
works. -
The HP50 has a
MAP
function, which works both for list and matrices.[ 1 2 3 ] « 3 + »
will return[ 4 5 6 ]
, and{ 1 2 3 } « 3 * »
will return{ 3 6 9 }
. That function has no direct equivalent on the HP48.
DB48X considers lists as bags of items and treat them as a whole when it makes sense, whereas arrays are focusing more on the values they contain, and will operate on these items when it makes sense. Therefore:
-
{ 1 2 3 } 4 +
gives{ 1 2 3 4 }
,{ 1 2 3 } 2 -
gives{ 1 3 }
(not yet implemented), and{ 1 2 3 } 3 ×
gives{ 1 2 3 1 2 3 1 2 3 }
. The÷
operator is equivalent to theListDivide
function, and partitions a list in chunks of the given size and returns the number of partitions so generated (the last partition being possibly shorter), i.e.{ 1 2 3 4 5 } 2 ÷
will generate{1 2} {3 4} {5} 3
on the stack (this is not yet implemented). -
[ 1 2 3 ] 4 +
gives[ 5 6 7 ]
,[ 1 2 3 ] 2 -
gives[ -1 0 1 ]
,[ 1 2 3 ] 3 ×
gives[ 3 6 9 ]
and[ 1 2 3 ] 5 ÷
gives[ 1/5 2/5 3/5 ]
. -
Two lists can be compared using lexicographic order. This also applies to the
Min
andMax
functions, which compares the entire lists, whereas on HP50G, it compares element by element (element-wise comparison applies to arrays).
Vectors and matrices differences
-
On DB48X, vectors like
[ 1 2 3 ]
are very similar to lists. The primary difference is the behavior in the presence of arithmetic operators. On lists, addition is concatenation, e.g.{ 1 2 3} { 4 5 6} +
is{ 1 2 3 4 5 6 }
, whereas on vectors represents vector addition, e.g.[1 2 3] [4 5 6] +
is[5 7 9]
. However, unlike on the HP original implementation, a vector can contain any type of object, so that you can do[ "ABC" "DEF" ] [ "GHI" "JKL" ] +
and obtain[ "ABCGHI" "DEFJKL" ]
. -
Size enforcement on vectors only happens during these operations, not while you enter vectors from the command line. It is legal in DB48X to have a non-rectangular array like
[[1 2 3] [4 5]]
, or even an array with mixed objects like[ "ABC" 3 ]
. Size or type errors on such objects may occur if/when arithmetic operations are performed. -
In particular, a matrix is nothing but a vector of vectors. DB48X also supports arrays with dimensions higher than 2, like
[[[1 2 3]]]
. -
As a consequence, The
GET
andGETI
functions work differently on matrices. Consider a matrix like[[ 7 8 9 ][ 4 5 6 ][ 1 2 3 ]]
. On the HP48, running1 GET
on this object gives7
, and the valid range of index values is 1 through 9. On DB48X, that object is considered as an array of vectors, so1 GET
returns[7 8 9]
. This is intentional. The behavior of{ 1 1 } GET
is identical on both platforms, and is extended to multi-dimensional arrays, so that[[[4 5 6]]] { 1 1 2 } GET
returns5
. -
Matrices and vectors can contain integer values or fractions. This is closer to the HP50G implementation than the HP48's. In some cases, this leads to different results between the implementations. If you compute the inverse of
[[1 2 3][4 5 6][7 8 9]
on the HP48, you get a matrix with large values, and the HP48 finds a small, but non-zero determinant for that matrix. The HP50G produces a matrix with infinities. DB48X by default produces aDivide by zero
error. -
DB48X accept matrices and vectors as input to algebraic functions, and returns a matrix or vector with the function applied to all elements. For example,
[a b c] sin
returns[ 'sin a' 'sin b' 'sin c' ]
. -
Similarly, DB48X accept operations between a constant and a vector or matrix. This applies the same binary operation to all components of the vector or matrix.
[ a b c ] x +
returns[ 'a+x' 'b+x' 'c+x' ]
. Consistent with that logic,inv
works on vectors, and inverts each component, so that[1 2 3] inv
gives[1/1 1/2 1/3]
. -
The
Min
andMax
operations on arrays apply element by element, in a way similar to how these operations apply to lists on the HP50G (which seems to be undocumented).
Mathematics
-
The
Σ
operation behaves differently between the HP48 and the HP50. On the HP48,I A B 'I^3' Σ
gives an expression,Σ(I=A;B;I^3)
, and an empty range likeI 10 1 'I^3' Σ
gives0
as a value. On the HP50, this sum is simplified as a polynomial expression, so that you get a negative value ifA>B
. The HP50G behaviour seems surprising and undesirable. DB48X follows the HP48 approach. -
The
↑Match
and↓Match
operations return the number of replacement performed, not just a binary0
or1
value. In addition, the patterns can identify specific kinds of values based on the first letter of the pattern variable name, e.g.i
orj
for positive integers, oru
andv
for unique terms, i.e. terms that are only matched once in the expression.
Unicode support
DB48X has almost complete support for Unicode, and stores text internally using the UTF-8 encoding. The built-in font has minor deviations in appearance for a few RPL-specific glyphs.
Overall, a text file produced by DB48X should appear reliably in your
favorite text editor, which should normally be GNU Emacs. This is notably the
case for state files with extension .48S
which you can find in the STATE
directory on the calculator.
The Size
operation when applying to text counts the number of Unicode
characters, not the number of bytes. The number of bytes can be computed using
the Bytes
command.
The Num
and Chr
commands (also spelled Char→Code
and Code→Char
) deal
with Unicode codepoints, and do not use the special HP characters codes. In
addition, Num
return -1
for an empty string, not 0
. 0
is only returned
for a string that begins with a NUL
codepoint.
The Code→Char
command can also be spelled as Code→Text
, and take a list of
Unicode codepoints as input. Conversely, Text→Code
will generate a list of all
the codepoints in a text.
Help
The DB48X project includes an extensive built-in help, which you are presently
reading. This help is stored as a help/db48x.md
file on the calculator. You
can also read it from a web browser directly on the GitHub page of the project.
The Help
command makes it possible to access the built-in help in a contextual
way. It is bound to 🟦 +. If the first level of the stack contains a text
corresponding to a valid help topic, this topic will be shown in the help
viewer. Otherwise, a help topic corresponding to the type of data in the stack
will be selected.
The DB48X help viewer works roughly similarly to the DM42's, but with history tracking and the ability to directly access help about a given function by holding a key for more than half a second.
To navigate the help on the calculator, use the following keys:
-
The soft menu keys at the top of the keyboard, references as F1 through F6, correspond to the functions shown in the six labels at the bottom of the screen.
-
While the help is shown, the keys ◀︎ and ▶︎ on the keyboard scroll through the text.
-
The F1 key returns to the Home (overview).
-
The F2 and F3 keys (labels
Page▲
andPage▼
) scroll the text one full page at a time. -
The F4 and F5 keys (labels
Link▲
andLink▼
) select the previous and next link respectively. The keys ÷ and 9 also select the previous link, while the keys × and 3 can also be used to select the next link. -
The F6 key correspond to the
←Menu
label, and returns one step back in the help history. The ← key achieves the same effect. -
To follow a highlighted link, click on the ENTER key.
Acknowledgements and credits
DB48X is Free Software, see the LICENSE file for details. You can obtain the source code for this software at the following URL: https://github.com/c3d/db48x.
Authors
This software is (C) 2022-2023 Christophe de Dinechin and the DB48X team.
Additional contributors to the project include:
- Camille Wormser (complex number fixes)
- Jeff, aka spiff72 (keyboard overlay)
- Conrado Seibel (help file fix)
- Kjell Christenson (simulator fix)
- Václav Kadlčík (documentation fix)
- Franco Trimboli (WASM port)
The authors would like to acknowledge
- Hewlett and Packard
- The Maubert Team
- Museum of HP calculators
- HPCalc
- The newRPL project
- The WP43 and C47 projects
- SwissMicro's DMCP
This work was placed by Christophe de Dinechin under the patronage of Carlo Acutis
Hewlett and Packard
Hand-held scientific calculators changed forever when Hewlett and Packard asked their engineers to design and produce the HP35, then again when their company introduced the first programmable hand-held calculator with the HP65, and finally when they introduced the RPL programming language with the HP28.
Christophe de Dinechin, the primary author of DB48X, was lucky enough to meet both Hewlett and Packard in person, and this was a truly inspiring experience. Launching the Silicon Valley is certainly no small achievement, but this pales in comparison to bringing RPN and RPL to the world.
The Maubert Team
Back in the late 1980s and early 1990s, a team of young students with a passion for HP calculators began meeting on a regular basis at or around a particular electronics shop in Paris called "Maubert Electronique", exchanging tips about how to program the HP28 or HP48 in assembly language or where to get precious technical documentation.
It started with Paul Courbis, who carefully reverse-engineered and documented the internals of RPL calculators, encouraging his readers to boldly cut open these wonderful little machines to solder IR receivers acting as makeshift PC connection tools, or to waste countless hours debugging video games.
There were more serious efforts as well, notably the HP48 Metakernel, which completely reinvented the HP48 user interface, making it both much faster and better. It is fair to see DB48X as a distant descendent from such efforts. The Metakernel was the work of many now well-known names in the HP community, such as Cyrille de Brébisson, Jean-Yves Avenard, Gerald Squelart and Étienne de Foras. Many of these early heroes would go on to actually change the history of Hewlett-Packard calculators for the better.
The original author of DB48X, Christophe de Dinechin, was part of this loose team, focusing on cross-development tools, which he used at the time to write several games for the HP48, notably PacMan or Lemmings clones. If DB48X exists, it's largely because of that community.
HP Museum
The HP Museum not only extensively documents the history of RPN and RPL calculators, it also provides a very active forum for calculator enthusiasts all over the world.
HPCalc
Much of the work from early enthusiasts can still be found on hpcalc.org to this day.
Back in the 1990s, long before Internet was widely available, HP48 programs were busily swapped over floppy disks, or propagated from machine to machine using the built-in infrared ports. This may have been the first case of large-scale viral distribution of software. This is probably the reason why all this software. which originated from all over the world, can still be downloaded and used today.
newRPL project
newRPL is a project initiated by Claudio Lapilli to implement a native version of RPL, initially targeting ARM-based HP calculators such as the HP50G.
DB48X inherits many ideas from newRPL, including, but not limited to:
- Implementing RPL natively for ARM CPUs
- Adding indicators in the cursor to indicate current status
- Integrating a catalog of functions to the command line
A first iteration of DB48X started as a branch of newRPL, although the current implementation had to restart from scratch due to heavy space constraints on the DM42.
WP43 and C47 projects
The DB48X took several ideas and some inspiration from the WP43 and C47 projects.
Walter Bonin initiated the WP43 firwmare for the DM42 as a "superset of the legendary HP42S RPN Scientific".
C47 (initially called C43) is a variant of that firmware initiated by Jaco Mostert, which focuses on compatibility with the existing DM42, notably with respect to keyboard layout.
DB48X borrowed at least the following from these projects:
- The very idea of writing a new firmware for the DM42
- The idea of converting standard Unicode TrueType fonts into bitmaps (with some additional contributions from newRPL)
- How to recompute the CRC for QSPI images so that the DM42 loads them, thanks to Ben Titmus
- At least some aspects of the double-shift logic and three-level menus
- The original keyboard layout template and styling, with special thanks to DA MacDonald.
SwissMicros DMCP
SwissMicros offers a range of RPN calculators that emulate well-known models from Hewlett-Packard. This includes the DM42, which is currently the primary target for the DB48X firmware.
Special thanks and kudos to Michael Steinmann and his team for keeping the shining spirit of HP RPN calculators alive.
The DM42 version of the DB48X software relies on SwissMicro's DMCP SDK, which is released under the following BSD 3-Clause License:
Copyright (c) 2015-2022, SwissMicros All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Introduction to RPL
The original RPL (Reverse Polish Lisp) programming language was designed and implemented by Hewlett Packard for their calculators from the mid-1980s until 2015 (the year the HP50g was discontinued). It is based on older calculators that used RPN (Reverse Polish Notation). Whereas RPN had a limited stack size of 4, RPL has a stack size only limited by memory and also incorporates programmatic concepts from the Lisp programming language.
The first implementation of RPL accessible by the user was on the HP28C, circa 1987, which had an HP Saturn processor. More recent implementations (e.g., HP49, HP50g) run through a Saturn emulation layer on an ARM based processor. These ARM-based HP calculators would be good targets for a long-term port of DB48X.
DB48X is a fresh implementation of RPL on ARM, initially targetting the SwissMicros DM42 calculator. This has implications on the design of this particular implementation of RPL.
The RPL stack
The RPL stack can grow arbitrarily in size.
By convention, and following RPN usage, this document gives the names X
, Y
,
Z
and T
to the first four levels of the stack. This is used to describe the
operations on the stack with synthetic stack diagrams showing the state of the
stack before and after the operation.
For example, the addition of two objects in levels 1 and 2 with the result deposited in stack level 1 can be described in synthetic form using the following stack diagram:
Y
X
▶ Y+X
The duplication operation Duplicate
(DUP
) can be described in synthetic form
using the following synthetic stack diagram:
X
▶ X
X
Algebraic mode
Unlike earlier RPN calculators from Hewlett-Packard, RPL calculators from HP includes complete support for algebraic objects written using the standard precedence rules in mathematics. This gives you the best of both worlds, i.e. the keyboard efficiency of RPN, requiring less keystrokes for a given operation, as well as the mathematical readability of the algebraic notation. Better yet, it is possible and easy to build an algebraic expression from RPN keystrokes. These nice properties are also true for DB48X.
In RPL, algebraic expressions are placed between ticks. For
example, '2+3×5'
will evaluate as 17
: the multiplication 3×5
, giving 15
,
is performed before the addition 2+15
, which gives 17
. An algebraic
expression can also be symbolic and contain unevaluated variables. For example,
2+x
is a valid algebraic operation. If, having this expression on the stack,
you type 3
and then hit the ×
key, you will end up with (2+x)×3
, showing
how the algebraic expression was built from RPN keystrokes.
Algebraic expressions are not evaluated automatically. The R/S key (bound to
the Evaluate function) will compute their value as needed. On the
DB48X keyboard overlay, this key is also marked as =
for that reason.
Rich data types
Since introducing the first scientific pocket calculator, the HP-35, in 1972, and with it the reverse polish notation (RPN), Hewlett-Packard perfected its line-up for decades. This led to such powerhouses pocket computers such as as the HP-41C series, or tiny wonders of pocket efficiency such as the HP-15C. Many of these calculators, including the models we just cited, were capable of advanced mathematics, including dealing with complex numbers, matrix operations, root finding or numeric integration.
Then in 1986, everything changed with the HP-28C, which introduced a new user
interface called RPL. While the most evidently visible change was an unlimited
stack, what instantly made it both more powerful and easier to use than all its
RPN predecessors was the introduction of data types. Every value
on the stack, instead of having to be a number, could be a text, a name or an
equation. This made operations completely uniform irrespective of the data being
operated on. The same +
operation that adds numbers can also add complex
numbers, vectors, matrices, or concatenate text. The exact same logic applies in
all case. This solved a decade-long struggle to extend the capabilities of
pocket calculators.
For example, whereas the HP-41C had some support for text, with an "Alpha" mode
and an alpha register, text operations were following their own logic, with for
example ARCL
and ASTO
dealing with at most 6 characters at a time, because
they were artificially fitted in a register designed to hold a numerical value.
Dealing with complex numbers on the HP-41C was
similarly clunky.
Even the HP-15C, which had built-in support for complex numbers, remained a bit
awkward to use in "complex mode" because its display could only show one half of
a complex number, e.g. the real or imaginary part. Similarly, matrix or
statistic operations had non-obvious interactions with numbered data registers.
All this was solved with RPL, because now a complex number, a matrix or a text
would occupy a single entry on the stack. So whereas adding two integers would
require a sequence like 1 ENTER 2 +
like in RPN, a very similar sequence would
add two texts: "ABC" ENTER "DEF" +
, and the exact same logic would also add
two vectors in [1 2 3] ENTER [4 5 6] +
.
DB48X adopts this extremely powerful idea, with a focus on making it as efficient as possible for interactive calculations as well as for custom programmed solution.
Quickstart guide
This quickstart guide will rapidly give you an overview of the capabilities of DB48X, and show you how to use it efficiently. Make sure that you have installed the latest version.
The ON / EXIT button is at the bottom left of the calculator. It can be used to power the calculator on, but also to exit operations, for example aborting a data entry.
DB48X is a RPL calculator, which means that:
- It inherits the stack-based "reverse polish" approach to operations that has been a central feature of practically all Hewlett-Packard scientific calculators since the HP-35. You enter arguments to a functions by pushing them on the stack, and the operation removes its arguments from the stack before putting its result(s). Unlike earlier HP calculators, the RPL stack is practically unlimited.
- Unlike simpler calculators, it uses a command line for data entry, with advanced text editing capabilities, and a rich text-based command language. One way to access the hundreds of available commands is by simply typing their name.
Arithmetic operations
Let's compute the area of a room made of a main section that is 6 meters by 8.3 meters, with an additional smaller section that is 3.5 meters by 2.8.
A first way to do it is to use the reverse polish stack-based approach, by
typing the following sequence of keys: 6, ENTER, 8, ., 3, ×, 3,
., 5, ENTER, 2, ., 8, ×, +. The result, 59.6
, shows on the
stack. Prior to pressing the + key, the intermediate results for the two
multiplications, 49.8
and 9.8
, could be seen on the stack.
RPL also supports the standard algebraic notation. Begin the computation with
the '() key. The editor contains quotes, ''
with the cursor between
them. The cursor shows the latter A
, indicating algebraic entry. Type 6,
×, 8, ., 3, +, 3, ., 5, ×, 2, ., 8. At this point,
the text editor should show the whole expression, '6·8.3+3.5·2.8'
or '6×8.3+3.5×2.8'
. Press ENTER
and the expression shows up on the
stack. Hitting the = / EVAL / SPC key (located between the . and +
keys) evaluates the expression, to get the result 59.6
.
Algebraic and reverse-polish computations are equivalent, and can be mixed and matched during computations. Using one or the other is stricly a matter of preference. Algebraic data entry makes it easier to view the entire expression. Reverse-polish makes it easier to see intermediate results.
Fractions
Let us now compute how many pies we need to feed 22 kids if we divide each pie in 8 slices. Using the RPL approach, we would type 2, 2, ENTER, 8, ÷. Using the algebraic notation, we would type '(), 2, 2, ÷, 8, ENTER and then use the = to perform the computation.
With the default settings, you should see a mixed fraction, 2 ³/₄
. Unlike many
calculators, DB48X by default perform exact computations on fractions instead of
using approximate decimal numbers.
You can convert that fraction to a decimal value and back using the Cycle
command, which is bound to the ×10ⁿ key. A first press will show 2.75
, and a
second press will show the value again as fraction 2 ³/₄
.
Mathematical functions
DB48X features a number of mathematical functions. Some of the functions are directly available on the keyboard.
We can compute the length of the diagonal of a rectangle with sides 2m and 3m using the Pythagorean theorem, and display it in millimeters.
In RPL, we can type the following sequence: 2, x² (🟨 C), 3, x²,
+, √x (C), 1, 0, 0, 0, ×. The decimal result,
3 605.55127 546
, is shown on the stack. The digits in the whole part of the
decimal number are grouped 3 by 3, while the digits in the fractional part are
grouped 5 by 5.
In algebraic mode, we can type the following sequence: '(), 1, 0, 0, 0, ×, √x, 2, x² (🟨 C), +, 3, x², ENTER. The mathematical expresssion shows up on the stack graphically. It can then be evaluated using the = key, and shows the same result as for RPL mode.
Mixing algebraic and reverse-polish operations
In the algebraic expression, we have multiplied by 1000 first, whereas in the RPL case, we multiplied by 1000 last. We can also multiply by 1000 last in algebraic mode. There are at least two ways to do it.
A first method is to use the arrow key to exit the parentheses around the argument of the square root function, as follows: '(), √x, 2, x², +, 3, x², ▶︎, ×, 1, 0, 0, 0, ENTER. The expression with the multiplication is then shown on the stack, and can then be evaluated with the = key.
A second method is to mix and match algebraic and RPL, by typing the following sequence: '(), √x, 2, x², +, 3, x², ENTER. At this point, the expression without the multiplication is on the stack. We can then multiply it by 1000 by typing 1, 0, 0, 0, ×. The expression with the multiplication is then shown on the stack, and can then be evaluated with the = key.
Trigonometric functions
Consider that we need to build a plank ramp. We can ask a number of questions, like:
-
If the plank is 5 meters in length, and the slope is 10 degrees, how high will it reach?
-
If we need to reach 60 cm above ground, what is the required slope?
In RPL, can answer the first question by typing 1, 0, SIN, 5,
×. The result is shown in scientific format as 8.68240 88833 5×₁₀⁻¹
.
In algebraic mode, we would type '(), 5, ×, SIN, 1, 0, ENTER
and then evaluating the expression with =. This shows the same result.
We can answer the second question using RPL by typing 6, 0, ENTER, 5,
ENTER, 1, 0, 0, ×, ÷, sin⁻¹ (🟨 J). The result is shown as
6.89210 25793 5 °
. This is an example of unit object: the value is
associated with a unit, in that case the °
symbol indicating that we use
degrees. DB48X supports three other angle modes, radians, grads and fractions of
pi (piradians).
Answering the same question using algebraic mode introduces a new little keyboard trick. Type '(), sin⁻¹, 6, 0, ÷, '(), 5, ×, 1, 0, 0, ENTER, and then evaluating the expression with the = key. Observe how the second use of the '() key, which inserts parentheses when used inside an expression.
Selecting display modes
The scientific notation may not be the most readable in that case. How do we display this result with three digits? We will use a menu for that. Menus are an essential component of the DB48X user interface.
Let us type 🟨 O (Disp). This shows the DisplayModesMenu
. The menu
occupies three rows at the bottom of the screen, with six columns. Menus can
give a quick access to 18 functions directly, six more with a single shift 🟨,
and yet another six with the second shift 🟦. Hitting the shift key 🟨
repeatedly will highlight the different rows of the menu.
On the lower row of the menu, the second entry from the left is labeled Fix
.
The Fix
display mode shows a fixed number of digits after the decimal
separator. There are other modes, Sci
to display in scientific notation, Eng
to display with engineering multiples (the exponent is a multiple of three), and
Sig
to display at most a given number of digits.
We can type 3, F2, where F2 is the second key from the left on the top row
of the keyboard. This activates the Fix 3
mode, which shows three digits after
the decimal separator. The display changes to 0.868
for the answer to the
first question, and 6.892 °
for the answer to the second question.
Displaying the on-line help for a function
Since the number of available commands in DB48X is quite high, it is useful to
be able to consult the built-in help. In order to get help on a command, simply
hold the corresponding key until the help shows up. For instance, to get
help about the command under the Std
label, simply hold the F1 key.
This also works for normal keyboard operations. For instance, if you hold the SIN key, you will get the help about the sine command.
You should refer to the on-line help whenever you have a question about a specific command.
Angle operations
The sin⁻¹ command we used previously returns an angle which was shown in
degrees, the default angle mode for DB48X. When applied to angles, the Cycle
command on the ×10ⁿ key cycles between various angle units: degrees, radians,
grads and pi-radians, i.e. a number of radians shown as a multiple of π.
The function also alternates between decimal and fractional representations of angles.
In order to access angle-related functions, we can use the Tools key ⚙️ which
invokes the ToolsMenu
command. That command picks up a menu that is suited for
the value on the stack. For angles, this shows the AnglesMenu
, which can be
used to perform angle conversions directly.
We can select the →Deg
command to convert an angle to degrees by hitting the
🟨 F1 key while the AnglesMenu
is active, and similarly for →Rad
with
🟨 F2, and so on. To convert the angle to a Degrees/Minutes/Seconds (DMS)
representation, we can select the →DMS
using the 🟦 F1 key, since that
function is on the second level of the menu.
There is a quick way to manually enter angles in DMS format by using the . more than once during data entry. For example, to enter 10°20′30″, you simply need to type 1, 0, ., 2, 0, ., 3, 0, ENTER.
On the command-line, this shows up as 10°20′30_hms
. Once you hit the ENTER
key, this shows on the stack as 10°20′30″
.
Using . more while on the command-line lets you add fractions of a second, for
example 1, 0, ., 2, 0, ., 3, 0, ., 4, 0, ., 5, 0,
ENTER, which will show on the stack as 10°20′30″4/5
.
You can add or subtract angles directly using normal arithmetic functions. For example, hitting the + key will add angles, correctly adjusting the angle units as necessary.
Complex number operations
DB48X support complex numbers both in rectangular and polar (phasor) form. For example, in our effort to build a plank ramp, we may need more than one plank. How far and how high can you reach if you have a 5 meter plank with a slope of 10 degrees, followed by a 3 meters plank with a slope of 30 degrees?
We can add two complex numbers in phasor form to answer that question.
In order to enter the complex number representing the first plank, we need the
ComplexMenu
, which is activated with the CPLX key (🟨 G). The F1 key
will be used to enter complex numbers in rectangular form, and the F2 key to
enter complex numbers in polar form.
To solve our problem, we simply need to enter CMPLX (🟨 G), then 5, F2,
1, 0, ENTER to enter the first complex number. The stack shows the complex
value as 5∡10°
. We can enter the second complex number using 3, F2, 3,
0, and add the two values using the + key. The result shows as
7.522+2.368ⅈ
, which means that we can reach about 7.5 meters ahead and 2.3
meters above ground.
Unit conversions
If you are living in the United States, having the results in meters might not be convenient. You can use the DB48X built-in units in order to convert the result above into feet, yards or inches.
Select the UnitMenu
with 🟨 5. This shows a catalog of unit categories. We
can select the Length
category using the F4 key. In order to indicate that
our result is in meters, we select the m
unit by hitting F1. Our result now
shows as 7.522+2.368ⅈ m
We can then convert that result in yards by selecting
the →yd
command with the 🟨 F2 key.
You can convert to other units in the Length
units menu the same way. This
menu is too large to fit on the screen, so the F6 key can be use to select the
next page in the menu with more units, such as in
or mm
. Note that DB48X
does not have a NXT
key unlike HP calculators. Instead, when necessary, the
NXT
and PREV
features appear in the menu itself as F6 and 🟨 F6.
Operations on whole numbers
Entering whole numbers
Arithmetic on integers
Changing the sign of a number with +/-
Exact division
Computing on large numbers: 2^40, 25!
Separators to make large numbers more readable
Built-in functions: example of 1/x
Using the shift key
Primary function: 1/x
First shifted function: y^x and square
Second shifted function: Help
The shift annunciator
Invoking the on-line Help
Long-press on a function key
Moving up and down
Following links
Navigating back to a previous topic
Exiting the on-line help
Contextual help
The annunciator area
Battery level
USB vs. battery power
Showing or hiding the date and time
Current state file name
Future direction
Decimal values
Entering a decimal number
Entering a number in scientific notation with ×10ⁿ
Arithmetic on decimal values
Arithmetic on fractions
Cycling between decimal and fraction with ×10ⁿ
Separators for the fractional part
Live separators during number editing
Soft keys and menus
Soft keys
The DISP menu
Effect of shift state on the menu
Submenus
Menu history (Last Menu)
Displaying decimal values
Standard display mode
FIX display mode
Switching to scientific mode
Digits to show for small values
SCI display mode
ENG display mode
SIG display mode
Emulating HP48 standard display
Scientific functions
Square and power
Square root and xroot
Exponential and Log
Exponential and log in base 10
DM42 layout difference: EXP LN instead of LOG LN
Trigonometric functions and their inverse
Functions in menus: example of hyperbolic functions
Using an infinite stack
Showing multiple stack levels
Result vs. other levels
When a result is too large
An example of complicated calculation - The Mach number benchmark
How to proceeed with that computation
Correcting an error in the middle
Saving results for later with Duplicate
Dropping results and cleaning up with Drop
LastArg to recall last arguments
Undo to restore previous stack state
The command line
Editing an object on the stack with Right key
Moving left and right on the command line
Repeating keys: Insert, left, right, delete
Inserting characters in the middle
Deleting characters left and right
Space key on R/S
Command line: entering three numbers at once
The editor menu
Selecting the editor menu
Moving word by word
Moving to beginning and end
Selecting text
Cut, copy and paste
Incremental search
Search and replace
Command line history
Recalling a previous command line
Optimization of command-line space
Exiting the command line
Entering letters and symbols
Alpha mode with Shift Enter
Alpha mode with Long Shift
Transient Alpha mode, upper and lowercase
Shift on digits and operations while in Alpha mode
Shifted characters
2nd shifted characters
White cursor for Alpha mode
C and L cursor indicators in text
Entering names
Executing a command by typing its name
Catalog with + key
Auto-completion
Example: VERSION
What happens if the name is not a command
Multi-line text editor
Multi-line Text editor
Up and down by shifting
Repeat up and down by holding key
Entering text
Entering text with 2nd shift ENTER
The C and L cursors
Mixed operations, e.g. adding text
Multiplying text by a number
Entering an algebraic expression
The ' ()
key
Entering an expression
Evaluating an expression with =
Cursor in algebraic mode
Comparing the sin
key in direct and algebraic mode
Entering parentheses
Automatic elimination of parentheses
Symbolic algebraic expressions
Performing RPN operations on algebraic expressions
Automatic simplification of 0+x
, 1*x
, etc.
The Tools menu
Tools menu on empty stack
Tools menu for a decimal value
Tools menu for an integer
Tools menu for a text
Tools menu for an expression
Computations on complex numbers
The complex menu
Entering numbers in rectangular form
Entering numbers in polar form
Switching between polar and rectangular with Cycle key
Arithmetic on complex numbers
Exact angles and exact computations: 2<45 * 3<90 ^ 8
Functions on complex numbers, e.g. sin
and log
.
Effect of angle mode on display in polar form
Computations on vectors
Entering a vector
The M cursor
Adding and subtracting vectors
Component-wise multiplication and division
Operations between vector and a constant
Component-wise functions: 1/x
The tools menu on vectors
Computing the norm of a vector
The Matrix menu
Computations on matrices
Entering a matrix
Adding and subtracting matrices
Multiplication and division by a constant
Multiplying square matrices
Multiplying a matrix and a vector
Computing a determinant
Computing an inverse with 1/x
Advanced matrix operations
Matrix of complex numbers
Symbolic matrix
Inverse and determinant of 2x2 symbolic matrix
Entering data in lists
Entering a list
Adding elements to a list
Applying a function to a list
Repeating a list (multiply)
Lists containing lists
Computations with based numbers
Entering based numbers
Entering hexadecimal directly with A-F
Logical operations
Setting the word size
Changing to common bases (2, 8, 10, 16)
Changing to an arbitray base
Entering number in arbitrary base
The tools menu on based number
Binary operations
Emulating a 16-bit or 256-bit CPU
The Cycle key on based numbers
Adding a suffix to force a base (DM32 only)
Unit objects
Entering a value with a unit
The units menus
Applying a unit
Converting to a unit
Dividing by a unit
Entering a program
Computing a VAT
Evaluating a program with Evaluate
Modifying a program with LastArg
Modifying a program with Undo
Modifying a program with command-line history
The three roles of the R/S key: Space, =, EVAL
Storing values in global variables
Storing a value in a new variable 'VATRate'
Evaluating a variable
Case insensitivity
Naming a variable on the command line
Using quotes to avoid evaluation
Overwriting a variable value
Expressions containing variables
Storing and modifying programs
Creating a new VAT
command
Evaluating a program by name
Evaluting a program from variables menu
Taking input and computing output
The variables menu
Showing the variables menu
Evaluating a variable with F1
Recalling a variable with shift F1
Storing in an existing variable with xshift F1
Rationale for the difference with HP48
Using variables menu while editing a program
Menus with too many entries
Adding more variables overflows
Going from 6 to 7 entries
No next key, using F6 and shift F6 for next and previous
Saving your state to disk
The system menu
Saving the calculator state
Restoring another state
Merging states
Returning to the calculator
Saving state quickly with xshift-EXIT
Plotting a function
Plotting a wave function sin(x * a) * cos(x * b)
Plotting a polar function
Plotting a parameteric function
Drawing two functions on the same screen
Changing line width
Changing line patterm
The numerical solver
Solving an equation
Expressions that must be zero
Equations A=B
Solving for different variables
Numerical integration
Integrating x^2 from 0 to 1 (exact results)
What happens with 0.0 to 1.0
Integration 1/x from 2 to 22
Comparing with LN(2) - LN(2)
Symbolic expression manipulation
Collecting terms
Expanding terms
General expression rewriting facility
Local variables
Why use local variables
Inserting local variables in a program
Inserting local variables in equations
Localized number display preferences
Changing the decimal separator
Changing the spacing for numbers
Changing the character used for spacing
User interface preferences
Square and rounded menu styles
3-level, 1-level and flat menu styles
Changing result font size
Changing stack font size
Changing editor font size
Changing multi-line editor font size
Comparisons and tests
Truth: True, False, 0, 1
Equality tests
Differences between = and ==
Relational operators
Logical operations (AND, OR, NOT)
More sophisticated programming
Testing with IF THEN ELSE END
Conditional expression with IFTE
Counted loop with START NEXT
Stepping loop with START STEP
Named loop with FOR NEXT
Named loop with FOR STEP
WHILE conditional loop
UNTIL conditional loop
Enjoy the calculator!
Installation
Downloading the software
You can download pre-built versions of the firmware from the releases page of the project (https://github.com/c3d/db48x/releases), or alternatively, you can download the source code and build it yourself.
The pre-built firmware for the DM-42 is split into two components, db48x.pgm
and db48x_qspi.bin
. The built-in help is stored in a file called db48x.md
.
In addition, a file called Demo.48s
contains a few sample RPL programs to
illustrate the capabilities of this new firmware, two comma-separated values
files units.csv
and constants.csv
, which define the units and constants
respectively.
Connecting the calculator to a computer
The DM-42 calculator connects to your computer using a standard micro-USB cable.
System menu
The Setup
menu is displayed by using 🟨 0. This key combination is the same
on the stock DM42 firmware and on the new DB48X firmware, and it contains
similar entries. However, the setup menu entries are not necessarily in the same
order.
On the stock firmware, you need to successively select:
-
System
-
Enter System Menu
-
Reset to DMCP menu
On the DB48X firmware, the required options are both directly available from the
Setup
menu.
Exposing internal storage as a USB disk
The Activate USB Disk
option enables the calculator's USB disk mode, and
exposes 6MB of its internal storage as a regular flash disk that you can access
from your computer as an external disk.
Copying DB48X installation files
The files should be copied as follows:
-
db48x.pgm
anddb48x_qspi.bin
in the root directory of the calculator's USB disk. -
db48x.md
should be placed in a directory calledhelp
. -
units.csv
andconstants.csv
should be placed in a directory calledconfig
. You can customize these files to add your own units and constants.
Copying DM42 installation files
Refer to the SwissMicros installation instructions to install or reinstall the original calculator firmware.
Installing the DB48X QSPI file
To install the QSPI file, select the system menu and then select
the Load QSPI from FAT
menu entry.
The QSPI
in the menu label refers to the file ending with _qspi.bin
. When
upgrading, you should load the new QSPI file first, and only then load the
program file.
Installing the DB48X program file
To install the program file file, select the system menu and
then select the Load program
menu entry.
After loading the DB48X program, the firmware loaded asks you to press a key, and the new firmware automatically runs.
Switching between DM42 and DB48X
Early releases of the DB48X firmware produced a QSPI image file that was capable of running the stock DM42 program file. Unfortunately, this is no longer the case due to space constraints.
Unfortunately, the installation procedure for the QSPI file erases the file
from the flash storage. This makes it relatively inconvenient to switch back and
forth between DB48X and original firmware, since that requires copying the
_qspi.bin
file from your computer every time.
Saving and restoring DB48X state
The DB48X Setup
menu is displayed by using 🟨 0. It contains a State
menu
entry to manage the DB48X state, which includes variables, programs and
preferences.
The State
submenu includes the following options:
Load state
Save state
Clear state
Merge state
Activate USB Disk
Show Disk Info
Types
DB48X, like HP RPL, supports a wide variety of data types.
Integers
The DB48X version of RPL distinguishes between integer values, like 123
, and
decimal values, like 123.
Integer values are represented
internally in a compact and efficient format, saving memory and making
computations faster. All values between -127 and 127 can be stored in two bytes.
All values between -16383 and 16383 in three bytes.
Integers can be as large as memory permits.
Big integers
The DB48X version of RPL can perform computations on arbitrarily large integers,
limited only by available memory, enabling for example the exact computation of
100!
and making it possible to address problems that require exact integer
computations, like exploring the Syracuse conjecture.
Decimal numbers
Decimal numbers are used to represent values with a fractional part. DB48X supports three decimal numbers, using the 32-bit, 64-bit and 128-bit binary decimal representation. In memory, all decimal numbers use one additional byte: a 32-bit decimal number uses 5 bytes, a 128-bit binary decimal number uses 17 bytes.
The 32-bit format offers a 7 digits mantissa and has a maximum exponent of 96. The 64-bit format offers a 16 digits mantissa and has a maximum exponent of 384. The 128-bit format offers a 34 digits mantissa and a maximum exponent of 6144.
The Precision command selects the default precision.
Note that a future implementation of DB48X is expected to feature variable-precision decimal numbers similar to newRPL.
Based numbers
Based numbers are used to perform computations in any base. The most common bases used in computer science, 2, 8, 10 and 16, have special shortcuts. The Bases Menu list operations on based numbers.
Like integers, based numbers can be arbitrary large. However, operations on based numbers can be truncated to a specific number of bits using the WordSize setting. This makes it possible to perform computations simulating a 16-bit or 256-bit processor.
Boolean values
DB48X has two boolean values, True
and False
. These values are typically
returned by operations such as tests that return a truth value.
In addition, numerical values are interpreted as being False
if the value is
0, and True
otherwise. This applies to conditional tests, conditional loops,
and other operations that consume a truth value.
Complex numbers
Complex numbers can be represented in rectangular form or polar form.
The rectangular form will show as something like 2+3ⅈ
on the display, where
2
is the real part and 3
is the imaginary part. The polar form will show as
something like 1∡90°
on the display, where 1
is the modulus and 90°
is the
argument. The two forms can be mixed and matched in operations. The calculator
typically selects the most efficient form for a given operation.
Available operations on complex numbers include basic arithmetic, trigonometric, logarithms, exponential and hyperbolic functions, as well as a few specific functions such as conj or arg. These functions are available in the Complex Menu.
Expressions
Algebraic expressions and equations are represented between quotes, for example
X+1
or A+B=C
. Many functions such as circular functions, exponential, logs
or hyperbolic functions can apply to algebraic expressions.
An expression that contains an equal sign, e.g. sin X + 1 = cos X
, is called
an equation. It can be given as an argument to the solver.
Lists
Lists are sequence of items between curly braces, such as { 1 'A' "Hello" }
.
They can contain an arbitrary number of elements, and can be nested.
Operations such as sin
apply to all elements on a list.
Vectors and matrices
Vector and matrices represent tables of numbers, and are represented between
square brackets, for example [1 2 3]
for a vector and [[1 2] [3 4]
for a 2x2
matrix.
Vector and matrices follow their own arithmetic rules. Vectors are one-dimensional, matrices are two-dimensional. DB48X also supports tables with a higher number of dimensions, but only offers limited operations on them.
DB48X implements vector addition, subtraction, multiplication and division, which apply component-wise. Multiplication and division are an extension compared to the HP48.
DB48X also implements matrix addition, subtraction, multiplication and
division. Like on the HP48, the division of matrix A
by matrix B
is
interpreted as left-multiplying A
by the inverse of B
.
As another extension, algebraic functions such as sin
apply to all elements in
a vector or matrix in turn.
Units
Unit objects represent values with an associated unit. They are represented
using the _
operator, e.g. 1_km/s
, although on display this operator is
shown as a thin space, e.g. 1 km/s
.
Units as implemented in DB48X are modernized compared to what the HP48 implements, and differ from the HP RPL implementation in the following ways:
-
Add recent SI prefixes, Z (zetta), Y (yotta), R (ronna) and Q (quetta) for large scale, z (zepto), y (yocto), r (ronto) and q (quecto) for small scale.
-
Take into account the impact on unit conversions of the revised 2023 definition of the foot.
-
Use exact (fraction-based) conversions wherever possible. This notably matters for the conversions of pre-2023 US Survey units, where the ratio is
1_ft = 1200/3937_m
, which is not well represented using decimal values. -
Add computer-related units, like the
byte
, thebit
, thebaud
, as well as a menu supporting these units. -
In order to support the computer-related units better, also recognize the power-of-two variants, e.g.
1_kiB
is1024_B
. Also recogize theK
prefix in addition tok
.
Units file
The built-in units can be overriden by your own set of units, which is defined
in a CSV file called config/units.csv
in the calculator. CSV stands for "Comma
separated values, and is a common interchange format for spreadsheet data.
Here is an example of file that would let you have a units menu called Money
to convert between various monetary units:
"Money"
"USD", "1_USD"
"EUR", "1.07_USD"
"GBP", "1.24_USD"
"CAD", "0.73_USD"
"AUD", "0.65_USD"
"CHF", "1.11_USD"
-
All values must be placed between quotes. Separators between text values are mostly ignored.
-
Rows in a file containing a single value denote unit menus, unless the value begins with an
=
sign. -
Rows in a file containing two ore more values denote unit menu entries, which will be added to the previous menu.
-
The first column in these rows give the name of the unit as shown in the menu.
-
The second column in these rows gives the definition of the unit.
-
The definition should be reduced to
=
if the first column contains what would be a valid unit expression. For example, to placekm/h
in a menu, use"km/h", "="
sincekm
can be deduced from existing unitm
using the standard "kilo" unit prefix, andh
is an existing unit.
A unit where the value is 1
of the same unit is a base unit. This is the case
for USD
in the example above, which is considered the base units for monetary
exchanges. Units that refer to the same base unit can be converted with one
another. For example, you can convert between GBP
and AUD
because they both
have the same USD
base unit.
The commands ShowBuiltinUnits
and HideBuiltinUnits
indicate if the built-in
uits should be shown after the units loaded from the file. The default is that
when a units file is present, the built-in units are hidden. This only affects
the menus. Built-in units can always be used in expressions if they are typed
manually. However, units loaded from file will be looked up first, so that a
built-in unit can be overriden by the units file, which can be useful if a
definition changes like the US Survey foot changed on January 1st, 2023.
If you build a units file, it is recommended that you do not exceed 17 unit submenus so that all unit categories fit on a single screen.
Cycle command customization
The menu name "=Cycle"
is reserved to define sequences of units that the
Cycle
command (bound to the ×10ⁿ key) will recognize as special. For
example, you can ensure that mm
and in
convert to one another as follows:
"=Cycle"
"in", "mm"
"mm", "in"
"USD", "EUR"
"EUR", "CHF"
"CHF", "USD"
If you do provide a Cycle
customization for a unit, other normal behaviours of
the Cycle
command for units are disabled, notably conversion between various
relevant scales and conversion between fractions and decimal. To force a
particular conversion to happen in decimal, you can override the definition of
the corresponding unit in the units file, for example:
"in", "25.4_mm"
Constants
Constant objects represent named values like Euler's constant e
, the ratio
between circumference and diameter of a circle π
, or the speed of light c
.
They are represented by a name, and have an associated value.
Like units, there are some built-in constants, and additional constants can be
provided by a config/constants.csv
file, which has the same format as
for the units file.
On the command-line, constant names are prefixed with CST, which is a way to distinguish them from normal symbols.
You can edit the constants catalog by recalling its content on the stack using
"config:equations.csv" RCL
, editing the values, and then storing the content
back to disk using "config:equations.csv" STO
.
Infinite results
Some operations such as 1/0
or tan 90 °
are said to produce an
infinite result. Like HP calculators, DB48X can either generate an error or
produce a special result in these cases.
-
If the
InfinityValue
(-22) flag is clear, corresponding to theInfinityError
setting, then the operation generates aDivision by zero
error. Note that the text of the error is different than for Hewlett-Packard calculators, which generate anInfinite result
error. -
If the
InfinityValue
flag is set andNumericalConstants
(-2) flag is clear, corresponding to theSymbolicConstants
setting, then the operation generates the∞
(infinity) constant with the appropriate sign for the result, and theInfiniteResultIndicator
(-26) flag is set. -
If the
InfinityValue
flag is set andNumericalConstants
flag is set, then the operation generates the numerical value associated to the∞
constant with the appropriate sign for the result, and set theInfiniteResultIndicator
flag.
By default, the numerical value of the ∞
constant is set to 9.99999E999999
,
which is significantly smaller than what would actually cause a numerical
overflow, but is easy to read. This value can be
changed in the config/constants.csv
file.
Overflow and underflow
There is a maximum representable value for decimal numbers. This value is significantly larger than on HP calculators. Whereas HP RPL implementations could not represent decimal numbers with an exponent bigger than 499 or smaller than -499, DB48X supports exponents ranging from -2^60 to 2^60 (±1 152 921 504 606 846 976).
An overflow happens if the result would have an exponent higher than the maximum. An underflow happens if the result would have an exponent lower than the minimum. Like HP calculators, DB48X can either generate an error or produce a special result in these cases.
-
If the
UnderflowValue
(-20) orOverflowValue
(-21) is clear, corresponding to theUnderflowError
orOverflowError
setting, then the operation generates aPositive numerical underflow
,Negative numerical underflow
orNumerical overflow
error depending on the computation. Note that the text of the error is different than for Hewlett-Packard calculators, which generate anOverflow
,Positive Underflow
orNegative Underflow
error. -
If the
UnderflowValue
orOverflowValue
is set, andNumericalConstants
(-2) flag is clear, corresponding to theSymbolicConstants
setting, then overflowing operations generate the∞
(infinity) constant with the appropriate sign for the result, and underflowing operations generate a zero value. The operation also sets theNegativeUnderflowIndicator
(-23),PositiveOverflowIndicator
(-24) orOverflowIndicator
(-25) flag. -
If the
UnderflowValue
orOverflowValue
is set, andNumericalConstants
flag is set, then overflowing operations generate the numerical value associated to the∞
constant, and underflowing operations generate a zero value. The operation also sets theNegativeUnderflowIndicator
(-23),PositiveOverflowIndicator
(-24) orOverflowIndicator
(-25) flag.
Undefined
Some operations such as 0/0
are undefined, meaning that there isn't a single
possible answer.
If the UndefinedValue
flag is set, such operations return the constant
?
, and further operations on the value will keep returning the same undefined
result.
If the UndefinedValue
flag is is clear, which corresponds to UndefinedError
being set, such operations will generate an Undefined operation
error.
Library
The Library
is a catalog of frequently used and rarely modified objects that
are stored on disk in the config/library.csv
file.
You can edit it by recalling its content on the stack using
"config:library.csv" RCL
, editing the values, and then storing the content
back to disk using "config:library.csv" STO
.
Equations Library
The equations library is a catalog of common equations that are stored on disk
in the config/equations.csv
file.
You can edit it by recalling its content on the stack using
"config:equations.csv" RCL
, editing the values, and then storing the content
back to disk using "config:equations.csv" STO
.
Release notes
Release 0.7.16 "Clean" - New commands
The focus of this release is on new commands, notably for matrix and vector operations. This release also ships with a DM48X-specific keymap, which fixes a problem with teh file selector on the DM32. The equation library has been extended with numerous equations, but they are not fully validated yet.
Features
con
,idn
andranm
matrix generation commandsArray→
and→Array
commands to convert array to/from stackdot
product andcross
product commands for vectorsDispXY
styled text rendering commandDupDup
command duplicating top item twice- Add a large number of equations to equation library
Bug fixes
- Fix
decimal::to_bignum
for small magnitudes - Return angle unit for
atan2
andarg
commands - The
for
loop on lists no longer ends leaving the debugger active - Interactive stack
DropN
command returns to level 1 - Fix file selector's "New file" on DM32 so that ENTER terminates it
- A few fixes in equations in the equation library
Improvements
- Improve graphical rendering of expressions such as multiplication operators
- doc: Update status
- font: Fix
v
glyph vertical placement, add dot and cross glyphs - ttf2font: Add additional verbose info about source data
- Add
CONSTANTS
as an alias forConstantsMenu
- Replace documentation references to
EEX
with×10ⁿ
- Optimize parsing of real numbers in parentheses
Release 0.7.15 "Teaching" - Bug fixes notably on iOS
This release mostly focuses on issues exposed by the iOS releases. It's a bug-fixes only release.
Bug fixes
- ios: Fix a screen refresh bug delaying the display of computation results
- ios: Increase user-accesssible memory for DB50X to match the DM32
- files: Avoid opening two files when a loaded file contains units/constants
- units: Restrict unit expressions further, e.g. forbid
1_km^s
- build: Do not add unwanted macOS-specific files in release tar files
- build: Remove irrelevant help file from releae tar file
- constants: Fix numerical value for G constant
- tests: Rename
M
demo helper toD
, since we useM
in symbolic tests - makefile: Add
mv
echo to targets doing image comparison - units: Use pi constant in definition of radians unit
- parser: Detect syntax error on
(inv(x))
in non-expression mode - units: Avoid infinite loop for bad unit exponents
- files: Avoid crash in
file_closer
if file does not exist - tests: Add DMS/HMS operations to math demo
- tests: Add keyboard shortcuts to launch the demos
Release 0.7.14 "Kids" - Equation-related bug fixes
This release fixes a number of issues that were discovered primarily through the Columns and Beams equations.
Features
- trigonometrics: Add conversion from non-standard angles, so that
cos(1_turn)
gives the correct result. - debug: Debug on error with
DebugOnError
andKillOnError
settings. This makes it easier to debug an RPL program, by making it possible to single-step around the instruction that generated the error. - tests: Add three 30 second demo of DB48X features. These are to generate marketing videos for the iPhone version on the Apple store (to be done).
Bug fixes:
- ui: Keep a GC pointer in
draw_object
to avoid a memory crash - equations: Add missing units in some equations, e.g.
I
andA
in second equation of Coilumns and Beams - equations: Add explicit
radian
unit in Eccentric Columnscos
, which ensures we get the correct result from the HP50G manual even when in Degrees mode. - units: Correctly factor out non-integral powers, so that we can compute
1/sqrt(epsilon_0*mu_0)
and get the correct result. - catalog: Display commands that begin with selection first, so that
FORE
showsForeground
beforeAlphaForeground
. - stats: When computing a sum, evaluate the expression on all terms. The result
for
Variance
with single variables was wrong because the first term was computed incorrectly due to a misguided optimization. - graphics: Error out in
RGBPattern
for negative input. The negative values were generating an error, but it was not reported, so the next command was likely to report it. - help: Render shift keys correctly in the color version. The bitmap was interpreted as containing color data. Colorize it instead.
Improvement
- ui: Select orange as background color during search. The previous setting of showing seardch using white foreground on a white background was probably pushing the notion of "blind search" a bit too far.
Release 0.7.13 "Murderers" - Solver improvements
This releases focuses on improvements to the solver, with the completion of the Columns and Beams section from the HP50G equation library.
Features
- equations: Add remaining equations from "Columns and Beams"
- loops: For loops on lists and arrays
- menus: Add
R→D
,D→R
,→Polar
and→Rectangular
- menus: Automatically select tools menu for library equations
- units: Allow
ubase
to work on expressions - units: Graphic rendering of units
Bug fixes
- 48calc.org: Fix mouse click position
#ABC #DEF -
now correctly produces a based number with >64-bit wordsize- conditionals: Parse and evaluate
IFTE
correctly - equations: Fix Elastic Buckling
- files: Avoid crash in
file_closer
if file was not open - istack: Enable Swap feature on top two levels
- menu: Update SolvingMenu when updating VariablesMenu
- parser: Deal with negation more "normally", parse
-a²
correctly - solver: Compute units correctly for inputs
- solver: Do not change unit when storing in a solver variable
- solver: Emit correct error message in
EvalEq
if missing variables - solver: Preserve errors reported by underlying function
- units: Do not evaluate/render units with names
- units: No longer read variables
m
ands
while processing1_m/s
- units: Simplify units that convert to real numbers
Improvements
- Update .gitignore
- build: Add BMP files to the distribution
- complex: Optimize exit conditions for parentheses
- solver: Add test for equation library
- solver: Add tests for solving with units
- solver: Improve behaviour of
EvalEq
- solver: Keep units and constants as-is in equation
- solver: Make precision relative to equation sides magnitude
- stack: Show vectors vertically by default
- ui: Do not persistently hide stack with current equation
- units: Keep power integral, i.e. avoid getting
1_m^2.0/s
- units: Strip tags from unit conversion functions
- units: The
EvalEq
command should not evaluate dates - wasm: Add logos to the repository
Release 0.7.12 "Multiply" - Multiple equations
This release focuses on the equation solver, notably in interaction with the equation library. The goal is to get one step closer to the equation library in the HP50G, including the ability to have graphical illustration and multiple equations.
Features
- doc: Add documentation for the equation library
- doc: Add images from HP50G equation library (to be used later)
- doc: Some help for the elastic buckling equations.
- equations: Accept lists of equations in library
- help: Add documentation for the various constants
- help: Do not exit help when opening URLs or missing topics
- lists: Add a setting to evaluate list as programs
- menu: Add menu entries for solver imprecision and iterations
- solver: Add support for multiple equation solving
- ui: Add settings to hide/show empty menus and clear menu on EXIT
- units: Add flow units (per user request) in Fluid section of units
Bug fixes
- blitter: Adjust the right margin
- blitter: Base horizontal adjust on scanline, not width
- characters: Display correct content for built-in menus
- constants: Close current file while parsing values
- constants: Update some outdated values
- doc: Show help for equations and constants
- help: Do not try to load PNG images
- rewrites: Avoid contradictory rules when reordering constants
- solver: Work correctly with units (when in variables but not equation)
Improvements
- build: Shorten the size of the version abbrev
- config: Use config files only for user configuration
- doc: Record performance data about unit conversion
- help: Avoid slowing down when scrolling through pages of help
- help: Record position for history even without a
\n
- simulator: Add tweak to show RPL object details
- tests: Increase wait time for tests with blinking cursor
- units: Do not simplify while in unit mode
Release 0.7.11 "Rest" - Refine interactive stack, graphics in help
This release is a refinement minor release. The primary focus is the interactive stack, which now lets you edit items, sort either according to memory representation or by value, display information about objects, and jump directly to a given stack level using digits.
The simple random number generator implemented in 0.7.10 was replaced with an additive congruential random number generator (ACORN), which can be configured in number of bits and number of iterations. A side effect is that there is now regression testing for single-variable statistics.
The history feature was also improved by automatically enabling the EditMenu
when selecting history, and then having the (unshifted) word left and word right
commands automatically cycle through history if used at beginning or end of the
editing buffer.
Features
- help: Add ability to display BMP images in help files
- images: Convert help images to BMP
- ui: Add
Edit
feature to interactive stack - ui: Add history menu entries to
EditMenu
- ui: Accept
UNDO
while in interactive stack mode - ui: Have word previous/next cycle through history
- ui: Accept digits to select stack level in interactive stack
- random: ACORN random number generator
Bug fixes
- editor: Fix spacing after number followed by
-
sign - ui: Do not set the
editing
field from interactive stack - ui: Replace interactive stack "Edit" with "Echo"
- ui: Block user input while using interactive stack
- ui: Do not draw menu markers when displaying interactive stack
- runtime: Avoid crash running above allocated memory in
move_globals
Improvements
- ui: Reorganize code handling interactive stack keys
- help: Adjust help area to new height for menus
Release 0.7.10 "Hospitality" - Interactive stack
This release primarily adds the "interactive stack" feature of HP calculators.
Features
- stack: Interactive stack and associated menu
- functions: Very basic random number generator
- demo: Add
CountPrimes
andRandomPlot
examples
Bug fixes
- menus: Do not execute if-then-else and similar
- expressions: Avoid error testing for zero/one in power operator
- condidionals: Avoid infinite loop evaluating condition
- menu: Insert
iferr-then-else
correctly from menu - constants: Skip menu entries
Improvements
- menus: Reorganize stack menu to put
Dup
andDrop
on first page - menu: Add error functions to
Debug
menu
Release 0.7.9 "Just Asleep" - Online WASM simulator
This release includes a number of bug fixes, facilitates build from scratch by third-parties, and delivers a WASM-based simulator that runs on the https://48calc.org web site.
Features
- menu: Add
Purge
to theClearThingsMenu
- purge: Add support for lists
- units: Accept units for
sqrt
,cbrt
andxroot
- wasm: Add variant for
48calc.org
- wasm: Implement WASM support
Bug fixes
- complex: Give
Syntax error
for phasor without an angle - dms/hms: Parse empty numbers in DMS entry
- dms/hms: Protect display against bad input
- editor: Make sure we reposition after shift-up and shift-down
- parser: Parse degrees as an angle unit in phasors
- simulator: Avoid high CPU usage when a timer is active
- simulator: Use the correct color for firmware text
- ui: Compute the correct refresh rate even when nothing is displayed
- ui: Create a non-empty dirty rectangle when clearing annunciators
- ui: Do not refresh beyond LCD size
- ui: Ensure we redraw the shift region to clear busy
- units: Disable simplification during unit definition evaluation
Improvements
- build: Fix the clean build
- object: Remove defaults for
as_uint32
and similar - parser: Cache parser::length when possible
- parser: Merge the
parser::end
andparser::length
fields - parser: Optimize integer parsing early exit
- simulator: Avoid
Cancel
in file save dialog - simulator: Use
https
as a protocol for git submodules - tests: Add support for degrees sign
- tests: Add test for polar angle conversion.
- units: Add
factoring
variable to limit simplifications - wasm: Add link to deployed WASM simulator in the README
- wasm: Add script to add COOP / COEP headers
- wasm: Run the RPL thread in a separate thread
Release 0.7.8 "Mustard" - Constants in equations
This release keeps marching towards full support for an equation library. The primary focus was support for constants in equations, including constants with units like the speed of light, as well as fixing various user-reported issues.
Features
- cycle: Apply to value of tagged object
- equations: Add units to built-in equations
- equations: Adjust menu label to remove units
- equations: Strip units but not constants when rendering
- expressions: Treat
2X
as an implicit product - solver: Strip units from constants
- units: Unit prefix should preserve the tag
Bug fixes
- clearlcd: Fix erasure of screen when not in graphics mode
- constants: Count number of menu entries correctly for builtin menus
- decimal: Accept leading
.
or,
for decimal values - expressions: Parse negation after parentheses
- sum: Do not accept a non-name in a sum or product
- type: Return a type value for decimals
- ui: Fix insertion/editing of infix with alphabetic names
- units: Do not read units from variable if they exist
- xroot: Reverse
xroot
arguments in algebraic parsing
Improvements
- editor: Shuft-up returns to beginning of line if on first row
- errors: Add
error_save
class, use it inconstant::value
- expressions: Use the
SaveAutoSimplify
class insimplify_products
- units: Split
Eng
toElec
andVisc
Release 0.7.7 "Forgiving" - Units in equations
This release keeps marching towards full support for an equation library. The primary focus was support for units in equations.
New features
- solver: Accept equations in solver menu
- solver: Add shortcut to solve an equation from the library
- solver: Display the current equation above the stack
- solver: Solve expressions containing units
- solver: Add units for solver variables when entering them
- equations: Add option to list variables with units
- programs: Enforce numerical values for solver / plotter
- constants: Implement programmatic lookup
- fonts: Add support for fixed-width digits
- keyboard: Interpret
ASN
asAsNumber
(convert to decimal) - complex: Allow insertion of angle while entering phasors
- complex: Implement auto-complex promotion
- graph: Render abs(X) with bars (e.g. |X|)
- functions: Automatic simplification of expressions
Bug fixes
- arithmetic: Avoid null-dereference in complex operations
- help: Close help file if topic not found
- solver: Do not store tag for tagged values
- graph: Gracefully fallback if fraction integral part does not render
- units: Avoid null-dereference if unit simplification fails
- units: Count parentheses while parsing units
- put: Fix null-dereference checking the index
- fractions: Do not render two negative signs in graphical mode
Improvements
- cycle: Update behaviour for several data types
- menu: Replace
abs
with|z|
in complex menu - ui: Micro-optimization to avoid reading object type twice
- parser: Accelerate and improve object parsing
- recorder: Add recorder entries for evaluation
- build: Remove any leftover references to Intel decimal library
- tests: Add
▶
entry in tests - tests: Increase default wait time to 1000ms
- tests: do not error out if
teval
takes less than 100ms - equations: Rename
PerfectGas
equation toIdealGas
- menus: Adjust size of menus to make descenders visible
- solver: Replace
SolverPrecision
withSolverImprecision
Release 0.7.6 "United" - Equation Solving Menu
This release is primarily about implementing a dynamic solving menu that makes it easier to solve equations with multiple variables. This is roughly equivalent to the "Solve Equation" application in the HP50G.
New features
- solver: Implement solving menu
- tag: Graphic rendering for tagged objects
- lists: Implement
lname
andxvars
commands - arithmetic: Implement
div2
command - variables: Implement
vars
andtvars
commands
Bug fixes
- render: Avoid errors while rendering / graphing
- expressions: Avoid consuming stack levels for invalid expressions
- symbols: Avoid ignoring the list of bad characters in symbols
- command: Fix for
x!
parsing - stack: Correctly set clipping for stack index
- doc: Fix typo in release note
Improvements
- menus: Add
PixOn
,PixOff
,Pix?
andPixC?
toGraphicsMenu
Release 0.7.5 "Perfect Joy" - Polynomials and symbolic rewrites
This release contains a lot of groundwork in preparation for future work on
symbolic expressions, symbolic solving and symbolic integration, as well as to
improve compatibility with HP calculators. In particular, rewrite
has been
replaced with the HP equivalents, ↑Match
and ↓Match
, allowing top-down and
bottom-up replacement, as well as support for conditions. Also, these commands
return the number of replacements performed instead of just 0
or 1
.
THe other major user-visible new feature is the addition of a polynomials data
type, which does not exist on HP calculators, exposing polynomial features in a
way that is more consistent with the spirit of RPL. For example, Euclidean
division of polynomials can be achieved using the regular /
operation on
polynomials instead of requiring a dedicated DIV2
command.
New features
- Support for polynomials as a data type, including Euclidean division
- Arithmetic operations on polynomials, including
sq
andcubed
- Conversion functions
→Poly
andPoly→
to convert to and from polynomials - Optional case-sensitive symbol matching
- Algebra configuration directory (like
CASDIR
on HP calculators) - rewrites: Replace
rewrite
command with HP-compatible↑Match
and↓Match
- rewrites: Add
ExplicitWildcards
option to match HP syntax (&A
) - rewrites: Add rules to expand powers
- rewrites: Add support for conditions when matching patterns
- rewrites: Add support for step-by-step rewrites
- rewrites: Add support for bottom-up rewrites
- flags:
Purge
now resets system flags to default value
Bug fixes
- editor: Fix unresponsive keys after using
EXIT
key while searching - complex: Avoid emitting syntax errors while parsing
- rewrites: Avoid potential garbage collection corruption problem
- rewrites: Disable auto-simplification during rewrites
- rewrites: Factor out rewrite loop
- expressions: Encode expressions with type ID >= 128 correctly
- arithmetic: Add space around
mod
andrem
in rendering - graph: Do not add parentheses for
X*(Y/Z)
- functions: Make percentage operations binary functions
- functions: Turn
min
andmax
into algebraic functions - cycle: For expressions, cycle graphic/text rendering correctly
- menus: Replace
EquationsMenu
withExpressionMenu
in other menus - ui: Insert space when inserting array inside function
Improvements
- menus: Updates to
PolynomialMenu
to enter polynomials and for conversions - menus: Add product and sum to symbolic and algebra menus
- menus: Make
ToolsMenu
selectSymbolicMenu
for symbols - expressions: Reorganize the code for rewrites
- rewrites: Add recorders for rewrites that are actually done
- tests: Some adjustments on color images
- rewrites: Convert algebraics into expression as needed
- complex: Parse
3i
andi3
in addition toi
- tests: Add support for more characters
- simulator: Separator color and dm32 support
- graph: Add space when rendering simple function
- keyboard: Updated SVG files with latest menu labeling changes
Release 0.7.4 "Flesh" - Polishing and refinements
This release is mostly about polishing various aspects of the
implementation to make it more convenient and more efficient. It also
adds user-defined functions parsing and evaluation, pixel-manipulation
commands, bit operations on binary numbers, memory operations like
sto+
or incr
, loading and saving BMP files, color support in the
simulator, and more.
New features
- editor: Implement configurable word wrapping
- expressions: Add code for n-ary functions like
sum
- expressions: Parse user-function calls like
F(1;2;3;4)
- expressions: Ensure funcall objects are evaluated immediately
- functions: Add
sum
andproduct
functions - functions: Add combinations and permutations
- functions: Implement number rounding operations (
rnd
andtrnc
) - graph: Add graphical rendering for
cbrt
(cube root) andxroot
- graph: Graphical rendering of combinations, permutations
- graph: Graphical rendering of sum and product
- graphics: Add
pixon
,pixoff
andpix?
commands - graphics: Store and recall BMP files with
sto
andrcl
- graphics:
ToGrob
command converting object to graphic - logical: Add
SetBit
,ClearBit
andFlipBit
commands - memory: Implement the
Clone
(NewOb
) function - menus: Add
log2
andexp2
toExpLogMenu
- menus: Place
ListMenu
as a keyboard-accessible menu - parsing: Parse n-ary functions
- program: Add vertical program rendering mode
- stack: Display error message emitted during stack rendering
- ui: Add colorization parameters for the user interface
- ui: Add some colorization
- variables: Add
Sto+
,Rcl+
and other variable arithmetic - variables: Implement
Increment
andDecrement
Bug fixes
- decimal: Fix precision when computing gamma/lgamma
- decimal: Fix rounding bug when rounding increases exponent
- doc: Add missing dependencies on Fedora (submitted by @vkadlcik)
- files: Do not error when opening constants/equation/library files
- files: Open only one configuration file at a time
- graphics: Fix bug drawing a line of width 0
- graphics: Use foreground color for parenthese and ratio
- lists: Separate list sum/product from regular sum/product
- renderer: Make sure
printf
respects target buffer size - simulator: process double-clicks correctly (submitted by @kjellc)
- tests: Change the height of ignored header
Improvements
- command: Factor out arity for all commands
- constants: Report parse error location for invalid constants
- demo: Add HP-48 style slow walk to
Walk
demo - demo: Modernize the code a little
- demo: Modify performance benchmarks to use
TEval
- demo: Replace imaginary unit constant
- doc: Remove reference to Intel Decimal Library
- files: Convert all file names to lowercase (Linux support)
- functions: Make it possible to interrupt a running sum/product
- graph: Improve rendering of
exp
,exp2
,exp10
- graphics: Separate color conversion step
- help: Do not display command name while editing
- ids: Make room for a few additional 1-byte commands
- locals: Document the absence of compiled local variables
- makefile: Add configuration files to the release
.tgz
file - parsing: Make the error message for sub-expressions more local
- readme: Remove reference to DM42 from top-level readme
- simulator: Avoid crash rendering %t in recorder
- simulator: Convert simulator code to support color
- simulator: Replicate open files limitations
- simulator: Separate db50x and db48x builds
- tests: Add colorized images to testing
- tests: Avoid occasional errors on some long-running tests
- ui: Define cursor position in
SelfInsert
with\t
- ui: Ignore EXIT, BSP and ENTER keys when clearing error
Release 0.7.3 "Perfume" - Mostly bug fixes
This release is mostly about bug fixes, improving the build on simulator, and accelerating the test suite while keeping it stable.
New features
- simulator: Add F8 key to save state in the simulator
- errors: Add a beep when an error is shown
- linux: Add
-s
option for screen scaling (when Qt gets scaling wrong) - equations: Get library equation value for plotter, solver and integrator
- characters: Add constant, equation and lib markers to RPL menu
- characters: Add music-related characters and character menu
- commands: Add missing stack commands (nip, pick3, ndupn, unrot, unpick)
Bug fixes
- variables: Clone purged objects on stack after
Purge
- units: unit * symbolic is preserved as is (e.g.
'A'_m
) - compare: Enforce the
NumericalResults
flag for comparisons - constants: Fix parsing of constants, equations and library items
- sto: Repair
file exists
error storing to a source file - simulator: Do not try to create directory if it exists
- Report file errors, e.g. permissions or I/O errors
- equations: Mark
c
andR
as constants in equations - simulator: Double clicks are now considered as virtual keyboard touches
- ui: Emit only one beep, not two, for a syntax error on the command line
- ui: Avoid rare null-dereference crash when menu label is not set
- complex: Report a syntax error if the second half is empty
- utf8: Do not accept constant/equation/library codepoint in names
- units: Multiplying by
1_m
is OK even with algebraic - tests: Avoid case where CLEAR does not clear errors
- audio: Improve audio reliability on the simulator
- linux: Rewrite the audio-generation code to avoid crashes
- linux: Avoid infinite recursion in the tests
- linux: Fix warnings about unused variables
- linux: Avoid warnings about null pointer in strcmp
- linux: Avoid build error due to bad
ularge
overload in settings - linux: Fix type issue for the Insert function (reported as a warning)
- linux: Remove warning about mixing enums and integers
- linux: Avoid error on printf format
- linux: Avoid warnings about type qualifiers
- linux: Remove warnings about incompatible function casts
- linux: Address warnings about missing initializers
- linux: Fix warning about prinf formats
- linux: Address warning about signed vs unsigned
- linux: Remove warning about fall-through switch statement
- linux: Remove warnings about unused arguments
- tests: Repair several tests that were unstable due to scrolling images
- tests: Increase memory size to avoid occasional out of memory failures
- object: Make
as_uint32
andas_uint64
consistent for negative input
Improvements
- ui: Emulate HP48/HP50G behavior for errors (do not require key to continue)
- simulator: Add I/O wrapper around file state save/restore
- dmcp: Remove double return in the code
- simulator: Accept numeric keys in DMCP menus
- doc: Add Kjell Christenson to list of authors
- tests: Run command-line tests silently
- tests: Clear settings the fast way for quick tests
- dmcp: Do not treat the buzzer as a recorder error (avoid message noise)
- simulator: Ensure error messages show up in a recorder dump
- tests: Increase memory size to avoid failing tests
- tests: Increase delay waiting for function plots to appear
- tests: Refactor test suite interaction with RPL thread to accelerate it
- tests: Add a delay before launching the test thread to load initial state
- tests: Add missing reference picture for
char-menu
Release 0.7.2 "Light" - Libraries, Characters menu
This release introduces four relatively significant features:
- An Equation Library
- A more general Library
- Character menus
- A character modification catalog
There are also a number of bug fixes and improvements.
Features
-
The Equation Library is similar in principle to what is found in the HP50G. It is intended to store equations covering a variety of topics. The Equation Library is accessible using the EQS key (🟦 '()'). It is presently only very sparsely populated, but a future release should add the equations listed in Chapter 5 of the HP50G Advanced User's Reference Manual. Elements of the Equation Library appear as named Equation Objects. The Equation Library is configured by file
config/equations.csv
. -
The Library is similar to the Equation Library, but for all kinds of objects such as programs or code snippets. The Library is accessible using the LIB key (🟦 VAR). It can be used to customize your calculator, and is intended to play the roles of the
CST
variable (quick access to common features) and Library Objects / XLIB (external extensions to RPL). Elements of the Library appear as named Library Objects. The Library is configured by fileconfig/library.csv
. -
The Characters Menu lets you enter Unicode characters easily, by presenting various classes of characters, such as
RPL
,Greek
orPunct
. The Characters Menus is accessible using the CHAR key (🟦 2). It can be used to enter international characters (e.g. Greek or Cyrillic), as well as special characters such as arrows or blocks. The Characters Menu is configured by fileconfig/characters.csv
. -
The Characters Catalog appears when the
Catalog
is active and the cursor is inside some text object. It gives you access to characters that are visually close to the character on the left of the cursor. For example, after typingA
, the presented choices includeÀ
,a
orα
. The Characters Catalog is configured by fileconfig/characters.csv
. -
compare: Add comparisons for
true
andfalse
values -
Add
TEVAL
command (timed evaluation)
Bug fixes
- Do not add unnecessary parentheses in ratios, e.g.
(A+B)/(X-Y)
- Make sure we can save back the configuration files correctly
- Improve access path checks to accept
config:constants.csv
. - Avoid syntax error in
1/(1+x)
due to1/
being seen as a fraction - unitfile: Remove slight risk of bad menu display after garbage collection
- date/time: Make sure we save the stack and last args for
Date
,Time
, ... - parser: Skip spacing when parsing numbers (to parse back
→Text
result) - time: Fix rendering of DMS time in lists, matrices, vectors
- catalog: Fix a subtle bug on DM32 leading to a crash using the catalog
Improvements
- constants: Get values of special
π
ande
by name - constants: Add prefix in editor to identify constants, equations and xlib
- constants: Represent constants with an index for memory and performance
- constants: Parse units containing text
- constants: Allow
RCL
to recall a constant value - units: Direct insertion of units after numbers
- menu: Update
Roll
andRollDown
menu entries - show: Show all decimals for decimal values
- help: Display the correct on-line help topic for constants
- catalog: Use less memory for the sorted IDs
- integrate: Use numerical computations for faster convergence
- locals: Improve error message for bad locals
- graph: Improve graphical rendering of constants (bold) and equations
- graph: Do not add unnecessary parentheses in ratios
- tests: Add tests for characters menu/catalog
- tests: Fix the
.
vs0.
test - ui: Do not enter DMS inside text
- tests: Display disabled tests in gray
- catalog: Keep a single spelling, e.g. no
add
duplicates - tests: Add extra delay in the wait for update
- makefile: Add dependency of 'all' to the decimal constants
- save: Improve rendering control when saving files
- stack: Do not save stack in plot, integration or solver
- debug: Disable debugging when launching a program from function key
- simulator: Avoid piling up QT draw requests
- doc: Update performance numbers for 1M loops
- simulator: Add sound support
- simulator: Lazy screen refresh
- dmcp: Add UI refresh callback
- simulator: Move QT-dependent code out of dmcp.cpp
- Add reduced font
- runtime: Various changes to isolate QT build from the rest
Release 0.7.1 "Whip" - Bug fixes
Inserting variables, constants or units in a program was broken. Also a few less critical fixes.
Bug fixes
- decimal: Apply
MinimumSignificantDigits
toSig
modes - tests: Fix missing
]
at end of vector - ui: Insert commands for unit conversions, constants and variables
- tests: Adjust help screen snapshot for authors
- menus: Do not clip text for hierarchical menus
- constants: Do not use units that don't parse correctly
- dmcp: Day of week convention adjustment
- help: Fix YouTube video preview
Release 0.7.0 "Temple" - Graphics Equation Rendering
This release introduces a few major improvements, including graphical
rendering of equations and matrices, the Show
command to display
large objects full-screen, customizable constants, and date-related
operations.
New features
- Graphical rendering of equations, fractions, matrices, vectors and lists. In graphical rendering mode, variables are showin in italics.
- Constants in the
ConstantsMenu
, split into categories, and loading from an optionalconfig/constants.csv
file, in a way similar to what existed for units. - Inverse trigonometric functions (
asin
,acos
andatan
) now produce unit objects with the current angle mode as a unit. This can be configured by theSetAngleUnits
/NoAngleUnits
flags. Cycle
(×10ⁿ key) now cycles between angle units.R→D
andD→R
commands to convert between degree and radian in a purely numerical way (no unit). This is for compatibility with HP.- Add
→Deg
,→Rad
,→Grad
,→πr
commands, which convert a number to the target unit using current angle mode, and convert an angle to the target angle unit. - Conversion from DMS to HMS and from HMS to DMS
- Rendering of dates:
19681205_date
renders asFri 5/Dec/1968
, with a format configuration using the same flags as for the header. Note that the date format isYYYYMMDD
, not the same as on HP calculators. This allowsYYYYMMDD.hhmmss
for dates with time. Date
andTime
command to return the current date and time. Additionally,DateTime
returns both date and time, andChronoTime
returns the time with 1/100s precision.→Date
and→Time
commands to set the system date and timeDate+
,DDays
and date arithmetic using+
or-
, using day units for the results. As an extension relative to HP calculators, these will accept fractional days, or other time units. For example, adding1000000_s
to19681205_date
generates a date with time result,Tue 16/Dec/1968, 13:46:40
JulianDayNumber
andDateFromJulianDayNumber
commands to convert between dates and Julian day numbers. These commands also accept fractional input.Show
command showing a full-screen graphical rendering of the result on the stack. The resut is size-adjusted. For example, you can display all digits in200!
. If the result does not fit on the screen, you can scroll using the ◀︎ and ▶︎, as well as 8, 6, 4 and 2. The maximum pixel size forShow
is set byMaxW
(default is the width of the LCD), the maximum height is set byMaxH
(default is 2048 pixels).AutoScaleStack
andNoAutoScaleStack
settings to automatically adjust the font size for the stack elements.- Support for system flags -20 to -26 (infinite results, overflow and underflow).
Bug fixes
- simulator: Adjust DMCP month off-by-one error
- Repair insertion of
while
loops and similar commands on the command line - Use stack format when drawing an object with
DrawText
(DISP
) - Arithmetic on unit objects no longer auto-simplifies, e.g.
1_s 1_s -
returns0_s
and not0
. - Perform computations for
→Q
using integer values, which avoids an issue where increasing the number of iterations with an unachievable precision could prodduce1/1
as the fractional result. - Repair auto-simplification for
i*i=-1
- Display a negative mixed fraction as
-1 1/3
and not1 -1/3
. - Do not insert
()
after a multiplication in algebraic mode - Accept units and tagged objects in
PolarToReal
andRealToPolar
- Accept angle units as input for
→DMS
- Off-by-one clipping error in header, erasing the shift annunciator
- Fix help for
FC?
(incorrectly stating that it tested for flat set) - Lookup units and constants in a case sensitive way
- Fix labels for
ExpFit
andLinFit
inRegressionMenu
.
Improvements
- tests: Adjust tests to match bugs fixed in v0.6.5
- dms: Accept entering minutes without third dot, e.g.
1.2.3 ENTER
- menus: Split the Time, Date and Alarm menus
- Split rendered objects at space boundaries. This notably ensures that large numbers are split at digit grouping boundaries, and makes it possible to display larger programs on the stack. The rendering of programs and matrices/vectors/lists has also been fine-tuned.
- The "white circle" glyph has a thicker border, makes it more readable in menus.
- doc: Update the list of unimplemented features
- menus: Draw a white circle for disabled flags, and allow the menu function to toggle the flag. This made it possible to reduce the number of menu entries for flag-heavy menus.
- Mixed fractions are now the default, as opposed to improper fractions
- doc: Improve the quickstart guide
- doc: Improve the documentation for sin, cos and tan
- tests: Make it possible to interrupt a running test
- help: Skip HTML tags, e.g.
- simulator: Add screenshot capability, and reduce window height
- menus:
ToolsMenu
selects time, date or angle menu based on units
Release 0.6.5 "Testimony": Small bug fixes
This release does not contain much because FOSDEM took a lot of energy.
New features
- menu: Connect
ceil
andfloor
functions - Add real to polar conversions
- units: Add
dms
unit to angles menu
Bug fixes
- decimal: Compute
ln(0.002)
correctly - integer: Do not parse degree sign if in a complex
- units: Fix parsing of angle units
- font: Add radian glyph
Release 0.6.4 "Healing": Testing and fixes
This release focuses on heavy testing of the new variable-precision decimal stack. Adding tests also means finding bugs.
Another significant change is support for fixed-precision hardware-accelerated floating point, using 32-bit and 64-bit IEEE754 binary floating-point representation. Since this uses a binary format, some decimal values do not map to decimal correctly. For example, displaying 1.2 with a large number of decimals will show residue, because 1.2 does not have an exact (zero-terminated) representation in binary.
New features:
- plotting: Make refresh rate configurable
- menu: Add
/
key toFractionsMenu
- hwfp: Add support for hardware-accelerated floating-point
- menus: Add hardware floating-point flag to
MathModesMenu
- ui: Allow multiple uses of
.
to insert DMS separators - HMS: Editing of HMS values in HMS format
Bug fixes:
- stats: Fix crash on
variance
with single-column statistics - algebraic: Clear error before evaluating the function
- functions: Correctly emit a type error for non-algebraics
- ui: Make sure we save stack if closing the editor
- logical: Fix mask for rotate left with 64-bit size
- logical: Make sure we save args for single-argument logicals
- flags: Update flags on
FlipFlag
, consume them fromBinaryToFlags
- stack: Show multi-line objects correctly
- lists: Returns
Bad argument value
for index with bad arguments - lists: Return an empty list for tail of empty list
- arithmetic:
→Frac
should not error on integers - power: Do not shut down during
WAIT
if on USB power
Improvements:
- menu: Shorten the labels
→QIter
and→QPrec
to avoid scrolling - stack: Avoid running same code twice on simulator
- ids: Add aliases for hardware floating point
- functions: Optimize abs and neg
- ui: Replace calls to
rt.insert
with calls toinsert
- menu: Reorganize fractions menu
- dms: Do the DMS conversion using fractions
- list: Adjust multi-line rendering
- copyright: Update copyright to 2024
- text: Return null text when indexing past end of text
Testing:
- tests: Increase the delay for help to draw
- tests: Add tests for hardware-accelerated floating-point
- tests: Add shifts and rotate tests
- tests: Check flag functions
- tests: Test DMS and HMS operations
- tests: Add test for
integrate
using decimal values - tests: Test multi-line stack display
- tests: Add tests for
GETI
- tests: Min and max commands
- tests: Repair last regression test
- tests: Check behaviour of 0^0
- tests: Avoid string overflow in case of very long message
Release 0.6.3 "Come and See": Repair test suite
The focus of this release was to reactivate the test suite and fix the problems that were found activating it.
New features:
- HMS and DMS operations
- unit: Rendering of
dms
andhms
units - Allow
·
as a multiplication sign in equations - ui: Display 'E' cursor inside parentheses
- graphics: Accept based integers as position for
DrawText
- complex: Add setting to switch between
2+3i
and2+i3
.
Bug fixes:
- decimal: Fix precision loss for addition with carry
- Base: limit range of bases to 2-36
- files: Do not add a trailing zero when reading a text file
- decimal: Adjust
MinimumSignificantDigits
behaviour - units: Do not auto-simplify
1.0
during conversion - decimal: Normalize parsed numbers
- solver: Fix sign error in epsilon exponent for solve/integrate
- parser: Accept
x!
as input - simulator: Avoid faulty break-through in switch statement
- complex: Make tag higher-priority than complex
- editor: Adjust cursor and select correctly during replace
- decimal: Fix display of 0.2 in NoTrailingDecimal mode
- complex: Save
this
in a GC pointer when it can move - arithmetic: Do not fail because of surrounding error
- decimal: Clamp int32 conversions from decimal
- commands: Parse
exp10
correctly in expressions - decimal: Avoid infinite loop computing
expm1
- ids: Do not allow parsing of structures
- dmcp: Make sure the tests don't block on
wait_for_key
- decimal: Use correct angle unit for negative gamma values
Improvements:
- settings: Add classes that save/restore a given setting
- Add
XSHIFT
to shift to XSHIFT state directly - Add NOSHIFT constant to simplify test writing
- ui: Add a variant of
close_editor
without trailing zero - decimal: Cache gamma_ck values (accelerate gamma and lgamma)
- Replace magic constant
-1
withEXIT_PGM
- doc: Record performance data for 1000 iterations of SumTest
- decimal: Add tracing for gamma / lgamma function
New tests:
- Add tests for arithmetic truncation on short bitsizes
- Add tests for on-line help
- Add test for plotting flags
- Add test for Unicode to text conversions
- Add test for rectangular complex display options
- Add tests for plot scaling functions
- Add tests for the sorting functions
- Add test for parsing text with quotes inside
- Add test for file-based
STO
andRCL
- Add test for 2^256 computation (buf #460)
- Fix indentation of
[PASS]
or[FAIL]
for UTF8 characters - Add tests for units and conversions
- Add a keyboard test checking the single-colon insert in text
- Add test for i*i=-1 auto-simplification
- Add basic test for numerical integration
- Add test for fraction formats
- Add solver test
- Add missing tests
- Add test for immediate
STO
(#390) - Add tests for the
Cycle
command - Add test for catalog feature
- Add test for "smart" keyboard shortcuts introduced in 0.4.6
- Add regression test for #371
- Add tests for editor operations
- Test stack operations
- Add test for
GXor
,GOr
andGAnd
- Add test for
ResetModes
- Add plotting test for every decimal function
- Add image checking for graphical tests
- Add tests for graphic and text drawing commands
- Make it possible to individually run tests.
- Add plotting tests
- Add test parsing the various spellings for commands
Release 0.6.2 "Kephas": Restoring the test suite
The focus of this release was to complete the transition to the
variable-precision decimal code. The full regression test suite was
restored, with only two tests still failing (complex asin
and
asinh
). The two missing functions, Gamma
and LogGamma
, were
implemented. This also exposed many bugs that were fixed.
New features:
NumberedVariables
setting to allow0 STO
to ease RPN transcoding (#690)ClearStack
(CLEAR) command- Variable-precision
gamma
andlgamma
functions (#710)
Bug fixes:
- Do not leave bad expression on stack after error (#663)
- Reject unit conversion between undefined units (#664)
- Accept names of menus on the command line (#669)
- tests: CLEAR clears stack and errors (#672)
- The
:
characters now starts a tag on empty command line (#673) - Do not evaluate tagged objects too early (#674)
- test: Entry and editing of equations (#677)
- test:
type
returns negative values in "detailed" mode (#678) - Run loop end pointer not GC-adjusted for last allocated object (#679)
- Do not erase alpha indicator when clearing busy cursor (#680)
- Do not emit trailing space when rounding
1.999
to2.
(#687) - Allow expression rewrites to deal with
pow
(#694) - Reject
«
character in symbols and commands (#695) - Rendering of spacing for decimal numbers (#699)
- Improve precision of
atan
function - Rendering of
+
and-
operators in compatibility modes (#700) - Rounding of decimal numbers no longer generates bad characters (#702)
- No longer error out rendering symbolic complex (#703)
- Parse complex numbers correctly inside equations (#704)
- Ensure
sqrt(-1)
has a zero real part (#705) - Do not drop last digit of decimal subtraction (#706)
- Evaluate expressions during expression pattern matching (#708)
LastMenu
executes immediately while editing (#711)- Add back missing angle glyphs in font (#712)
- Return correct angle quadrant for
atan2
(#715) Get
no longer rejects arrays as index values (#718)Get
returns correct error for bad argument types (#718)
Improvements:
- Update
.gitignore
entry - Automated testing of setting flags (#657)
- Automated testing of non-flag settings (#670)
- Test fixed-base based numbers using HP-compatible lowercase notation (#675)
- Test fraction rendering using fancy digits (#676)
- Add test for "compatible" variant of
type
command (#678) - test: Recover from error during data entry (#681)
- Increase default
MaxNumberBits
to 4096 (#686) - tests: Add test for cube root of -8 (#685)
- tests: Data entry for
Σ
,∏
and∆
(#689) - Restrict
STO
to names, natural numbers and specific IDs (#688) - doc: Document flas file access for
STO
andRCL
(#691) - list: Optimize iterators to avoid copies (#692)
- tests: spacing-independent testing of structure rendering (#693)
- tests: adjust test suite for variable-precision decimals (#696)
- tests: Automatically exit if
-T
option is given (#697) - tests: Check we don't accept
.
as meaning0.
for RPL compatibility - Add
modulus
alias back forabs
(#707) - Improve convergence speed and accuracy for logarithms
- Add
decimal::make
to minimize risk of sign errors - Display stack level at top of stack level, not bottom (#709)
- Improve complex
sqrt
accuracy on real axis (#714) - tests: Test decimal functions at full 34 digits precision (#716)
- Complex
sqrt
andcbrt
with full precision (#717) - tests: Take into account additional expression simplifications
Release 0.6.1 "Happy New Year": Quick bug fixes
A few quick bug fixes that make DB48X a bit more usable.
New features
- Setting to display
2+i3
instead of2+3i
(#660) - HMS and DMS operations (#654)
- Special
1_dms
and1_hms
units rendering in DMS / HMS (#650)
Bug fixes
- Improve behavior of
+/-
key while editing (#658) - Do not accept base 37 (#656)
- Insert
for
statement in program instead of executing it (#655) - Hide trailing decimal separator for decimals with integer values (#653)
- Fix display of
19.8
with0 FIX
(#652) - Implement true decimal to integer conversion (#648)
Improvements
- doc: Record performance data for 0.6.0
- doc: Udpate status file
Release 0.6.0 "Christmas": Introducing variable precision
This release was a bit longer in coming than earlier ones, because we are about to reach the limits of what can fit on a DM42. This release uses 711228 bytes out of the 716800 (99.2%).
Without the Intel Decimal Library code, we use only 282980 bytes. This means that the Intel Decimal Library code uses 60.2% of the total code space. Being able to move further requires a rather radical rethinking of the project, where we replace the Intel Decimal Library with size-optimized decimal code.
As a result, release 0.6.0 introduces a new table-free and variable-precision implementation of decimal computations. In this release, most operations are implemented, but some features are still missing (e.g. Gamma function). This release will be simultaneous with 0.5.2, which is functionally equivalent but still uses the Intel Decimal library. The new implementation is much more compact, allowing us to return to normal optimizations for the DM42 and regain some of the lost performance. On the other hand, having to switch to a table free implementation means that it's significantly slower than the Intel Decimal Library. The upside of course is that you can compute with decimal numbers that have up to 9999 digits, and a decimal exponent that can be up to 2^60 (1 152 921 504 606 846 976).
New features
Variable precision decimal floating point implementation for arithmetic, trigonometrics, logs, exponential and integer factorial. Other functions may still return "unimplemented error".
Bug fixes
None. If anything, this release introduces bugs in computations and performance regressions. However, it frees a lot of space for further DM42 development.
Improvements
The Precision
setting now sets the number of digits with a granularity of one,
between 3 and 9999. Ideal use of memory is with multiples of 12 digits, e.g. 12,
24 or 36 digits, where decimal packing does not cause lost bits.
Performance on the DM42 is somewhat improved, since it is now possible to return to a higher level of optimization.
Regressions
In addition to lower performance and unimplemented functions, this version no longer builds a compatible QSPI. This means that returning to the DM42 requires flashing both the QSPI and the PGM file.
Release 0.5.2 "Christmas Eve": Reaching hard limits on the DM42
This release was a bit longer in coming than earlier ones, because we are about to reach the limits of what can fit on a DM42. This release uses 711228 bytes out of the 716800 (99.2%).
Without the Intel Decimal Library code, we use only 282980 bytes. This means that the Intel Decimal Library code uses 60.2% of the total code space. Being able to move further requires a rather radical rethinking of the project, where we replace the Intel Decimal Library with size-optimized decimal code.
As a result, release 0.5.2 will be the last one using the Intel Decimal Library, and is release in parallel with 0.6.0, which switches to a table-free and variable-precisions implementation of decimal code that uses much less code space. The two releases should otherwise be functionally identical
New features
- Shift and rotate instructions (#622)
- Add
CompatibleTypes
andDetsailedTypes
setting to controlType
results - Recognize HP-compatible negative values for flags, e.g.
-64 SF
(#625) - Add settings to control multiline result and stack display (#634)
Bug fixes
- Truncate to
WordSize
the small results of binary operations (#624) - Fix day-of-week shortcut in simulator
- Avoid double-evaluation of immediate commands when there is no help
- Generate an error when selecting base 1 (#628)
- Avoid
Number too big
error on based nunbers - Correctly garbage-collect menu entries (#630)
- Select default settings that allow solver to find solutions (#627)
- Fix display of decimal numbers (broken by multi-line display)
- Fix rendering of menu entries for
Fix
,Std
, etc - Detect non-finite results in arithmetic, e.g.
(-8)^0.3
m (#635, #639) - Fix range-checking for
Dig
to allow-1
value - Accept large values for
Fix
,Sci
andEng
(for variable precision) - Restore missing last entry in built-in units menu (#638)
- Accept
Hz
and non-primary units as input forConvertToUnitPrefix
(#640) - Fix LEB128 encoding for signed value 64 and similar (#642)
- Do not parse
IfThenElse
as a command - Do not consider
E
as a digit in decimal numbers (#643) - Do not parse
min
as a function in units, but as minute (#644)
Improvements
- Add
OnesComplement
flag for binary operation (not used yet) - Add
ComplexResults
(-103) flag (not used yet) - Accept negative values for
B→R
(according toWordSize
) - Add documentation for
STO
andRCL
accessing flash storage - Mention
True
andFalse
in documentation - Rename
MaxBigNumBits
toMaxNumberBits
- Return HP-compatible values from
Type
function - Minor optimization of flags implementation
- Catalog auto-completion now suggests all possible spellings (#626)
- Add aliases for
CubeRoot
andHypothenuse
- Align based number promotion rules to HP calculators (#629)
- Expand the range of garbage collector integrity check on simulator
- Show command according to preferences in error messages (#633)
- Avoid crash in
debug_printf
if used before font initialization - Update performance data in documentation
- Add ability to disable any reference to Intel Decimal Floating-point library
- Simplify C++ notations for safe pointers (
+x
andoperartor bool()
) - Fix link to old
db48x
project inREADME.md
Release 0.5.1 "Talents": More RPL commands
This release focuses on rounding up various useful RPL commands and bringing RPL a bit closer to feature-complete.
New features
- Portable bit pattern generation commands,
gray
andrgb
(#617) - Add support for packed bitmaps (#555)
- Implement RPL
case
statement, extended withcase when
(#374) Beep
command (#50)List→
command (#573)Size
command (#588)Str→
command (#590)Obj→
command (#596)- Add flag to control if
0^0
returns1
or undefined behaviour (#598) - Unicode-based
Num
andChr
commands,Text→Code
andCode→Text
(#597) IP
andFP
commands (#601)- Percentage operations
%
,%CH
and%T
(#602) Min
andMax
operations (#603)Floor
andCeil
operations (#605)Get
with a name argument (#609)Put
command (#610)Head
andTail
commands (#614)Map
,Reduce
andFilter
commands (#613)
Bug fixes
- Ensure rounded rectangles stay within their boundaries (#618)
- Prevent auto-power-off for long-running programs (#587)
- Fix old-style RPL shortcuts for
FS?C
and the like - Add
FF
shortcut forFlipFlag
- Fix rendering of
<
,>
, etc in old-style RPL compatibility mode (#595) - Update various menus
- Evaluate program arguments in
IFT
andIFTE
(#592) - Evaluate algebraic expressions in
if
,while
andcase
(#593) - Load variables from state file in correct order (#591)
- Avoid truncation of state file when ASCII conversions occur (#589)
- Clear debugging state more completely after
kill
(#600) Wait
no longer makes it harder to stop a program (#619)mod
no longer gives wrong result for negative fractions and bignums (#606)- No longer strip tags in non-numeric arithmetic operations (#607)
Improvements
- Small updates to demo file
- A long
Wait
command allows the calculator to switch off (#620) - Centering of variable names in
VariablesMenu
(#610) - Makefile
check-ids
target to check if commands are in help or menus (#615)
Release 0.5.0: Statistics and flags
This release provides statistics functions and flags.
New features
- Statistics (#495) and linear regression (#569)
- File-based statistics (#571)
Sort
,QuickSort
,ReverseSort
,ReverseQuickSort
andRevList
(#572)- Flags, i.e.
CF
,SF
,FS?
, etc (#43) - Plot scaling commands such as
SCALE
,CENTR
,XRNG
, ... (#582) - Add
CurveFilling
andDrawPlotAxes
setting flags (#580) ScatterPlot
(#577) andBarPlot
(#579)
Bugs
- Save settings enumerations as portable text (#565)
- Avoid infinite loop when reading at end of help file
- Repair behaviour of
-1 DIG
, broken by settings improvements - Fix definition of
rpm
in units and units file - Crash in
list::map
when called function errors out (#570) - Fix editor horizontal movement when inserting commands (#576)
- Repair plotting demo (#583)
- Fix vertical position of axes in
DrawAxes
(#584) - Very long drawing loop if
ppar
axes are backwards (#585)
Improvements
- Sets editor selection correctly for command-line errors
- Ability to parse command and setting names in quotes, e.g.
'Radians'
- Insert command names inside quotes (#575)
- Update documentation of implemented features (#569)
- Make
PlotParameters
a keyword (#578)
Release v0.4.12: Emergency bug fixes, filesyste, access
A few quick bug fixes related to issues found in 0.4.11.
New features
STO
andRCL
to file (#375)- Parsing of text containing quotes (#562)
Improvements
- Rework file load/save dialog boxes
- Preliminary plumbing for statistics functions
Bugs
- Error loading state files that contain directories (#559)
- Font setting for result was taken from editor font (#560)
- Crash running the
Shapes
demo (#563)
Release 0.4.11: Debugging, Units, Settings
This release implements debugging, infinite RPL recursion, mixed fractions, customizable units cycling, and restores missing entries in the units menu.
New features
- Allow customization of
Cycle
for units (#534) - Allow infinite recursion in RPL code (#537)
- RPL program and expression debugging (#552) including after EXIT
- Mixed fractions such as
1 1/3
(#554) BeepOn
andSilentBeepOn
features (#280)ScreenCapture
and keyboard shortcut (#434)
Bugs
- Accept
2.3 FIX
and#0 Background
(#557) - Do not parse
67.200525
as adecimal32
(#551) - Bump low battery voltage to 2.550V (#553)
Improvements
- Catalog shows all commands containing typed text (#556)
- Reorganize the units menu (#550) and restore missing units
- Remember menu page for
LastMenu
(#545) SPC
key inserts;
when inside parenthese (#499)- Settings are now entirely defined by
ids.tbl
(#294) - Improve user interface code consistency
- Improve GC handling of "just-past-end-of-object" pointers
- Remove the
execute()
RPL callback, rely onevaluate()
- Optimize allocation of 1-byte vs 2-byte opcodes
- Render
abs
asabs
and notnorm
(acceptnorm
while parsing)
Release v0.4.10: Performance and units file
This release focuses on display performance optimization and support for unit data files.
New features
- Cycle command for units (#517)
- Possibility to load units from config/units.csv file (#496, #544)
- Internal: debug_printf facility (#541)
- ShowBuiltinUnits and HideBuiltinUnits settings (#542)
- Provide config/units.csv example file (#543)
- Build units menu from units file (#544)
Bugs
- Possible memory corruption in expressions
- Calculator lock-up trying with unit conversions in numeric mode (#529)
- Numerator and divisor no longer truncated to 32-bit (#539)
- Correctly save LastArg for interactive operations (#540)
Improvements
- Optimize the font cache, makes stack drawing faster in SCI mode (#526)
- Add TypeName to object menu (#527)
- Regroup units in units menu by scale (#528)
- Status of implementation and performance data in documentation (#530)
- Performance: Reduce frequency of busy cursor drawing (#531)
- Performance: Reimplement range-based type checkig (#532)
- Performance: Focused -O3 optimizations on DM42 (#533)
- Makefile: Install target installs demo and config (#547)
- Garbage collector for menu labels (#548)
Release 0.4.9 - Support for units
This release focuses on support for units, but also adds a large number of other fixes and improvements.
New features
- Power-off message indicating low-battery situation (#521)
- Add ConvertToUnixPrefix command and SI prefix menu keys (#513)
- Recognize all units that exist in the HP48, and a few more (#491)
- UFACT (FactorUnit) command (#512)
- Unit simplification, e.g. turn 1_m^2*s/s/m into 1_m (#506)
- Converting unity units to numbers (#502)
- →Unit command (#501)
- UnitValue (UVAL) command (#493)
- Implement "kibibytes" (KiB) and power-of-two SI prefixes (#492)
- Unit arithmetic (#481)
- Add B->R and R->B to BasesMenu (#488)
- Implement term reordering capability in rewrite (#484)
- BaseUnits (UBase) command (#483)
- Unit parsing for complex units, e.g. 1_cm^2 (#482)
- Unit arithmetic (#481) including automatic conversions (#480)
- Convert command (#480)
- Implement the Cycle command for unit objects
- Add Å character for angstroem (#477)
- Add Merge state to State system menu (#475)
- Use Unicode font to display the name of a program when executing it (#469)
- Allow incremental search to find digits and Unicode (#468)
- Add tool glyph to user interface font
Bug fixes
- Do not parse symbols beyond input buffer (#524)
- Parse unit menu entries as expressions, not symbols (#523)
- Fix reduced-precision arithmetic (#521)
- Do not parse empty denominator as zero, e.g. 2/s (#520)
- Do not parse a fraction inside a power, e.g. X^2/3 (#519)
- Convert fractions to decimal in numeric mode (#516)
- Do not emit mantissa_error for valid numbers (#515)
- Apply negation correctly on unit objects (#500)
- Do not emit separator after trailing 0 in integer decimals (#489)
- Do not emit extra spacing before decimal separator (#485)
- Fix stack depth in one error case of evaluate_function()
- Fix display of next/previous icons for large menus (#478)
- Clear settings when loading a state (#474)
- Fix separators in whole part of decimal numbers when setting is not 3 (#464)
- Parse (sin x)²+(cos x)² correctly, as well as HP67 Mach example (#427)
Improvements
- Rename equation as expression (#518) and labelText as label_text
- Do not update LastArg except for command line (#511)
- ToolsMenu: Connect units to the UnitsConversionMenu (#514)
- Display unit using / and ·, e.g. 1_m·s^2/A (#507)
- Show units menu for inverse units as mm⁻¹ (#503)
- Display battery level more accurately, i.e. consider 2.6V "low" (#476)
- No longer acccept empty equations or parentheses, e.g. 1+() (#487)
- Make StandardDisplay mode obey MinimumSignificantDigits (#462)
- Add algebraic evaluation function for easier evaluation in C++ code
- Reimplement unit type as a derivative of complex (#471)
- documentation: Use 🟨 and 🟦 for more commands (#467)
- Swap Search and Copy commands in EditorMenu (#466)
- STO stores variables at beginning of directory (#462)
- documentation: Add quickstart guide, used for video recording
- documentation: Add links to YouTube videos
- documentation: Add release notes
- documentation: Some typos and other improvements
- documentation: Rework section on keyboard mappings
Implementation status
This section documents the implementation status for all HP50 RPL commands as listed in the HP50G Advanced Reference Manual. This is a strict superset of the HP48 implementation.
Implemented commands
The following is a list of the HP50 RPL commands which are implemented in DB48X.
- ! (Factorial)
- + (Add)
- < (Less than)
- == (Different meaning: object equality)
- = (Equal)
- > (Greater than)
- ABS
- ACOSH
- ACOS
- ADD
- ALOG
- AND
- ARG
- ARRY→
- →ARRY
- ASINH
- ASIN
- ASR
- ASRC
- ATANH
- ATAN
- AXES
- BARPLOT
- BEEP
- BESTFIT
- BIN
- BYTES
- B→R
- CASE
- CEIL
- CF
- %CH
- CHR
- CLEAR
- CLLCD
- CLΣ
- COLΣ
- COMB
- CON
- CONJ
- CONLIB
- CONST
- CONSTANTS
- CONT
- CONVERT
- COSH
- COS
- COV
- CRDIR
- C→R
- DATE
- →DATE
- DATE+
- DDAYS
- DBUG
- DEC
- DECR
- DEDICACE
- DEG
- DEPTH
- DET
- DIR
- DISP
- DISPXY
- DIV2
- DOERR
- DO
- DRAW
- DRAX
- DROP2
- DROPN
- DROP
- DTAG
- DUP2
- DUPN
- DUP
- D→R
- e
- ELSE
- END
- ENG
- ERR0
- ERRM
- ERRN
- EVAL
- EXPAND
- EXPAN
- EXPFIT
- EXPM
- EXP
- FACT
- FC?C
- FC?
- FIX
- FOR
- FP
- FS?C
- FS?
- FUNCTION
- GAMMA
- GET
- GETI
- GOR
- GROB
- GXOR
- HALT
- HEAD
- HELP (Different meaning)
- HEX
- HOME
- HMS–
- HMS+
- HMS→
- →HMS
- IFERR
- IFTE
- IFT
- IF
- IM
- INV
- IP
- KILL
- LASTARG
- LINE
- LINFIT
- LNP1
- LN
- LOG
- LOGFIT
- LR
- MAX
- MAXΣ
- MEAN
- MEM
- MIN
- MINΣ
- MOD
- NEG
- NEXT
- NOT
- NΣ
- NUM
- OBJ→
- OCT
- OFF
- OR
- OVER
- PARAMETRIC
- PATH
- PGDIR
- PICK
- PICT
- POLAR
- PMAX
- PMIN
- PURGE
- PUT
- PUTI
- PVAR
- PWRFIT
- RAD
- RCL
- RCLΣ
- RCWS
- RE
- RECT (Different meaning: draws a rectangle)
- REPEAT
- REVLIST
- REWRITE (Different meaning: performs a rewrite)
- RL
- RLB
- RLC
- ROLLD
- ROLL
- ROOT
- ROT
- RR
- RRB
- RRC
- R→B
- R→C
- R→D
- SAME
- SCALE
- SCALEH
- SCALEW
- SCI
- SF
- SIGN
- SINH
- SIN
- SL
- SLB
- SLC
- SORT
- SQ
- SR
- SRB
- SST
- SST↓
- START
- STD
- STEP
- STORE (Different meaning: long form of STO)
- STO
- STOΣ
- STR→
- STWS
- SWAP
- %T
- TAIL
- TANH
- TAN
- THEN
- TICKS
- TIME
- →TIME
- TOT
- TYPE
- UBASE
- UFACT
- UNTIL
- UPDIR
- UVAL
- VAR
- VERSION
- WAIT
- WHILE
- XCOL
- XOR
- XRNG
- XROOT
- YRNG
- YCOL
- %
- ^ (Power)
- i
- «» (Program delimiters)
- × (Multiply)
- ÷ (Divide)
- Σ+
- ΣXY
- ΣX
- ΣX²
- ΣY
- ΣY²
- Σ–
- π (Pi)
- – (Subtract)
- →LIST
- →NUM
- →Q
- →STR
- →TAG
- →UNIT
- → (Create Local)
- √ (Square root)
- ∫ (Integrate)
- ≠ (Not equal)
- ≤ (Less than or equal)
- ≥ (Greater than or Equal)
- _ (Unit attachment)
Unimplemented commands
The following is a list of unimplemented HP50 RPL commands, which is a superset of the HP48 commands.
- ABCUV
- ACK
- ACKALL
- ACOS2S
- ADDTMOD
- ADDTOREAL
- ALGB
- AMORT
- ANIMATE
- ANS
- APPLY
- ARC
- ARCHIVE
- ARIT
- ASIN2C
- ASIN2T
- ASN
- ASSUME
- ATAN2S
- ATICK
- ATTACH
- AUGMENT
- AUTO
- AXL
- AXM
- AXQ
- BAR
- BASIS
- BAUD
- BINS
- BLANK
- BOX
- BUFLEN
- C$
- C2P
- CASCFG
- CASCMD
- CENTR
- CHINREM
- CHOLESKY
- CHOOSE
- CIRC
- CKSM
- CLKADJ
- CLOSEIO
- CLUSR
- CLVAR
- CMPLX
- CNRM
- →COL
- COL→
- COL–
- COL+
- COLCT
- COLLECT
- COND
- CONIC
- CORR
- CR
- CROSS
- CSWP
- CURL
- CYCLOTOMIC
- CYLIN
- C→PX
- DARCY
- DEF
- DEFINE
- DEGREE
- DELALARM
- DELAY
- DELKEYS
- DEPND
- DERIV
- DERVX
- DESOLVE
- DETACH
- DIAG→
- →DIAG
- DIAGMAP
- DIFF
- DIFFEQ
- DISTRIB
- DIV
- DIV2MOD
- DIVIS
- DIVMOD
- DIVPC
- dn
- DOLIST
- DOMAIN
- DOSUBS
- DOT
- DRAW3DMATRIX
- DROITE
- DUPDUP
- EDIT
- EDITB
- EGCD
- EGV
- EGVL
- ENDSUB
- EPSX0
- EQNLIB
- EQW
- EQ→
- ERASE
- EULER
- EXLR
- EXP&LN
- EXP2HYP
- EXP2POW
- EXPANDMOD
- EXPLN
- EYEPT
- F0λ
- FACTOR
- FACTORMOD
- FACTORS
- FANNING
- FAST3D
- FCOEF
- FDISTRIB
- FFT
- FILER
- FINDALARM
- FINISH
- FLASHEVAL
- FLOOR
- FONT6
- FONT7
- FONT8
- FONT→
- →FONT
- FOURIER
- FREE
- FREEZE
- FROOTS
- FXND
- GAUSS
- GBASIS
- GCD
- GCDMOD
- GRAD
- GRAMSCHMIDT
- GRAPH
- GREDUCE
- GRIDMAP
- →GROB
- GROBADD
- *H
- HADAMARD
- HALFTAN
- HEADER→
- →HEADER
- HERMITE
- HESS
- HILBERT
- HISTOGRAM
- HISTPLOT
- HORNER
- IABCUV
- IBASIS
- IBERNOULLI
- IBP
- ICHINREM
- IDN
- IDIV2
- IEGCD
- IFFT
- ILAP
- IMAGE
- INCR
- INDEP
- INFORM
- INPUT
- INT
- INTEGER
- INTVX
- INVMOD
- IQUOT
- IREMAINDER
- ISOL
- ISOM
- ISPRIME?
- I→R
- JORDAN
- KER
- KERRM
- KEY
- KEYEVAL
- →KEYTIME
- KEYTIME→
- KGET
- LABEL
- LAGRANGE
- LANGUAGE→
- →LANGUAGE
- LAP
- LAPL
- LAST
- LCD→
- →LCD
- LCM
- LCXM
- LDEC
- LEGENDRE
- LGCD
- LIBEVAL
- LIBS
- lim
- LIMIT
- LIN
- ΣLINE
- LININ
- LINSOLVE
- LIST→
- ∆LIST
- ΠLIST
- ΣLIST
- LNAME
- LNCOLLECT
- LOCAL
- LQ
- LR
- LSQ
- LU
- LVAR
- MAD
- MAIN
- MANT
- MAP
- ↓MATCH
- ↑MATCH
- MATHS
- MATR
- MAXR
- MCALC
- MENU
- MENUXY
- MERGE
- MINEHUNT
- MINIFONT→
- →MINIFONT
- MINIT
- MINR
- MITM
- MKISOM
- MODSTO
- MODULAR
- MOLWT
- MROOT
- MSGBOX
- MSLV
- MSOLVR
- MULTMOD
- MUSER
- →NDISP
- NDIST
- NDUPN
- NEWOB
- NEXTPRIME
- NIP
- NOVAL
- NSUB
- NUMX
- NUMY
- OLDPRT
- OPENIO
- ORDER
- P2C
- PA2B2
- PARITY
- PARSURFACE
- PARTFRAC
- PCAR
- PCOEF
- PCONTOUR
- PCOV
- PDIM
- PERINFO
- PERM
- PERTBL
- PEVAL
- PICK3
- PICTURE
- PINIT
- PIX?
- PIXOFF
- PIXON
- PKT
- PLOT
- PLOTADD
- PMINI
- POLYNOMIAL
- POP
- POS
- POTENTIAL
- POWEXPAND
- POWMOD
- PR1
- PREDV
- PREDX
- PREDY
- PREVAL
- PREVPRIME
- PRLCD
- PROMPT
- PROMPTSTO
- PROOT
- PROPFRAC
- PRST
- PRSTC
- PRVAR
- PSDEV
- PSI
- Psi
- PTAYL
- PTPROP
- PUSH
- PVARS
- PVIEW
- PX→C
- →Qπ
- qr
- QR
- QUAD
- QUOT
- QUOTE
- QXA
- RAND
- RANK
- RANM
- RATIO
- RCEQ
- RCI
- RCIJ
- RCLALARM
- RCLF
- RCLKEYS
- RCLMENU
- RCLVX
- RDM
- RDZ
- RECN
- RECV
- REF
- REMAINDER
- RENAME
- REORDER
- REPL
- RES
- RESTORE
- RESULTANT
- RISCH
- RKF
- RKFERR
- RKFSTEP
- RND
- RNRM
- ROMUPLOAD
- ROW–
- ROW+
- ROW→
- →ROW
- RPL>
- rref
- RREF
- RREFMOD
- RRK
- RRKSTEP
- RSBERR
- RSD
- RSWP
- RULES
- R→I
- SBRK
- SCATRPLOT
- SCATTER
- SCHUR
- SCLΣ
- SCONJ
- SCROLL
- SDEV
- SEND
- SEQ
- SERIES
- SERVER
- SEVAL
- SHOW
- SIDENS
- SIGMA
- SIGMAVX
- SIGNTAB
- SIMP2
- SIMPLIFY
- SINCOS
- SINV
- SIZE
- SLOPEFIELD
- SNEG
- SNRM
- SOLVE
- SOLVEQN
- SOLVER
- SOLVEVX
- SPHERE
- SRAD
- SRECV
- SREPL
- STEQ
- STIME
- STOALARM
- STOF
- STOKEYS
- STOVX
- STO+
- STO–
- STO*
- STO/
- STREAM
- STRM
- STURM
- STURMAB
- SUB
- SUBST
- SUBTMOD
- SVD
- SVL
- SYSEVAL
- SYLVESTER
- SYST2MAT
- TABVAL
- TABVAR
- TAN2CS2
- TAN2SC
- TAN2SC2
- TAYLOR0
- TAYLR
- TCHEBYCHEFF
- TCOLLECT
- TDELTA
- TESTS
- TEVAL
- TEXPAND
- TEXT
- TINC
- TLIN
- TLINE
- TMENU
- TRACE
- TRAN
- TRANSIO
- TRIG
- TRIGCOS
- TRIGO
- TRIGSIN
- TRIGTAN
- TRN
- TRNC
- TRUNC
- TRUTH
- TSIMP
- TSTR
- TVARS
- TVM
- TVMBEG
- TVMEND
- TVMROOT
- UFL1→MINIF
- UNASSIGN
- UNASSUME
- UNBIND
- UNPICK
- UNROT
- UTPC
- UTPF
- UTPN
- UTPT
- V→
- →V2
- →V3
- VANDERMONDE
- VARS
- VER
- VISIT
- VISITB
- VPOTENTIAL
- VTYPE
- *W
- WIREFRAME
- WSLOG
- XGET
- XMIT
- XNUM
- XPON
- XPUT
- XQ
- XRECV
- XSEND
- XSERV
- XVOL
- XXRNG
- YSLICE
- YVOL
- YYRNG
- ZEROS
- ZFACTOR
- ZVOL
- | (Where)
- ?
- ∞
- Σ
- ∂
- (Store)
- ; (Semicolon)
Additional commands
The following commands are unique to DB48X and are not found in any Hewlett-Packard RPL implementation.
- ATAN2: Arc-tangent from two arguments
- AngleUnitsMenu
- AnglesMenu
- ApplyInverseUnit
- ApplyUnit
- AreaUnitsMenu
- AutoSimplify: Automatically simplify expressions
- BASE: Select an arbitrary base for based numbers
- Background: Select background pattern for graphic operations
- BasedDotOrComma: Use dot or comma as based number digit separator
- BasedSpaces: Use thin spaces as based number digit separator
- BasedSpacing: Grouping of digits for based numbers
- BasedTicks: Use tick marsk
'
as based number digit separator - BasedUnderscore: Use underscore
_
as based number digit separator - BasesMenu
- CBRT: Cube root
- CYCLE: Cycle between object representations
- Capitalized: Show commands capitalized
- Catalog: Present catalog of all functions with auto-completion
- CharsMenu
- CircularMenu
- ClassicExponent: Use E as exponent marker, e.g. 1.3E128
- ClearThingsMenu
- CompareMenu
- ComplexMenu
- ComputerUnitsMenu
- ConstantsMenu
- ConvertToUnitPrefix
- ConvertToUnit
- CursorBlinkRate: Select cursor blink rate in milliseconds
- DebugMenu
- DecimalComma: Select comma as decimal separator
- DecimalDot: Select dot as decimal separator
- DifferentialSolverMenu
- DifferentiationMenu
- DisplayModesMenu
- EQUIV: Logical equivalence
- ERFC: Complementary error function
- ERF: Error function
- EXCLUDES: Logical exclusion
- EditMenu
- EditorBegin
- EditorClear
- EditorCopy
- EditorCut
- EditorEnd
- EditorFlip
- EditorFontSize: Select font size for text editor
- EditorMultilineFontSize: Select font size for multi-line text editor
- EditorPaste
- EditorReplace
- EditorSearch
- EditorSelect
- EditorWordLeft
- EditorWordRight
- ElectricityUnitsMenu
- EnergyUnitsMenu
- EquationsMenu
- ExpLogMenu
- FancyExponent: Use power-of-ten rendering, e.g. 1.3×₁₀¹²⁸
- FilesMenu
- FinanceSolverMenu
- FlagsMenu
- FlatMenus: Flatten menus (no use of shift)
- ForceUnitsMenu
- Foreground: Select foreground pattern for graphic operations
- FractionSpacing: Grouping of digits for fractional part of numbers
- FractionsMenu
- GAND: Graphical And
- GarbageCollect
- GraphicsMenu
- GraphicsStackDisplay: Select graphic display of the stack
- HYPOT: Hypothenuse
- HideBuiltinUnits
- HyperbolicMenu
- IMPLIES: Logical implication
- IOMenu
- IntegrationMenu
- LastMenu: Select last menu
- LastX: Return last X argument (for easier translation of RPN programs)
- LengthUnitsMenu
- LibrariesMenu
- LightUnitsMenu
- LineWidth: Select line width for line drawing operations
- LinearSolverMenu
- ListMenu
- LongForm: Show commands in long form
- LoopsMenu
- LowerCase: Show commands in lowercase
- MainMenu
- MantissaSpacing: Grouping of digits for whole part of numbers
- MassUnitsMenu
- MathMenu
- MathModesMenu
- MatrixMenu
- MaxNumberBits: Maximum number of bits used by a number
- MaxRewrites: Maximum number of equation rewrites
- MemoryMenu
- MenuFirstPage
- MenuNextPage
- MenuPreviousPage
- MinimumSignificantDigits: adjustment of FIX mode switch to SCI
- ModesMenu
- MultiSolverMenu
- NAND: Not And
- NOR: Not Or
- NoAutoSimplify: Do not automatically simplify expressions
- NoTrailingDecimal: display 1.0 as 1
- NumberDotOrComma: Use dot or comma as digit group separator
- NumberSpaces: Use thin spaces as digit group separator
- NumberTicks: Use tick marks
'
as digit group separator - NumberUnderscore: Use underscore
_
as digit group separator - NumbersMenu
- NumericResults: Produce numeric (decimal) results
- NumericalSolverMenu
- ObjectMenu
- PIRADIANS: Angle mode with multiples of pi
- PartsMenu
- PlotMenu
- PolynomialSolverMenu
- PolynomialsMenu
- PowerUnitsMenu
- PowersMenu
- Precision: Select decimal computing precision
- PressureUnitsMenu
- PrintingMenu
- ProbabilitiesMenu
- ProgramMenu
- REM: remainder
- RadiationUnitsMenu
- RealMenu
- ResultFontSize: Select font size to display level 1 of stack
- RoundedMenus: Select round menu style
- SIG: Significant digits mode
- SaveState: Save system state to current state file
- SelfInsert
- SeparatorModesMenu
- ShowBuiltinUnits
- SignalProcessingMenu
- SingleRowMenus: Display menus on single row
- SolverMenu
- SpeedUnitsMenu
- SquareMenus: Select square (C47-like) menu style
- StackFontSize: Select font size to display levels above 1 of stack
- StackMenu
- StandardExponent: Display with standard exponent mode
- StatisticsMenu
- SymbolicMenu
- SymbolicResults: Produce symbolic results
- SymbolicSolverMenu
- SystemMemory
- SystemSetup: Enter DMCP system setup menu
- Tag→
- TemperatureUnitsMenu
- TestsMenu
- TextMenu
- TextStackDisplay: Select text-only display of the stack
- ThreeRowsMenus: Display menus on up to three rows
- TimeMenu
- TimeUnitsMenu
- ToFractionDigits: Required digits of precision for →Q
- ToFractionIterations: Max number of iterations for →Q
- ToolsMenu: Automatically select a menu based on context
- TrailingDecimal: display 1.0 with trailing decimal separator
- TypeName
- Undo: Restore stack to state before command
- UnitsConversionsMenu
- UnitsMenu
- UpperCase: Show commands in uppercase
- UserInterfaceModesMenu
- VariablesMenuExecute
- VariablesMenuRecall
- VariablesMenuStore
- VariablesMenu
- VectorMenu
- ViscosityUnitsMenu
- VolumeUnitsMenu
Performance measurements
This sections tracks some performance measurements across releases.
Constants library
The DB48X calculator features a library of constants covering mathematics,
physics, chemistry and computer science. The built-in constants can be extended
using the config/constants.csv
configuration file.
Mathematics constants
π constant
The ratio between the circumference and the diameter of a circle.
e constant
Euler's constant is the base for the natural logarithm.
ⅈ constant
The imaginary unit, such that ⅈ²=-1.
The picture below shows imaginary unit ⅈ in the complex plane: Real numbers are conventionally drawn on the horizontal axis, and imaginary numbers on the vertical axis.
ⅉ constant
An alternative notation, often preferred by physicists, for the imaginary unit ⅈ, verifying ⅉ²=-1.
∞ constant
Infinity is something that is larger than any natural number. Its numerical value is an arbitrary large number that is not really infinite.
? constant
The undefined constant is used to represent undefined values, such as the result of undefined operations.
Chemistry constant
NA constant
Avogradro constant is the number of constituent particles per mole.
k constant
The Boltzmann constant is the proportionality factor that relates the average relative thermal energy of particles in a gas with the thermodynamic temperature of the gas.
Vm constant
Molar volume of an ideal gas at 1 atmosphere of pressure and 0°C.
R constant
The universal gas constant is the molar equivalent to the Boltzmann constant, expressed in units of energy per temperature increment per amount of substance, rather than energy per temperature increment per particle.
StdT constant
Standard temperature as defined by IUPAC in 1982.
Standard temperature and pressure (STP) or Standard conditions for temperature and pressure are various standard sets of conditions for experimental measurements used to allow comparisons to be made between different sets of data. The most used standards are those of the International Union of Pure and Applied Chemistry (IUPAC, used by DB48X) and the National Institute of Standards and Technology (NIST). Other organizations have established a variety of other definitions.
StdP constant
Standard pressure as defined by IUPAC in 1982, corresponding to 1 atm
Standard temperature and pressure (STP) or Standard conditions for temperature and pressure are various standard sets of conditions for experimental measurements used to allow comparisons to be made between different sets of data. The most used standards are those of the International Union of Pure and Applied Chemistry (IUPAC, used by DB48X) and the National Institute of Standards and Technology (NIST). Other organizations have established a variety of other definitions.
σ constant
Stefan-Boltzmann constant, the factor of proportionality in the Stefan-Boltzmann law describing the intensity of the thermal radiation emitted by matter in terms of that matter's temperature.
For an ideal absorber/emitter or black body, the Stefan–Boltzmann law states
that the total energy radiated per unit surface area per unit time (also known
as the radiant exitance) is directly proportional to the fourth power of the
black body's temperature, T:M°=σ·T⁴
Physics constants
ⅉ constant
Notation often used in physics for the imaginary verifying ⅉ²=-1.
c constant
Speed of light in vaccuum, a universal physical constant that is exactly equal to 299,792,458 metres per second (by definition of the metre).
According to the special theory of relativity, c is the upper limit for the speed at which conventional matter or energy (and thus any signal carrying information) can travel through space.
The theory of incomplete measurements presents space and time as having no existence on their own. We only derive them from measurements of distance and duration made using photons. In that viewpoint, c is the limit of what can be measured using photons. Anything travelling faster than light is indistinguishable from anti-matter. This is illustrated by the thought experiment known (or not) as the bat and the supersonic jet. This little tidbit is only mentioned here because this particular theory was devised by the primary author of DB48X.
ε0 constant
Vacuum permittivity, commonly denoted ε0 (pronounced "epsilon nought" or "epsilon zero"), is the value of the absolute dielectric permittivity of classical vacuum. It may also be referred to as the permittivity of free space, the electric constant, or the distributed capacitance of the vacuum. It is an ideal (baseline) physical constant. It is a measure of how dense of an electric field is "permitted" to form in response to electric charges and relates the units for electric charge to mechanical quantities such as length and force.
μ0 constant
The vacuum magnetic permeability (variously vacuum permeability, permeability of free space, permeability of vacuum, magnetic constant) is the magnetic permeability in a classical vacuum. It is a physical constant, conventionally written as μ0 (pronounced "mu nought" or "mu zero"). It quantifies the strength of the magnetic field induced by an electric current.
g constant
Acceleration of Earth gravity, equivalent to the free-fall acceleration.
G constant
The gravitational constant is an empirical physical constant involved in the calculation of gravitational effects in Sir Isaac Newton's law of universal gravitation and in Albert Einstein's theory of general relativity.
According to Newton's law of universal gravitation, the magnitude of the attractive force (F) between two bodies each with a spherically symmetric density distribution is directly proportional to the product of their masses, m₁ and m₂, and inversely proportional to the square of the distance, r, directed along the line connecting their centres of mass:
h constant
The Planck constant is a fundamental physical constant that appears in quantum
mechanics. A photon's energy is equal to its frequency multiplied by the Planck
constant (E=h·ν
), and the wavelength of a matter wave equals the Planck constant
divided by the associated particle momentum (λ=h/p
).
ℏ constant
The reduced Planck constant, ℏ, also known as the Dirac Constant, is defined as
ℏ=h/2π
.
qe constant
The elementary electric charge is a fundamental physical constant, defined as the electric charge carried by a single proton or, equivalently, the magnitude of the negative electric charge carried by a single electron, which has charge −qe.
In the SI system of units, the value of the elementary charge is exactly defined
as qe=1.602176634⁻¹⁹
coulombs. Since the 2019 redefinition of SI base units,
the seven SI base units are defined by seven fundamental physical constants, of
which the elementary charge is one. As a consequence of this change, the value
of that constant in DB48X differs from the value in the HP50G, which named it q,
with value 1.60217733⁻¹⁹
coulombs.
me constant
Electron mass. In particle physics, the electron mass is the mass of a
stationary electron, also known as the invariant mass of the electron. It is one
of the fundamental constants of physics. It has a value of about 9.109⁻³¹
kilograms
qme constant
Ratio between the electron charge and its mass.
mp constant
Mass of the proton.
mpme constant
Ratio between the mass of the proton and the mass of the electron.
α constant
Fine-structure constant. In physics, the fine-structure constant, also known as the Sommerfeld constant, commonly denoted by α (the Greek letter alpha), is a fundamental physical constant which quantifies the strength of the electromagnetic interaction between elementary charged particles.
It is a dimensionless quantity, independent of the system of units used, which is related to the strength of the coupling of an elementary charge e with the electromagnetic field.
ø constant
Magnetic flux quantum. The (superconducting) magnetic flux quantum is a combination of fundamental physical constants: the Planck constant h and the electron charge e. Its value is, therefore, the same for any superconductor.
F constant
Faraday constant. In physical chemistry, the Faraday constant is a physical constant defined as the quotient of the total electric charge (q) by the amount (n) of elementary charge carriers in any given sample of matter
R∞ constant
Rydberg constant. In spectroscopy, the Rydberg constant is a physical constant relating to the electromagnetic spectra of an atom. The constant first arose as an empirical fitting parameter in the Rydberg formula for the hydrogen spectral series, but Niels Bohr later showed that its value could be calculated from more fundamental constants according to his model of the atom.
a0 constant
Bohr radius. The Bohr radius is a physical constant, approximately equal to the most probable distance between the nucleus and the electron in a hydrogen atom in its ground state.
μB constant
Bohr magneton. In atomic physics, the Bohr magneton is a physical constant and
the natural unit for expressing the magnetic moment of an electron caused by its
orbital or spin angular momentum. In SI units, the Bohr magneton is defined as
μB=qe*ℏ/(2·me)
.
μN constant
The nuclear magneton is a physical constant of magnetic moment, defined in SI
units by μN=qe·ℏ/(2·mp)
.
λ0 constant
Photon wavelength. Photon energy can be expressed using any unit of energy such
as the electronvolt (eV) or the Joule (J). For short wavelength sources,
researchers often discuss photon energies in units of eV (or keV for hard
X-rays) out of convenience. The SI definition for 1 eV derives from the
definitional value of the electron charge. Photon energy E
in
eV can be computed from wavelength l
in nm as: E=λ0/l
.
f0 constant
Photon frequency. This is the frequency associated to the [photon wavelength λ0][#λ0-constant].
λc constant
Compton wavelength. The Compton wavelength is a quantum mechanical property of a particle, defined as the wavelength of a photon whose energy is the same as the rest energy of that particle (based on the mass–energy equivalence).
The standard Compton wavelength λ
of a particle of mass m
is given by
λ=h/(m·c)
rad constant
One radian.
twoπ constant
Two π radian (one full circle).
angl constant
Half turn in degrees.
c3 constant
Wien's constant. In physics, Wien's displacement law states that the black-body radiation curve for different temperatures will peak at different wavelengths that are inversely proportional to the temperature. The shift of that peak is a direct consequence of the Planck radiation law, which describes the spectral brightness or intensity of black-body radiation as a function of wavelength at any given temperature. However, it had been discovered by German physicist Wilhelm Wien several years before Max Planck developed that more general equation, and describes the entire shift of the spectrum of black-body radiation toward shorter wavelengths as temperature increases.
Formally, the wavelength version of Wien's displacement law states that the
spectral radiance of black-body radiation per unit wavelength, peaks at the
wavelength λpeak=c3/T
where T
is absolute temperature.
kq constant
Ratio of the [Boltzman constant][#k-constant] by the
elementary charge: kq=k/qe
.
ε0q constant
Ratio of the vaccum permittivity by the
elementary charge: ε0q=ε0/qe
.
qε0 constant
Product of the vaccum permittivity by the
elementary charge: qε0=ε0·qe
.
εsi constant
Dielectric constant of silicon. The dielectric constant (or relative permittivity), is a material property that measures how well an applied electric field can penetrate a dielectric medium compared to a vacuum. A higher value corresponds to a lower penetration.
εox constant
SiO2 dielectric constant. The dielectric constant (or relative permittivity), is a material property that measures how well an applied electric field can penetrate a dielectric medium compared to a vacuum. A higher value corresponds to a lower penetration.
I0 constant
Reference sound intensity. Sound intensity level or acoustic intensity level is the level of the intensity of a sound relative to a reference value. It is a logarithmic quantity, most often expressed in decibels dB. I0 is the sound intensity used as a reference, corresponding to 0dB.
Dates Constants
BastilleDay constant
French national day
MartinLutherKingDeath constant
Martin Luther King Jr., an African-American clergyman and civil rights movement leader, was fatally shot at the Lorraine Motel in Memphis, Tennessee, on April 4, 1968, at 6:01 p.m.
IndependenceDay constant
Independence Day, known colloquially as the Fourth of July, is a federal holiday in the United States which commemorates the ratification of the Declaration of Independence by the Second Continental Congress on July 4, 1776, establishing the United States of America.
Computing constants
No constant
The value of "No" is false
Yes constant
The value of "Yes" is true
UnixEpoch constant
Date from which all dates are counted in Unix computer systems.
SinclairZX81RAM constant
Amount of memory in the Sinclair ZX81 personal computer. This is also the amount of memory used in the video memory for the mouse cursor at its smallest size on modern computers.
PageSize constant
Base page size in the virtual memory system of most modern computers. Note that for performance reason, many modern computers now support multiple page sizes.
HelloWorld constant
A constant often used in computer programs to denote joy, happiness and the emergence into the world of some new computer language.
Equations library
The DB48X calculator features a library of equations covering mathematics,
physics, chemistry and computer science. The built-in equations can be extended
using the config/equations.csv
configuration file.
Columns and Beams
The variables in the columns and beams section are:
o
: Eccentricity (offset) of loadσcr
: Critical stressσmax
: Maximum stressθ
: Slope atx
A
: Cross-sectional areaa
: Distance to point load- 'ε': Eccentricity
c
: Distance to edge fiber (Eccentric Columns), or Distance to applied moment (beams)E
: Modulus of elasticityI
: Moment of inertiaK
: Effective length factor of columnL
: Length of column or beamM
: Applied momentMx
: Internal bending moment at xP
: Load (Eccentric Columns), or Point load (beams)Pcr
: Critical loadr
: Radius of gyrationV
: Shear force at xw
: Distributed loadx
: Distance along beamy
: Deflection at x
For simply supported beams and cantilever beams (“Simple Deflection” through “Cantilever Shear”), the calculations differ depending upon the location of x relative to the loads.
- Applied loads are positive downward.
- The applied moment is positive counterclockwise.
- Deflection is positive upward.
- Slope is positive counterclockwise
- Internal bending moment is positive counterclockwise on the left-hand part.
- Shear force is positive downward on the left-hand part.
Elastic Buckling
These equations apply to a slender column (K·L/r>100
) with length factor K
.
Eccentric Columns
These equations apply to a slender column (K·L/r>100
) with length factor K
.
Simple Deflection
Simple Slope
Simple Moment
Simple Shear
Cantilever Deflection
Cantilever Slope
Cantilever Moment
Cantilever Shear
Electricity
Fluids
Forces and Energy
Gases
Heat transfer
Magnetism
Motion
Optics
Oscillations
Plane geometry
Solid geometry
Solid state devices
Stress analysis
Waves
Menus
Menus display at the bottom of the screen, and can be activated using the keys
on the top row of the calculator. Menus can refer to other menus. The calculator
keeps a history of the menus you visited previously, and you can return to an
earlier menu with the BackMenu
function.
Here are the main menus in DB48X, in alphabetical order.
MainMenu
The Main menu gives access to all the functions in your calculator, sorted by cathegory. It includes the following submenus:
- Math: Mathematical operations
- Symb: Symbolic operations
- Units: Unit conversions
- System: System configuration
- Prog: Programming
- Vars: User variables
MathMenu
The Math menu gives access to mathematical functions like SIN in your calculator. It includes the following submenus:
- Arith: Arithmetic functions
- Base: Based numbers
- Trans: Transcendental functions
- Stats: Statistics
- Lists: List operations
- Matrix: Matrices and vectors
- Solve: Numerical solver
VariablesMenu (VARS)
The variables menu displays the variables in the current directory. It is a three row menu, where for each variable:
- The primary function evaluates the variable
- The first shifted function recalls the variable
- The second shifted function stores in the variable
VariablesMenuExecute
Hitting the primary function in the Vars menu evaluates the corresponding variable.
VariablesMenuRecall
Hitting the first shifted function in the Vars menu will recall the corresponding variable on the stack.
VariablesMenuStore
Hitting the second shifted function in the Vars menu will store the top of stack in the corresponding variable.
ToolsMenu
The ToolsMenu
maps to the A key (Σ+ on the original DM42 keyboard).
It invokes a context-dependent menu adapted to the top level of the stack.
LastMenu
The LastMenu
function (🟨 A), returns back in the history of past visited menus. The history contains up to 8 entries.
Operations with Angles
ToDegrees (→Deg)
Convert a number or angle to an angle in degrees. If given a number, that number is interpreted using the current angle mode.
ToRadians (→Rad)
Convert a number or angle to an angle in radians. If given a number, that number is interpreted using the current angle mode.
ToGrads (→Grad)
Convert a number or angle to an angle in grads. If given a number, that number is interpreted using the current angle mode.
ToPiRadians (→πr)
Convert a number or angle to an angle in multiple of π radians. If given a number, that number is interpreted using the current angle mode.
ANGTODEG
Convert an angle to degrees
ANGTORAD
Convert an angle to radians
ANGTOGRAD
Convert an angle to grads (gons)
ANGTODMS
Convert an angle to DMS (DD.MMSS)
TORECT
Convert vector or complex to cartesian coordinates
TOPOLAR
Convert vector or complex to polar coordinates
TOSPHER
Convert vector or complex to spherical coordinates
Arithmetic
+ (add)
Add two values.
Y
X
▶ Y+X
- For integer, fractional, decimal or complex numbers, this performs the
expected numerical addition. For example,
1 2 +
is3
. - For equations and symbols, build a sum, eliminating zero additions if autosimplify is active.
- For lists, concatenate lists, or add objets to a list. For example,
{ A } { B } +
is{ A B }
, and{ A B C } "D" +
is{ A B C "D" }
. - For text, concatenate text, or concatenate the text representation of an
object to an existing text. For example
"X" "Y" +
gives"XY"
, and"X=" 1 +
gives"X=1"
.
- (sub)
Subtract two values
Y
X
▶ Y-X
- For integer, fractional, decimal or complex numbers, this performs the
expected numerical subtraction. For example,
1 2 -
is-1
. - For equations and symbols, build a difference, eliminating subtraction of 0 if autosimplify is active.
× (*, mul)
Multiply two values.
Y
X
▶ Y×X
- For integer, fractional, decimal or complex numbers, this performs the
expected numerical multiplication. For example,
3 2 *
is6
. - For vectors, multiply individual elements (this is a deviation from HP48).
For example,
[ 1 2 3 ] [ 4 5 6 ] +
is[ 4 10 18 ]
. - For matrices, perform a matrix multiplication.
- For a matrix and a vector, apply the matrix to the vector.
- For equations and symbols, build a product, eliminating mulitplication by 1 or 0 when autosimplify is active.
- For a list and a positive integer, repeat the list For example,
{ A } 3 *
is{ A A A }
. - For a text and a positive integer, repeat the text. For example
"X" 3 *
gives"XXX"
.
÷ (/, div)
Divide two values two values
Y
X
▶ Y÷X
- For integer, build a fraction. For example
1 7 /
gives1/7
. - For fractional, decimal or complex numbers, this performs the
expected numerical division. For example,
1. 2. /
is0.5
. - For vectors, divide individual elements. For example,
[ 1 2 3 ] [ 3 2 1 ] /
is[ 1/3 1 3 ]
. - For equations and symbols, build a ratio, eliminating division by one and division of 0 when autosimplify is active.
↑ (^, pow)
Raise to the power
Y
X
▶ Y↑X
- For integer, fractional, decimal or complex numbers, this raises the
value in level 2 to the value in level 1. For example,
2 3 ↑
is8
. - For vectors, raise individual elements in the first vector to the power of the corresponding element in the second vector.
- For equations and synbols, build an expression, eliminating special cases when autosimplify is active.
xroot
Raise to the inverse power. X Y xroot
is equivalent to X Y inv pow
.
Y
X
▶ Y↑(1/X)
Integer arithmetic and polynomials
This section documents newRPL commands that are not implemented yet in DB48X.
SETPREC
Set the current system precision
GETPREC
Get the current system precision
Floor
Largest integer less than the input
Ceil
Smallest integer larger than the input
IntegerPart (IP, IntPart)
Integer part of a number
FractionalPart (FP, FracPart)
Fractional part of a number
MODSTO
Set the current system modulo for all MOD operations
MODRCL
Get the current system modulo
POWMOD
Power operator MOD the current system modulo
MOD
Remainder of the integer division
SQ
Square of the input
NEXTPRIME
Smallest prime number larger than the input
FACTORIAL
Factorial of a number
ISPRIME
Return true/false (1/0) if a number is prime or not
MANT
Mantissa of a real number (M*10exp)
XPON
Exponent of a number represented as (M*10exp)
Sign
Sign of a number, -1, 0 or 1.
For complex numbers, returns a unit number on the unit circle with the same argument as the original number.
Percent (%)
Percentage of a number
Y
X
▶ Y×(X÷100)
PercentChange (%CH)
Percentage of change on a number
Y
X
▶ (X÷Y-1)×100
PercentTotal (%T)
Get percentage of a total
Y
X
▶ (X÷Y)×100
GCD
Greatest common divisor
LCM
Least common multiple
IDIV2
Integer division, get quotient and remainder. On DB48X, this is an alias for div2.
Y
X
▶ IP(Y/X)
Y rem X
IQUOT
Quotient of the integer division
ADDTMOD
Addition operator MOD the current system modulo
SUBTMOD
Subtraction operator MOD the current system modulo
MULTMOD
Multiplication operator MOD the current system modulo
PEVAL
Evaluation of polynomial given as vector of coefficients
PCOEF
Coefficients of monic polynomial with the given roots
IEGCD
Extended euclidean algorithm
IABCUV
Find integers u,v to solve au+bv=c
PTCHEBYCHEFF
Nth Tchebycheff polynomial
PLEGENDRE
Nth Legendre polynomial
PHERMITE
Nth Hermite polynomial as used by physics
PTCHEBYCHEFF2
Nth Tchebycheff polynomial of the second kind
PHERMITE2
Nth Hermite polynomial as used in probabilities
DIV2 (QuoRem, IDIV2, QuotientRemainder)
Euclidean division, returning quotient and remainder.
On HP calculators, this only applies for polynomials.
On DB48X, this applies to integers, big integers, decimals, fractions and polynomials. It puts both the quotient and the remainder on the stack. For many data types, this operation is significantly more efficient than computing the quotient and the remainder separately.
Y
X
▶ IP(Y/X)
Y rem X
PDIV2
Polynomial euclidean division as coefficient vector
PDER
Derivative of polynomial as coefficient vector
PINT
Integration of polynomials as coefficient vector
PMUL
Multiplication of polynomials as coefficient vectors
PADD
Addition of polynomials as coefficient vector
PSUB
Subtraction of polynomials as coefficient vector
Min
Smallest of 2 objects
Max
Largest of 2 objects
RND
Round a number to the given number of figures
TRNC
Truncate a number to the given number of figures
DIGITS
Extract digits from a real number
PROOT
All roots of a polynomial
PREVPRIME
Largest prime smaller than the input
FACTORS
Factorize a polynomial or number
Base functions
Evaluate (EVAL)
Evaluate the object at stack level 1.
Mapped to the _ R/S _ key
X
▶ Result of X
evaluation
Negate (NEG)
Negate the value in level 1.
Mapped to the _ +/- _ key
X
▶ 0-X
Invert (INV)
Invert the value in level 1
Mapped to the _ 1/X _ key
X
▶ 1/X
Bitwise operations
Bitwise operations represent bit-manipulation operations such as rotations and shifts. They operate on based numbers, integers or big integers. When operating on based numbers, the operation happens on the number of bits defined by the WordSize setting. For integer values, the maximum number of bits is defined by the MaxNumberBits setting.
ShiftLeft (SL)
Shift the value left by one bit.
Value
▶ Value*2
ShiftLeftByte (SLB)
Shift the value left by one byte (8 bits).
Value
▶ Value*256
ShiftLeftCount (SLC)
Shift the value left by a given number of bits.
Value
Shift
▶ Value*2^Shift
ShiftRight (SR)
Shift the value right by one bit.
Value
▶ Value/2
ShiftRightByte (SRB)
Shift the value right by one byte (8 bits).
Value
▶ Value/256
ShiftRightCount (SRC)
Shift the value right by a given number of bits.
Value
Shift
▶ Value/2^Shift
ArithmeticShiftRight (ASR)
Shift the value right by one bit, preserving the sign bit.
Value
▶ Signed(Value)/2
ArithmeticShiftRightByte (ASRB)
Shift the value right by one byte (8 bits), preserving the sign bit.
Value
▶ Signed(Value)/256
ArithmeticShiftRightCount (ASRC)
Shift the value right by a given number of bits, preserving the sign bit.
Value
Shift
▶ Signed(Value)/2^Shift
RotateLeft (RL)
Rotate the value left by one bit.
Value
▶ RLC(Value, 1)
RotateLeftByte (RLB)
Rotate the value left by one byte (8 bits).
Value
▶ RL(Value, 8)
RotateLeftCount (RLC)
Rotate the value left by a given number of bits.
Value
Shift
▶ RLC(Value, Shift)
RotateRight (RR)
Rotate the value right by one bit.
Value
▶ RRC(Value, 1)
RotateRightByte (RRB)
Rotate the value right by one byte (8 bits).
Value
▶ RRC(Value, 8)
RotateRightCount (RRC)
Rotate the value right by a given number of bits.
Value
Shift
▶ RRC(Value, Shift)
Logical operations
Logical operations operate on truth values.
They can either operate on numbers, where a non-zero value represent True
and
a zero value represents False
. On based numbers, they
operate bitwise on the number of bits defined by the WordSize
setting.
Or
Logical inclusive "or" operation: the result is true if either input is true.
Y
X
▶ Y or X
And
Logical "and" operation: the result is true if both inputs are true.
Y
X
▶ Y and X
Xor
Logical exclusive "or" operation: the result is true if exactly one input is true.
Y
X
▶ Y xor X
Not
Logical "not" operation: the result is true if the input is false.
X
▶ not X
NAnd
Logical "not and" operation: the result is true unless both inputs are true.
Y
X
▶ Y nand X
NOr
Logical "not or" operation: the result is true unless either input is true.
Y
X
▶ Y nor X
Implies
Logical implication operation: the result is true if the first input is false or the second input is true.
Y
X
▶ Y implies X
Equiv
Logical equivalence operation: the result is true if both inputs are true or both inputs are false.
Y
X
▶ Y equiv X
Excludes
Logical exclusion operation: the result is true if the first input is true or the second input is false.
Y
X
▶ Y excludes X
Bitmaps
TOSYSBITMAP
Comments
STRIPCOMMENTS
Remove all comments from a compiled program
Operations with Complex Numbers
RE
Real part of a complex number
IM
Imaginary part of a complex number
ARG
Argument of a complex number
CONJ
Conjugate of a complex number
CPLX2REAL
Split Complex into two Reals
REAL2CPLX
Make Complex from real and imaginary parts
Lists, Matrix and String commands
PUT
Replace an item in a composite
PUTI
Replace an item and increase index
GET
Extract an item from a composite
GETI
Extract an item and increase index
HEAD
Extract the first item in a composite
TAIL
Removes the first item in a composite
OBJDECOMP
Explode an object into its components
REPL
Replace elements in a composite
POS
Find the position of an element in a composite
NPOS
Find object in a composite, starting from index N
POSREV
Find the position of an element, starting from the end
NPOSREV
Find the position from the end, starting at index N
SUB
Extract a group of elements from a composite
SIZE
Number of elements in a composite
RHEAD
Returns the last element from the composite
RTAIL
Removes the last element from the composite
Constants
Constants are defined by the config/constants.csv
, and accessed using
the ConstantsMenu
or the CONST
command.
Library equations are defined by the config/equations.csv
, and accessed using
the EquationsMenu
or the LibEq
command.
Library items are defined by the config/library.csv
, and accessed using the
Library
command or the XLib
command.
Constant (CONST)
Returns the value of a constant from the constants library. The name can be given as a symbol or as text.
'c'
▶ 299792458_m/s
LibraryEquation (LIBEQ)
Returns the value of a library equation from the equation library. The name can be given as a symbol or as text.
"RelativityMassEnergy"
▶ "'E=m*c^2'"
LibraryItem (XLIB)
Returns the value of a library item from the library. The name can be given as a symbol or as text.
'Dedicace'"
▶ "À tous ceux qui se souviennent de Maubert électronique"
Debugging
DB48X offers a variety of capabilities to help debugging RPL programs. These are made available through the DebugMenu, which is the menu that ToolsMenu selects when a program is on the stack.
DebugMenu
The debug menu contains operations necessary to debug RPL programs:
Debug (DBUG)
The Debug
command takes a program or expression as an argument, and starts
debugging execution of it. When a program is halted for debugging, the header
area shows a ♦ symbol, and the next instruction to be executed is shown above
the stack. When a program is single-stepping, the header area shows a ›
symbol.
While a program is being debugged, you can use the command line normally and
even execute programs from it. However, only a single debugging session can
exist. If the program being executed halts, e.g. through the HALT
command or
by being interrupted using the EXIT key, then this is seen as part of the same
debugging session.
SingleStep (SST)
The SingleStep
command steps through a single instruction in the RPL program.
StepOver
The StepOver
command steps over the next instruction. If the next instruction
is a variable name containing a program, execution halts after executing the
program. If the next instruction being shown is a sequence of instructions, for
example the test or the sequence of instructions in tests or loops, then the
entire sequence is evaluated at once.
StepOut
The StepOut
command steps out of the current code block.
MultipleSteps
The MultipleSteps
instruction evaluates an arbitrary number of steps in the
program being debugged. The number of steps to execute is passed as an argument
in the first level of the stack. For example, 40 MultipleSteps
will execute
the next 40 RPL instructions.
Continue (CONT)
The Continue
command resumes execution of the current RPL program at the
current instruction.
Halt
The Halt
instruction interrupts the execution of a program, making it possible
to insert breakpoints at specific locations in a program.
Kill
The Kill
instruction stops the execution of the program currently being
debugged.
Variables
Variables are named storage for RPL values.
Store (STO)
Store an object into a specified location. For example 2 'ABC' STO
stores the value 2
in a global variable named ABC
.
Value
Name
▶
The Value
is copied in a storage location identified by Name
. The storage location depends on the type of Name
, which can be quoted in an expression:
-
Symbol or integer: The value is stored in a global variable with that name in the current directory, which is created if necessary. Whether integers can be used as variable names depends on the
NumberedVariables
setting. -
Local name: The value is stored in the corresponding local variable.
-
Setting name: The value is used for the corresponding setting, as if the setting command had been executed. For example,
16 'Base' STO
has the same effect as16 Base
. -
Text:
Value
is stored in a named file on the flash storage.
Recall (RCL)
Recall an object from a specified location. For example 'ABC' RCL
recalls the value from a global variable named ABC
.
Name
▶ Value
The Value
is fetched from a storage location identified by Name
. The storage location depends on the type of Name
, which can be quoted in an expression:
-
Symbol or integer: The value is fetched from a global variable with that name in the current directory or any enclosing directory. Whether integers can be used as variable names depends on the
NumberedVariables
setting. -
Local name: The value is fetched from the corresponding local variable.
-
Setting name: The value is fetched from the corresponding setting. For example,
'Base' RCL
returns the current value as set byBase
. -
Text:
Value
is fetched from a named file on the flash storage
Flash storage
SwissMicros calculators have built-in flash storage, that can act as a USB disk when the calculator is connected to a computer. DB48X can read and write to this flash storage using the regular STO
and RCL
commands, simply by giving a text containing the file name as the Name
argument of these commands.
The format of the file depends on how the name ends:
-
.txt
: the value is stored as text. -
.48s
: the value is stored as source code in text format. This differs from.txt
files for text objects, which will be quoted. -
.48b
: the value is stored in version-specific binary format. This format is only guaranteed to be readable by the same firmware version that wrote it, but it is more compact, faster and energy efficient than the source format. -
.csv
: The value is stored in comma-separated values format. This is mostly interesting for arrays and lists, which can be echanged with spreadsheets and other PC applications that can input or output CSV files.
StoreAdd (STO+)
Add a value to the content of a variable
StoreSub (STO-)
Subtract a value from the contents of a variable
StoreMul (STO×)
Multiply the contents of a variable by a value
StoreDiv (STO÷)
Divide the contents of a variable by a value
RecallAdd (RCL+)
Add the content of a variable to a value on the stack
RecallSub (RCL-)
Subtract the contents of a variable from a value on a stack
RecallMul (RCL×)
Multiply a value on the stack by the contents of a variable
RecallDiv (RCL÷)
Divide a value on the stack by the contents of a variable
Increment (INCR)
Add one to the content of a variable
Decrement (DECR)
Subtract one from content of a variable
Purge
Delete a global variable from the current directory
Remark: Purge
only removes a variable from the current directory, not the
enclosing directories. Since Recall will fetch variable values from
enclosing directories, it is possible that 'X' Purge 'X' Recall
will fetch a
value for X
from an enclosing directory. Use PurgeAll if you want
to purge a variable including in enclosing directories.
PurgeAll
Delete a global variable from the current directory and enclosing directories.
Remark: If a variable with the same name exists in multiple enclosing
directories, PurgeAll
may purge multiple variables. Use Purge if you
want to only purge a variable in the current directory.
CreateDirectory (CRDIR)
Create new directory
PurgeDirectory (PGDIR)
Purge entire directory tree
UpDirectory (UPDIR)
Change current directory to its parent
HomeDirectory (HOME)
Change current directory to HOME
DirectoryPath (PATH)
Get a path to the current directory
Variables (VARS)
List all visible variables in a directory
▶ { Variables... }
TypedVariables (TVARS)
List variables of a specific type
type
▶ { Variables... }
{ types... }
▶ { Variables... }
See the Type
command for a list of types.
ORDER
Sort variables in a directory
QUOTEID
Add single quotes to a variable name
UNQUOTEID
Remove single quotes from a variable name
HIDEVAR
Hide a variable (make invisible)
UNHIDEVAR
Make a hidden variable visible
CLVAR
Purge all variables and empty subdirectories in current directory
LOCKVAR
Make variable read-only
UNLOCKVAR
Make variable read/write
RENAME
Change the name of a variable
SPROP
Store a property to a variable
RPROP
Recall a property of a variable
PACKDIR
Pack a directory in an editable object
Errors and error handlers
EXITRPL
Panic exit - abort the RPL engine.
EVAL1NEXT
Perform EVAL1 on the next object in a secondary and skips it
RESUME
End error handler and resume execution of main program
DOERR
Issue an error condition
ERRN
Recall the previous error code
ERRM
Recall the previous error message
ERR0
Clear previous error code
HALT
Halt the execution of RPL code
CONT
Continue execution of a halted program
SST
Single-step through a halted program, skip over subroutines
SSTIN
Single-step through a halted program, goes into subroutines
KILL
Terminate a halted program
SETBKPOINT
Set a breakpoint on a halted program
CLRBKPOINT
Remove a breakpoint
DBUG
Halt the given program at the first instruction for debugging
BLAMEERR
Issue an error condition, blame other program for it
EXIT
Early exit from the current program or loop
Flow control
If
The if
statement provides conditional structurs that let a program make
decisions. It comes in two forms:
-
if
conditionthen
true-clauseend
: This evaluates condition and, if true, evaluates true-clause. -
if
conditionthen
true-clauseelse
false-clauseend
: This evaluates condition and, if true, evaluates true-clause, otherwise evaluates false-clause.
A condition is true if:
- It is a number with a non-zero value
- It is the word
True
A condition is false if:
- It is a number with a zero value
- It is the word
False
Case
The case
statement can be used to select one case among many.
Inside a case
, there is a list of conditions, each followed by then
or
when
. Code following then
or when
is executed when the condition is met.
-
A condition preceding
then
is a boolean condition, similar to the condition in anif
statement. -
A condition preceding
when
is a value that must match the current value on the stack exactly.
For example, X case dup 0 < then "N" end dup 0 > then "P" end "Z" end
will return the value "N"
, "P"
or "Z"
depending on whether X
is
negative, positive or null.
The when
syntax is useful to test exact values, for example
X case 0 when "zero" end 1 when "one" end 2 when "two" end end
will compute
the English spelling for value 0
, 1
and 2
.
THENCASE
Conditional CASE ... THEN ... END THEN ... END END statement
ENDTHEN
Conditional CASE ... THEN ... END THEN ... END END statement
ENDCASE
Conditional CASE ... THEN ... END THEN ... END END statement
FOR
Loop FOR ... NEXT/STEP statement
START
Loop START ... NEXT/STEP statement
NEXT
Loop FOR/START ... NEXT statement
STEP
Loop FOR/START ... STEP statement
DO
Loop DO ... UNTIL ... END statement
UNTIL
Loop DO ... UNTIL ... END statement
ENDDO
Loop DO ... UNTIL ... END statement
WHILE
Loop WHILE ... REPEAT ... END statement
REPEAT
Loop WHILE ... REPEAT ... END statement
ENDWHILE
Loop WHILE ... REPEAT ... END statement
IFERR
Conditional IFERR ... THEN ... ELSE ... END statement
THENERR
Conditional IFERR ... THEN ... ELSE ... END statement
ELSEERR
Conditional IFERR ... THEN ... ELSE ... END statement
ENDERR
Conditional IFERR ... THEN ... ELSE ... END statement
FORUP
Loop FORUP ... NEXT/STEP statement
FORDN
Loop FORUP ... NEXT/STEP statement
Flags
Flags are truth value that can be controled and tested by the user.
User flags are identified by a natural number. There are MaxFlags
user flags (default is 128).
System flags are identified by a settings name or a negative integer.
SETLOCALE
Change the separator symbols
SETNFMT
Change the display format for numbers
SetFlag (SF)
Set a user or system flag.
33 SF
sets user flag 0.
'MixedFractions' SetFlag
enables the MixedFractions
setting.
ClearFlag (CF)
Clear a user or system flag
FlipFlag
Invert a user or system flag
TestFlagSet (FS?)
Test if a flag is set
TestFlagClear (FC?)
Test if a flag is clear
TestFlagClearThenClear (FC?C)
Test if a flag is clear, then clear it
TestFlagSetThenClear (FS?C)
Test if a flag is set, then clear it
TestFlagClearThenSet (FC?S)
Test if a flag is clear, then set it
TestFlagSetThenSet (FS?S)
Test if a flag is set, then set it
FlagsToBinary (RCLF)
Recall all system flags as a binary number.
BinaryToFlags (STOF)
Store and replace all system flags from a binary number
Fonts
FNTSTO
Install a user font for system use
FNTRCL
Recall a system font
FNTPG
Purge a user-installed system font
FNTSTK
Recall name of current font for stack area
FNT1STK
Recall name of current font for stack level 1
FNTMENU
Recall name of current font for menu area
FNTCMDL
Recall name of current font for command line area
FNTSTAT
Recall name of current font for status area
FNTPLOT
Recall name of current font for plot objects
FNTFORM
Recall name of current font for forms
STOFNTSTK
Change current font for stack area
STOFNT1STK
Change current font for stack level 1
STOFNTMENU
Change current font for menu area
STOFNTCMDL
Change current font for command line area
STOFNTSTAT
Change current font for status area
STOFNTPLOT
Change current font for plot objects
STOFNTFORM
Change current font for forms
FNTHELP
Recall name of current font for help
FNTHLPT
Recall name of current font for help title
STOFNTHELP
Change current font for help text
STOFNTHLPT
Change current font for help title
Graphic commands
DB48X features a number of graphic commands. While displaying graphics, the stack and headers will no longer be updated.
Coordinates
DB48X recognizes the following types of coordinates
-
Pixel coordinates are specified using based numbers such as
#0
, and correspond to exact pixels on the screen, and . Pixels are counted starting from the top-left corner of the screen, with the horizontal coordinate going from10#0
to10#399
, and the vertical coordinate going from10#0
to10#239
. -
User unit coordinates are scaled according to the content of the
PPAR
orPlotParameters
reserved variables. -
Text coordinates are given on a square grid with a size corresponding to the height of a text line in the selected font. They can be fractional.
Coordinates can be given using one the following object types:
-
A complex number, where the real part represents the horizontal coordinate and the imaginary part represents the vertical coordinate.
-
A 2-element list or vector containing the horizontal and vertical coordinates.
-
A 1-element list of vector containing one of the above.
For some operations, the list or vector can contain additional parameters beyond
the coordinates. The selection of unit or pixel coordinates is done on a per
coordinate basis. For exmaple, { 0 0 }
will be the origin in user coordinates,
in the center of the screen if no PPAR
or PlotParameters
variable is
present.
Note that unlike on the HP48, a complex value in DB48X can contain a based number.
ClearLCD (CLLCD)
Clear the LCD display, and block updates of the header or menu areas.
DrawText (DISP)
Draw the text or object in level 2 at the position indicated by level 1. A text is drawn without the surrounding quotation marks.
If the position in level 1 is an integer, fraction or real number, it is
interpreted as a line number starting at 1 for the top of the screen. For
example, "Hello" 1 disp
will draw Hello
at the top of the screen.
If the position is a based number, it is a row number in pixels. For example,
"Hello" #120d disp
will show the test in the middle of the screen.
If the position in level 1 is a complex number or a list, it is interpreted as
specifying both the horizontal or vertical coordinates, in either pixel or unit
coordinates. For example "Hello" { 0 0 } disp
will draw Hello
starting in
the center of the screen.
Text is drawn using the stack font by default, using the foreground and background patterns.
If level 1 contains a list with more than 2 elements, additional elements provide:
-
A font number for the text
-
An erase flag (default true) which indicates whether the background for the text should be drawn or not.
-
An invert flag (default false) which, if set, will swap the foreground and background patterns.
For example, "Hello" { #0 #0 3 true true } DrawText
will draw Hello
in the
top-left corner (#0 #0
) with the largest (editor) font (font identifier 3
),
erasing the background (the first true
), in reverse colors (the second
true
).
DrawStyledText (DISPXY)
Draw the text or object in level 3 at the position indicated by level 2, using the font specified in level 1. This behaves like DrawText, except for the additional parameter specifying the font size.
This command is compatible with the HP50G usage, where the position is specified by a list containing two decimal integer values. A font size of 1 displays with a small font, a font size of 2 displays with a regular font.
In addition to this HP50G-compatible usage, DispXY
will also accept:
-
A smaller font size, 0, for the help size, and other font sizes above 2, which are compatible with the values given to StackFont.
-
The position can accept the same values as DrawText, including a single integer value indicating a line number, a fractional line position, or coordinates scaled according to PlotParameters.
Show
Display the first level of the stack using the entire screen, with a possible
scroll using the 4, 8, 6 and 2 keys if the object is larger than fits on screen.
This makes it possible to comfortably examine very large objects, like 300!
, a
large program or a complicated equation. Arrow keys can also be used for
horizonal or vertical scrolling.
The maximum size of the graphic object is defined by the MaximumShowWidth and MaximumShowHeight settings.
DrawLine (line)
Draw a line between two points specified by level 1 and level 2 of the stack.
The width of the line is specified by LineWidth. The line is drawn using the foreground pattern.
PlotParameters (PPAR)
The PlotParameters
reserved variable defines the plot parameters, as a list,
with the following elements:
-
Lower Left coordinates as a complex (default
-10-6i
) -
Upper Right coordinates as a complex (default
10+6i
) -
Independent variable name (default
x
) -
Resolution specifying the interval between values of the independent variable (default
0
). A binary numnber specifies a resolution in pixels. -
Axes which can be a complex giving the origin of the axes (default
0+0i
), or a list containing the origin, the tick mark specification, and the names of the axes. -
Type of plot (default
function
) -
Dependent variable name (default
y
)
Local Variables
LSTO
Store to a new local variable
LRCL
Recall content of local variable
HIDELOCALS
Hide local variables from subroutines
UNHIDELOCALS
Unhide local variables from subroutines
INTERNAL_NEWNLOCALS
Arbitrary data containers
MKBINDATA
Create binary data container object
BINPUTB
Store bytes into binary data object
BINGETB
Extract binary data as list of bytes
BINPUTW
Store 32-bit words into binary data object
BINGETW
Extract data from a binary data object as a list of 32-bit words
BINPUTOBJ
Store an entire object into a binary data container
BINGETOBJ
Extract an entire object from a binary data container
BINMOVB
Copy binary data block into a binary data object
BINMOVW
Copy 32-bit words between binary data objects
User Libraries
CRLIB
Create a library from current directory
ATTACH
Install a library
DETACH
Uninstall a library
LIBMENU
Show a menu within a library
LIBMENUOTHR
Show library menu in the other menu
LIBMENULST
Show library menu in the last used menu
LIBSTO
Store private library data
LIBRCL
Recall private library data
LIBDEFRCL
Recall private data with default value
LIBCLEAR
Purge all private data for a specific library
Operations with data
Data in RPL is generally represented using lists, such as { {1 2 } 3 "A"}
.
Numerical data can be represented using arrays, such as [1 2 3 4]
. In the
DB48X implementation of RPL, arrays and list can have any number of dimensions,
and are not necessarily rectangular, although some operations (e.g. matrix
operations using arrays as input) can impose stricter constraints.
→List (ToList)
Build a list from elements on the stack. Level 1 of the stack contains the number of elements in the list. The elements are on the stack, the first element being deepest in the stack. This is the opposite of List→.
A
B
... Count
▶ { A B ... }
List→ (FromList)
Expand a list on the stack and return the number of elements. After executing the command, level 1 contains the number of elements, and a corresponding number of stack levels contain individual elements of the list, the first element being at the deepest level in the stack. This is the opposite of →List. The Obj→ command performs the same operation when applied to a list.
{ A B ... }
▶ A
B
... Count
List→ (FromList)
Expand a list on the stack and return the number of elements. After executing the command, level 1 contains the number of elements, and a corresponding number of stack levels contain individual elements of the list, the first element being at the deepest level in the stack. This is the opposite of →List. The Obj→ command performs the same operation when applied to a list.
{ A B ... }
▶ A
B
... Count
Head
Return the first element of a list, or an Invalid dimension
error if the list
is empty.
{ A B ... }
▶ A
Tail
Return all but the first element of a list, or an Invalid dimension
error if
the list is empty.
{ A B ... }
▶ { B ... }
Map
Apply an operation on all elements in a list or array. The operation on the first level of the stack should take one argument and return a single value.
{ A B ... }
F
▶ { F(A) F(B) ... }
Reduce
Apply a cumulative pairwise operation on all elements in a list or array. The operation on the first level of the stack should take two arguments and combine them into a single value. The result is the repeated application of that operation to all elements.
{ A B ... }
F
▶ F(F(A, B), ...)
Filter
Filter elements in a list of array based on a predicate. The predicate given on level 1 of the stack takes a value as argument, and returns a truth values. The resulting list is built with all elements where the predicate is true.
{ A B ... }
P
▶ { A ... }
if P(A)
is true and P(B)
is false.
Get
Get an element from composite data, such as list, an array or a text. Elements are numbered starting at 1. The index can itself be a list, which is interpreted as successive indices in the data.
For example,
{ A B C } 2 GET
returns B
,
"ABC" 3 GET
returns "C"
,
[ [ 1 2 ] [ 4 5 ] [ 5 6 ] ] { 2 2 } GET
returns 5
.
When the data is a name, data is feched directly from the given named variable.
Data
Index
▶ Element
Put
Put an element into composite data, such as list, an array or a text.
This performs the opposite operation compared to Get
.
Elements are numbered starting at 1. The index can itself be a list, which is interpreted as successive indices in the data.
For example,
{ A B C } 2 'X' PUT
returns { A X C }
,
"ABC" 2 "Hello" PUT
returns "AHelloC"
,
[ [ 1 2 ] [ 4 5 ] [ 5 6 ] ] { 2 2 } 7 PUT
returns [ [ 1 2 ] [4 7 ] [5 6] ]
.
When the data is a name, data is feched directly from the given named variable.
Data
Index
▶ Element
Sort
Sort elements in a list or array, sorting by increasing values when comparing numers, text or symbols.
This may be a little slower than QuickSort
, but is useful to sort
lists or arrays of numerical values or text values.
QuickSort
Sort elements in a list or array using the memory representation of objects.
This guarantees a consistent sorting order, but one that does not necessarily
preserve numerical or textual properties, unlike Sort
. Comparisons are,
however, significantly faster than Sort
.
ReverseSort
Sort a list or array by value, in reverse order compared to Sort
.
ReverseQuickSort
Sort a list or array using the memory representation of objects, in reverse
order compared to QuickSort
.
ReverseList (REVLIST)
Reverse the order of elements in a list
ADDROT
Add elements to a list, keep only the last N elements
SEQ
Assemble a list from results of sequential procedure
Operations with Matrices and vectors
ToArray (→Arry)
Stack to Array Command: Returns a vector of n real or complex elements or a matrix of n × m real or complex elements.
The elements of the result array should be entered in row order.
A1
... An
n
▶ [ A1 ... An ]
A11
... Arc
{ r c }
▶ [[ A11 A1c] [ A21 ... Arc ]]
FromArray (Arry→)
Array to Stack Command: Takes an array and returns its elements as separate real or complex numbers. Also returns a list of the dimensions of the array. If the argument is an n-element vector, the first element is returned to level n + 1 (not level nm + 1), and the nth element to level 2.
[ A1 ... An ]
▶ A1
... An
n
[[ A11 A1c] [ A21 ... Arc ]]
▶ A11
... Arc
{ r c }
TOCOL
Split an array into column vectors
ADDCOL
Instert a column into an array
REMCOL
Remove a column from an array
FROMCOL
Assemble a matrix from its columns
TODIAG
Extract diagonal elements from a matrix
FROMDIAG
Create a matrix with the given diagonal elements
TOROW
Split an array into its row vectors
ADDROW
Insert a row into an array
REMROW
Remove a row from an array
FROMROW
Assemble an array from its rows
TOV2
Assemble a vector from two values
TOV3
Assemble a vector from three values
FROMV
Split a vector into its elements
AXL
Convert a matrix to list and vice versa
BASIS
Find vectors forming a basis of the subspace represented by the matrix
CHOLESKY
Perform Cholesky decomposition on a matrix
CNRM
Column norm (one norm) of a matrix
CON (ConstantArray)
Returns a constant array, defined as an array whose elements all have the same value.
The constant value is an object taken from argument 2/level 1. The resulting array is either a new array, or an existing array with its elements replaced by the constant, depending on the object in argument 1/level 2.
-
Creating a new array: If level 2 contains a list of one or two integers,
CON
returns a new array. If the list contains a single integern
,CON
returns a constant vector withn
elements. If the list contains two integersn
andm
,CON
returns a constant matrix withn
rows andm
columns. -
Replacing the elements of an existing array: If level 2 contains an array,
CON
returns an array of the same dimensions, with each element equal to the constant. -
If level 2 contains a name, the name must identify a variable that contains a valid input for
con
, such as an array. In this case, the content of the variable is replaced with the value generated byCON
n
k
▶ [ k ... k ]
{ n }
k
▶ [ k ... k ]
{ n m }
k
▶ [ [ k ... k ] [ k ... k ] ... [ k ... k ] ]
[ vec ]
k
▶ [ k ... k]
[ [ mat ] ]
k
▶ [ [ k ... k ]]
'name'
k
▶
COND
Column norm condition number of a matrix
CROSS
Cross produce of vectors
CSWP
Swap two columns in a matrix
Determinant (DET)
Compute the determinant of a matrix
DIAGMAP
DOT
Internal product (dot product) of vectors
EGV
EGVL
Compute the eigenvalues of a matrix
GRAMSCHMIDT
HADAMARD
Multiply corresponding elements in a matrix
HILBERT
Assemble a Hilbert symbolic array
IBASIS
Find a basis of the intersection of two vector spaces
IDN (IdentityMatrix)
Identity Matrix Command: Returns an identity matrix, that is, a square matrix with its diagonal elements equal to 1 and its off-diagonal elements equal to 0.
The result is either a new square matrix, or an existing square matrix with its elements replaced by the elements of the identity matrix, according to the argument.
-
Creating a new matrix: If the argument is an integer
n
, a new real identity matrix is returned, with its number of rows and number of columns equal ton
. -
Replacing the elements of an existing matrix: If the argument is a square matrix, an identity matrix of the same dimensions is returned.
-
Generating the identity matrix for a vector: If the argument is a vector with
n
elements, an identity matrix withn
rows andn
columns is created. -
If the argument is a name, the name must identify a variable containing on of the valid inputs. In this case, it is replaced with the result.
n
▶ IDN(n)
{ n }
▶ IDN(n)
{ n n }
▶ IDN(n)
[ n-vec ]
▶ IDN(n)
[[ nxn-mat ]]
▶ IDN(n)
'name'
▶
IMAGE
Find a basis of the image of a linear application
ISOM
JORDAN
KER
Find a basis for the kernel of a linear application
LQ
LSQ
LU
LU factorization of a matrix
MAD
MKISOM
PMINI
Minimal polynomial of a matrix
QR
QR Decomposition of a matrix
RANK
Rank of a matrix
RANM (RandomMatrix)
Returns an array containing random integer values between -9 and 9.
RCI
Multiply a row by a constant
RCIJ
Multiply a row by a constant and add to other row
RDM
Change dimensions of an array
REF
Reduce matrix to echelon form (upper triangular form)
RNRM
Row norm (infinity norm) of a matrix
RREF
Fully reduce to row-reduced echelon form
RREFMOD
RSD
Residual R=B-AX' on a system AX=B
RSWP
Swap two rows in a matrix
SCHUR
SNRM
SRAD
SVD
SVL
SYLVESTER
TRACE
Sum of the items in the diagonal of a matrix
TRAN
Transpose a matrix
TRN
Complex conjugate transpose of a matrix
VANDERMONDE
LDUP
Decompose A into LDUP such that PA=LD-1*U
MMAP
Apply expression or program to the elements of a matrix
Catalog
The Catalog
command is triggered by the +
command while in Alpha mode, or
using 🟨 + otherwise (CAT). It is an auto-completing catalog of all the
available commands or characters.
When entering a program, all commands matching the text currently matched will
be shown. For example, if you typed A
, all commands containing an A
are
displayed in alphabetical order. If you type ACO
, ACOS,
ACOSHand
DataColumn(a possible spelling for
ColΣ`) will all be shown.
Inside text, all characters related to the last entered character will be shown.
For example, if you typed A
, options to add accents to A
or to select the
Greek α
or the related ª
character. If no matching character is found,
the CharactersMenu
characters menu is presented, allowing
you to select specific characters from predefined categories.
CharactersMenu
The CharactersMenu
, which can be accessed using 🟦 2 (CHAR), presents a
convenient way to insert characters.
While entering text, the Catalog also presents matching characters, or the characters menu if none is found.
The characters menus and the catalog behaviour can be configured by modifying
the config/characters.csv
file. Each row in that file contains two texts:
-
The first is the name of the menu. If the name is empty, the menu is not shown, but is used to find characters related to a given character.
-
The second is the list of characters to be shown.
ConstantsMenu
The ConstantsMenu
gives access to numerous constants, shown in
various categories. This includes basic mathematical constants such as π
or
e
, as well as constants related to chemistry, physics, computer science or
history.
The constants menu is defined by the config/constants.csv
file. You are
encouraged to tailor this file to suit your own needs.
Numerical functions
∫ (Integrate)
Perform a numerical integration of a function for a specified variable on a
numerical interval. For example 2 3 'X*(X-3)' 'X' Integrate
returns -7/6
.
The function takes four arguments:
- The lower bound of the integration range
- The higher bound of the integration range
- The program or expression to evaluate
- The integration variable
Root
Root-finder command. Returns a real number that is a value of the specified
variable for which the specified program or algebraic object most nearly
evaluates to zero or a local extremum. For example, 'X^2=3' 'X' 0
returns
X:1.732050807568877293527446341953458
.
The function takes three arguments:
- The program or expression to evaluate
- The variable to solve for
- An initial guess, or a list containing an upper and lower guess.
Objects
Cycle
Cycle through various representations of the object on the first level of the stack.
- Polar <-> Rectangular for complex numbers
- Decimal <-> Fraction
- Integer <-> Based (cycles through the 2, 8, 10 and 16 base)
- Array <-> List <-> Program
- Text <-> Symbol
For unit objects, Cycle
will cycle through all SI prefixes such that the
decimal representations fits within the StandardExponent
range (i.e. that
would not display in scientific mode), increasing the numerical value, and then
switch the value to a fraction and cycle through all fraction representations
that fit within the same numerical range.
For example, if the StandardExponent
is set to 6
, the value 0.1_m
will
cycle as follows:
0.1_m
being a decimal, we move to next scale up as decimal1._dm
10._cm
100._mm
100000._μm
, which is the limit of what can be displayed with 6 digits, so we switch to a fractional representation.100000_μm
being a fraction, we go through the prefixes going down.100_mm
10_cm
1_dm
1/10_m
1/100_dam
1/1000_hm
1/10000_km
, at which point the conversion would be out of range, so we switch back to decimal.0.0001_km
0.001_hm
0.01_dam
0.1_m
at which point the cycle repeats.
Explode (OBJ→)
Explode an object into its sub-components. The various sub-components are placed on the stack, and if necessary, information about the size is places on the first level of the stack.
-
Complex numbers are split into real and imaginary part (for rectangular form) or modulus and argument (for polar form). The latter is an extension compared to classical RPL, which always represent complex numbers in rectangular form.
-
Unit objects are split into the value and unit expression. This is a deviation from standard RPL, which places a unit object on the first level of the stack.
-
Lists, programs and expressions are split into their individual components, and the number of components is placed on the first level of the stack. For programs, this is an extension of standard RPL. For expressions, this is a deviation: HP calculators instead place only the top level object and the arity.
-
Arrays and vectors are split into their individual components, and the number of elements is placed as a list on the first level of the stack. The dimension list has one element for vectors, and two for matrices. If a given matrix is not rectangular, then the command reports an
Invalid dimension
error. -
Text is evaluated as if it had been executed on the command line, in a way similar to the
STR→
command.
Scalable plots and graphics
BEGINPLOT
Initialize a new current plot object
EDITPLOT
Set the current plot object to the given graphic
ENDPLOT
Finish current plot object and leave it on the stack
STROKECOL
Change the current stroke color
STROKETYPE
Change current stroke type
FILLCOL
Change the current fill color
FILLTYPE
Change the current fill type
FILL
Fill the last polygon
STROKE
Draw the outline of the last polygon
FILLSTROKE
Draw the outline and fill the last polygon
MOVETO
Move current coordinates
LINETO
Draw a line
CIRCLE
Draw a circle
RECTANG
Draw a rectangle
CTLNODE
Add a control node to the current polygon
CURVE
Draw a curve using all previous control points
BGROUP
EGROUP
DOGROUP
BASEPT
TRANSLATE
ROTATE
SCALE
CLEARTRANSF
SETFONT
TEXTHEIGHT
TEXTOUT
INITRENDER
Set which library will be used as default renderer
DORENDER
Render a graphics object using the current renderer
PANVIEW
Shift the center of viewport to render graphics
ROTVIEW
SCLVIEW
Set scale to render graphics
VIEWPORT
VIEWALL
SD Card
SDRESET
Reset the file system module
SDSETPART
Set active partition
SDSTO
Store a an object into a file
SDRCL
Recall an object from a file
SDCHDIR
Change current directory
SDUPDIR
Change to parent directory
SDCRDIR
Create a new directory
SDPGDIR
Delete an entire directory
SDPURGE
Delete a file
SDOPENRD
Open a file for read-only operation
SDOPENWR
Open a file for writing
SDOPENAPP
Open a file in append mode
SDOPENMOD
Open a file in modify mode
SDCLOSE
Close an open file
SDREADTEXT
Read text from an open file (UTF-8 encoding)
SDWRITETEXT
Write text to a file (UTF-8 encoding)
SDREADLINE
Read one line of text from a file
SDSEEKSTA
Move position to given offset from start of file
SDSEEKEND
Move position to given offset from end of file
SDSEEKCUR
Move position to given offset from the current point.
SDTELL
Get the current position
SDFILESIZE
Get the file size in bytes
SDEOF
Return true if last operation reached end of file
SDOPENDIR
Open a directory to scan entries
SDNEXTFILE
Get the next entry in a directory that is a file
SDNEXTDIR
Get the next entry in a directory that is a subdirectory
SDNEXTENTRY
Get the next entry in a directory
SDMOVE
Move or rename a file
SDCOPY
Copy a file
SDPATH
Get the path to current directory
SDFREE
Get the free space in the current volume
SDARCHIVE
Create a full calculator backup on a file
SDRESTORE
Restore from a backup stored in a file
SDGETPART
Get the current partition number
Settings
The calculator has a number of user-configurable settings:
The current preferences can be retrieved and saved using the Modes
command.
Modes
Returns a program that will restore the current settings. This program can be saved into a variable to quickly restore a carefully crafted set of preferences. Note that the calculator automatically restores the mode when it loads a state.
Display settings
The display mode controls how DB48X displays numbers. Regardless of the display mode, numbers are always stored with full precision.
DB48X has five display mode (one more than the HP48)s:
StandardDisplay (STD)
Display numbers using full precision. All significant digts to the right of the decimal separator are shown, up to 34 digits.
FixedDisplay (FIX)
Display numbers rounded to a specific number of decimal places.
ScientificDisplay (SCI)
Display numbers in scientific notation, i.e. with a mantissa and an exponent. The mantissa has one digit to the left of the decimal separator and shows the specified number of decimal places.
EngineeringDisplay (SCI)
Display nunmbers as a mantissa with a sepcified number of digits, followed by an exponent that is a multiple of 3.
SignificantDisplay (SIG)
Display up to the given number of digits without trailing zero. This mode is
useful because DB48X can compute with large precision, and it may be useful to
not see all digits. StndardDisplay
is equivalent to 34 SignificantDisplay
,
while 12 SignificantDisplay
should approximate the HP48 standard mode using
12 significant digits.
StandardExponent
Select the maximum exponent before switching to scientific notation. The default value is 9, meaning that display uses scientific notation for exponents outside of -9..9.
MinimumSignificantDigits
Select the minimum number of significant digits before switching to scientific
notation in FIX
and SIG
mode. The default value is 3
, meaning that at
least 3 significant digits will be shown.
A value of 0 is similar to how HP calculators before the HP Prime perform. For
example, with 2 FIX
, the value 0.055
will display as 0.06
, and 0.0055
will display as 0.01
.
A higher value will switch to scienfic mode to show at least the given number of
digits. For instance, with 2 FIX
, if the value is 1
, then 0.055
will still
display as 0.06
but 0.0055
will display as 5.50E-3
. If the value is 2
,
then 0.055
will display as 5.5E-2
. A setting of 1
correspond to what the
HP Prime does.
A value of -1
indicates that you do not want FIX
mode to ever go to
scientific notation for negative exponents. In that case, 0.00055
will display
as 0.00
. This corresponds to how older HP calculators render numbers.
TrailingDecimal
Display a trailing decimal separator to distinguish decimal from integer types. With this setting, 1.0
will display as 1.
. This can be disabled with NoTrailingDecimal.
NoTrailingDecimal
Hide the trailing decimal separator for decimal values with no fractional part. In that mode, 1.0
and 1
will both display identically, although the internal representation is different, the former being a floating-point value while the latter is an integer value.
FancyExponent
Display the exponent in scientific mode using a fancy rendering that is visually similar to the normal mathematical notation.
ClassicExponent
Display the exponent in scientific mode in a way reminiscent of classical HP48 calculators, for example 1.23E-4
.
MixedFractions
Display fractions as mixed fractions when necessary, e.g. 3/2
will show up as 1 1/2
.
ImproperFractions
Display fractions as improper fractions, e.g. 3/2
will show up as 3/2
and not 1 1/2
.
SmallFractions
Show fractions using smaller characters, for example ¹²/₄₃
BigFractions
Show fractions using regular characters, for example 12/43
Angle settings
The angle mode determines how the calculator interprets angle arguments and how it returns angle results.
DB48X has four angle modes:
- Degrees: A full circle is 360 degress
- Radians: A full circle is 2π radians
- Grads: A full circle is 400 radians
- PiRadians: Radians shown as multiple of π
Degrees (DEG)
Select degrees as the angular unit. A full circle is 360 degrees.
Radians (RAD)
Select radians as the angular unit. A full circle is 2π radians, and the angle is shown as a numerical value.
Grads (GRAD)
Select grads as the angular unit. A full circle is 400 grads.
PiRadians (PIRAD)
Select multiples of π as the angular unit. A full circle is 2π radians, shown as a multiple of π.
SetAngleUnits
When this setting is active, inverse trigonometric functoins asin
, acos
and
atan
return a unit value with a unit corresponding to the current AngleMode
.
This makes it possible to have values on the stack that preserve the angle mode
they were computed with. The opposite setting is NoAngleUnits
.
Note that the sin
, cos
and tan
will copmute their value according to the
unit irrespective of this setting. In other words, 30_° SIN
will always give
0.5
, even when computed in Rad
or Grad
mode,
NoAngleUnits
This is the opposite setting to SetAngleUnits
. Inverse trigonometric functions
behave like on the original HP-48 calculator, and return a numerical value that
depends on the current angle mode.
Command display
DB48X can display commands either using a short legacy spelling, usually
identical to what is used on the HP-48 series of calculators, or use an
alternative longer spelling. For example, the command to store a value in a
variable is called STO
in the HP-48, and can also be spelled Store
in DB48X.
Commands are case insensitive, and all spellings are accepted as input irrespective of the display mode.
DB48X has four command spelling modes:
- Lowercase: Display
sto
- Uppercase: Display
STO
- Capitalized: Display
Sto
- LongForm: Display
Store
There are four parallel settings for displaying a variable name such as varName
:
- LowercaseNames: Display as
varname
- UppercaseNames: Display as
VARNAME
- CapitalizedNames: Display as
VarName
- LongFormNames: Display as
varName
LowerCase
Display comands using the short form in lower case, for example sto
.
UpperCase
Display comands using the short form in upper case, for example STO
.
Capitalized
Display comands using the short form capitalized, for example Sto
.
LongForm
Display comands using the long form, for example Store
.
LowerCaseNames
Display names using the short form in lower case, for example varName
will show as varname
.
UpperCase
Display names using the short form in upper case, for example varName
will show as VARNAME
.
Capitalized
Display names using the short form capitalized, for example varName
will show as VarName
.
LongForm
Display names using the long form, for example varName
will show as varName
.
Decimal separator settings
The decimal separator can be either a dot (1.23
) or a comma (1,23
).
DecimalDot
Select the dot as a decimal separator, e.g. 1.23
DecimalComma
Select the comma as a decimal separator, e.g. 1,23
Precision settings
Precision
Set the default computation precision, given as a number of decimal digits. For
example, 7 Precision
will ensure at least 7 decimal digits for compuation, and
1.0 3 /
will compute 0.3333333
in that case.
DB48X supports an arbitrary precision for decimal numbers, limited only by memory and the size of built-in constants needed for the computation of transcendental functions.
SolverImprecision
Set the number of digits that can be ignored when solving. The default value is 6, meaning that if the current precision is 24, we only solve to an accuracy of 18 digits (i.e. 24-6).
Base settings
Integer values can be reprecended in a number of different bases:
- Binary is base 2
- Ocgtal is base 8
- Decimal is base 10
- Hexadecimal is base 16
Binary (BIN)
Selects base 2
Octal (OCT)
Selects base 8
Decimal (DEC)
Selects base 10
Hexadecimal (HEX)
Selects base 16
Base
Select an arbitrary base for computations
WordSize (STWS)
Store the current word size in bits. The word size is used for operations on based numbers. The value must be greater than 1, and the number of bits is limited only by memory and performance.
RecallWordSize (RCWS)
Return the current word size in bits.
STWS
STWS
is a compatibility spelling for the WordSize command.
RCWS
RCWS
is a compatibility spelling for the RecallWordSize
command.
MaxRewrites
Defines the maximum number of rewrites in an equation.
Equations rewrites can go into infinite loops, e.g. 'X+Y' 'A+B' 'B+A' rewrite
can never end, since it keeps rewriting terms. This setting
indicates how many attempts at rewriting will be done before erroring out.
MaxNumberBits
Define the maxmimum number of bits for numbers.
Large integer operations can take a very long time, notably when displaying them
on the stack. With the default value of 1024 bits, you can compute 100!
but
computing 200!
will result in an error, Number is too big
. You can however
compute it seting a higher value for MaxNumberBits
, for example
2048 MaxNumberBits
.
This setting applies to integer components in a number. In other words, it applies separately for the numerator and denominator in a fraction, or for the real and imaginary part in a complex number. A complex number made of two fractions can therefore take up to four times the number of bits specified by this setting.
ToFractionIterations (→QIterations, →FracIterations)
Define the maximum number of iterations converting a decimal value to a
fraction. For example, 1 →FracIterations 3.1415926 →Frac
will give 22/7
,
whereas 3 →FracIterations 3.1415926 →Frac
will give 355/113
.
ToFractionDigits (→QDigits, →FracDigits)
Define the maximum number of digits of precision converting a decimal value to a
fraction. For example, 2 →FracDigits 3.1415926 →Frac
will give 355/113
.
User interface
Various user-interface aspects can be customized, including the appearance of Soft-key menus. Menus can show on one or three rows, with 18 (shifted) or 6 (flat) functions per page, and there are two possible visual themes for the labels, rounded or square.
ThreeRowsMenus
Display menus on up to three rows, with shift and double-shift functions showns above the primary menu function.
SingleRowMenus
Display menus on a single row, with labels changing using shift.
FlatMenus
Display menus on a single row, flattened across multiple pages.
RoundedMenu
Display menus using rounded black or white tabs.
SquareMenus
Display menus using square white tabs.
CursorBlinkRate
Set the cursor blink rate in millisecond, between 50ms (20 blinks per second) and 5000ms (blinking every 5 seconds).
ShowBuiltinUnits
Show built-in units in the UnitsMenu
even when a units file was loaded.
HideBuiltinUnits
Hide built-in units in the UnitsMenu
when a units file was loaded.
The built-in units will still show up if the units file fails to load.
MultiLineResult
Show the result (level 1 of the stack) using multiple lines. This is the opposite of SingleLineResult. Other levels of the stack are controled by MultiLineStack
SingleLineResult
Show the result (level 1 of the stack) on a single line. This is the opposite of MultiLineResult. Other levels of the stack are controled by SingleLineStack
MultiLineStack
Show the levels of the stack after the first one using multiple lines. This is the opposite of SingleLineStack. Other levels of the stack are controled by MultiLineResult
SingleLineStack
Show the levels of the stack after the first one on a single line This is the opposite of MultiLineStack. Other levels of the stack are controled by SingleLineResult
GraphicResultDisplay
Display the first level of the stack (result) using a graphical representations for objects such as expressions or matrices. Note that enabling this setting may increase CPU utilization and reduce battery life compared to text-only rendering.
This is the opposite of TextResultDisplay
TextResultDisplay
Display the first level of the stack (result) using a text-only representations.
This is the opposite of TextResultDisplay
GraphicStackDisplay
Display the stack levels above the first one using a graphical representations for objects such as expressions or matrices. Note that enabling this setting may increase CPU utilization and reduce battery life compared to text-only rendering.
This is the opposite of TextStackDisplay
TextStacktDisplay
Display the stack levels above the first one using a text-only representations.
This is the opposite of GraphicStackDisplay
AutoScaleStack
When using graphic result display, automatically scale down the font size in order to make stack elements fit. Enabling this setting may increase CPU utilization and reduce battery life compared to fixed-size rendering.
This is the opposite of NoStackAutoScale.
NoStackAutoScale
When using graphic result display, do not automatically scale down the font size in order to make stack elements fit.
This is the opposite of AutoScaleStack.
MaximumShowWidth (MaxW)
Maximum number of horizontal pixels used to display an object with Show.
MaximumShowHeight (MaxH)
Maximum number of vertical pixels used to display an object with Show.
EditorWrapColumn
Column at which the editor will start wrapping long lines of code. Wrapping occurs at the end of an object, not in the middle of it.
TabWidth
Width of a tab in the editor, in pixels.
ExitKeepsMenu
By default, the EXIT
key clears the current menu if not editing.
When ExitKeepsMenu
is set, the EXIT
key does not clear the menu.
ExitClearsMenu
Restore the default behaviour where EXIT
clears the current menu when not
editing.
ShowEmptyMenu
Show empty menu entries. For example, when selecting the VariablesMenu
and
there is no variable defined, an empty menu shows up.
HideEmptyMenu.
Restore the default behaviour where empty menus entries are not shown, leaving more space for the stack display.
Statistics settings
LinearFitSums
When this setting is active, statistics functions that return sums, such as
ΣXY
or ΣX²
, operate without any adjustment to the data, i.e. as if the
fitting model in ΣParameters
was LinearFit
.
CurrentFitSums
When this setting is active, statistics functions that return sums, such as
ΣXY
or ΣX²
, will adjust their input according to the current fitting model
in special variable ΣParameters
, in the same way as required for
LinearRegression
.
RandomGeneratorBits
Define the number of random bits generated by ACORN random number generator, between 32 and 4096 bits. The default value is 128 bits. A lower value uses less memory and accelerates computations, but some digits in the resulting numbers may not be adequately random. Conversely, a higher value increases true randomness in the resulting numbers and should be used if you need random numbers with higher Precision than the default 24 digits.
For example, with a value of 64, the generated random numbers will very often contain zeros after the 12th digit. The reason is that 64 bits of randomness corresponds to only 20 digits, which is less than the default 24-digits precision of DB48X.
RandomGeneratorOrder
Define the order of the ACORN random number generator, i.e. the value called k
in the ACORN documentation. This is the number of seed numbers preserved between
generations. A higher value requires more memory and takes more time to compute
but generates higher-quality random numbers. On DB48X, the ACORN order can be
set between 10 and 256. The default value is 32.
Compatibility settings
Various settings control the compatibility of DB48X with various classes of HP calculators.
DetailedTypes
The Type
command returns detailed DB48X type values, which can distinguish
between all DB48X object types, e.g. distinguish between polar and rectangular
objects, or the three internal representations for decimal numbers. Returned
values are all negative, which distinguishes them from RPL standard values, and
makes it possible to write code that accepts both the compatible and detailed
values.
This is the opposite of CompatibleTypes.
CompatibleTypes
The Type
command returns values as close to possible to the values documented
on page 3-262 of the HP50G advanced reference manual. This is the opposite of
NativeTypes.
NumberedVariables
This flag enables numbered variables similar to what existed on earlier RPN calculators. For example, when the setting is active, 2.5 0 STO
stores the value 2.5 in numbered register 0
.
NoNumberedVariables
This flag disables numbered variables, behaving closer to the way RPL calculators work. For example, when the setting is active, 2.5 0 STO
generates an Invalid name
error.
IgnoreSymbolCase
Ignore the case in symbols, i.e. variables X
and x
are the same.
Note that this is different from the way RPL in HP calculators works.
DistinguishSymbolCase
Distinguish the case in symbols, i.e. variables X
and x
are distinct.
This is the way RPL in HP calculators works.
ListAsProgram
When this setting is set, DB48X behaves like the HP48S and later HP devices and
evaluates lists as if they were programs. For example, { 1 2 + } EVAL
returns
3
. The default is ListsAsData.
ListsAsData
When this setting is set, DB48X behaves like the HP28 and evaluates lists as
data. For example, { 1 2 + } EVAL
returns { 1 2 + }
.
KillOnError
An error kills the program without giving you the possibility to debug the
problem. If you want to debug, you need to start the program with Debug
and
then use the Continue
command.
DebugOnError
An error during a program enters the debugger, letting you correct the problem before resuming execution. This is the default setting.
States
The calculator can save and restore state in files with extension .48S
.
This feature is available through the Setup
menu (Shift-0
).
The following information is stored in state files:
- Global variables
- Stack contents
- Settings
Numeric solvers
NUMINT
Numerical integration (adaptive Simpson)
ROOT
Root seeking within an interval
MSOLVE
Multiple non-linear equation solver/optimization search
BISECT
Root seeking (bisection method)
Stack manipulation
ClearStack (CLEAR)
Remove all objects from the stack
Depth
Get the current stack depth
Drop
Remove an object from the stack
X
▶
Drop2
Remove two objects form the stack
DropN
Remove N objects from the stack, N being given in level 1.
Duplicate (DUP)
Duplicate an object on the stack
Duplicate2 (DUP2)
Duplicate two objects on the stack
DuplicateTwice (DUPDUP)
Duplicate the same object twice on the stack
DuplicateN (DUPN)
Duplicate a group of N objects, N being given in stack level 1
LastArguments (LASTARG)
Put the last arguments back on the stack
LastX
Put the last first argument on the stack.
This command does not exist on HP RPL calculators, and is here to make it easier to adapt RPN programs that use LastX a bit more often.
Undo
Restore the stack to its last state before executing an interactive command. Note that this command can be used from a program, but it will restore the state prior to program execution.
NDUPN
Replicate one object N times and return N
Nip
Remove object at level 2 on the stack
Over
Duplicate object at level 2 on the stack
Pick
Duplicate object at position N on the stack
Pick3
Duplicate object at level 3 on the stack
Roll
Move object at level N to level 1
RollD
Move object from level 1 to level N
Rot
Move object from level 3 to level 1
Swap
Exchange objects in levels 1 and 2
Mapped to X⇆Y key
Y
X
▶ X
Y
Unpick
Move object from level 1 to level N.
UnRot
Move object from level 1 to level 3
IFT
Evaluate objects on the stack conditionally
IFTE
Evaluate objects on the stack conditionally
STKPUSH
Push a snapshot of the current stack on the undo stack
STKPOP
Pop a stack snapshot from the undo stack
STKDROP
Drop a snapshot from the undo stack
STKPICK
Copy snapshot in level N to the current stack
STKDEPTH
Get the depth of the undo stack
STKNEW
Push a snapshot of the current stack on the undo stack and clears the current stack
Statistics
RDZ
Initialize random number generator with a seed. If the given seed is zero, then a truly random value based on the internal system clock is used, and the value changes every millisecond.
For any given non-zero value, the sequence of numbers generated by RAND or Random will always be identical.
RAND
Generate a random real number between 0 and 1, 1 being excluded.
DB48X uses an additive congruential random number generator (ACORN), which is configured by two settings, RandomGeneratorOrder and RandomGeneratorBits.
Random
Generate a random number between two bounds.
If the two bounds are integers, then the result is an integer, and the upper
bound is included. For example, 2 4 Random
can generate 2
, 3
or 4
.
Otherwise, the upper bound is excluded. For example, 2. 4. Random
can generate
any number between 2.0
and 4.0
, but the upper bound 4.0
cannot be
generated.
The resulting number is
ΣData (ΣDAT)
The ΣData
variable contains the statistics data, in the form of a matrix.
Note: The ΣData
name is considered a command internally, and as such,
is subject to CommandDisplayMode
and not NamesDisplayMode
.
ΣParameters (ΣPAR)
The ΣParameters
variable contains the statistics parameters, as a list with
five elements:
{ xcol ycol intercept slope fit }
The xcol
value is an integer starting at 1, indicating the independent column.
The ycol
value similarly indicates the dependent column.
The intercept
and slope
are the parameters for the linear regression.
The fit
value is the type of fit being used:
(LinFit
, ExpFit
, PwrFit
, LogFit
);
Note: The ΣParameters
name is considered a command internally, and as such,
is subject to CommandDisplayMode
and not NamesDisplayMode
.
Σ+
Add data to the statistics data array ΣData
.
-
If data is a real or complex number, statistics data is single-column
-
If data is a vector, statistics data has the same number of columns as the size of the vector.
Σ-
Remove the last data entered in the statistics array, and pushes it on the stack.
RecallΣ (RCLΣ)
Recall statistics data and puts it on the stack
StoreΣ (STOΣ)
Stores an array from the stack as statistics data in the ΣData
variable.
ClearΣ (CLΣ)
Clear statistics data.
Average (MEAN, AVG)
Compute the average (mean) of the values in the statistics data. If there is a single column of data, the result is a real number. Otherwise, it is a vector for each column of data.
Median
Compute the median of the values in the statistics data array ΣData
.
MinΣ
Compute the smallest of the values in the statistics data array ΣData
.
MaxΣ
Compute the largest of the values in the statistics data array ΣData
.
ΣSize (NΣ)
Return the number of data rows in the statistics data array ΣData
.
SumOfX (ΣX)
Return the sum of values in the XCol
column of the statistics data array
ΣData
. The values are adjusted according to the current fitting model defined
in ΣParameters
if the CurrentFitSums
setting is active.
SumOfY (ΣY)
Return the sum of values in the YCol
column of the statistics data array
ΣData
. The values are adjusted according to the current fitting model defined
in ΣParameters
if the CurrentFitSums
setting is active.
SumOfXY (ΣXY)
Return the sum of the product of values in the XCol
and YCol
columns of the
statistics data array ΣData
. The values are adjusted according to the current
fitting model defined in ΣParameters
if the CurrentFitSums
setting is
active.
SumOfXSquares (ΣX²)
Return the sum of the squares of the values in the XCol
column of the
statistics data array ΣData
. The values are adjusted according to the current
fitting model defined in ΣParameters
if the CurrentFitSums
setting is
active.
SumOfYSquares (ΣY²)
Return the sum of the squares of the values in the YCol
column of the
statistics data array ΣData
. The values are adjusted according to the current
fitting model defined in ΣParameters
if the CurrentFitSums
setting is
active.
Total (TOT)
Returns the sum of all columns in the statistics data array ΣData
.
Variance (VAR)
Calculates the sample variance of the coordinate values in each of the columns
in the current statistics matrix (ΣData
).
Correlation (CORR)
Returns the correlation coefficient of the independent and dependent data
columns in the current statistics matrix (reserved variable ΣData
).
The columns are specified by the first two elements in the reserved variable
ΣParameters
, set by XCol
and YCol
, respectively. If ΣParameters
does not
exist, Correlation
creates it and sets the elements to their default values
(1 and 2).
Covariance (COV)
Returns the sample covariance of the independent and dependent data columns in
the current statistics matrix (reserved variable ΣData
).
The columns are specified by the first two elements in the reserved variable
ΣParameters
, set by XCol
and YCol
, respectively. If ΣParameters
does not
exist, Correlation
creates it and sets the elements to their default values
(1 and 2).
StandardDeviation (SDEV)
Calculates the sample standard deviation of each of the columns of coordinate values in the current statistics matrix (reserved variable ΣData
).
StandardDeviation
returns a vector of numbers, or a single number there is only one column of data.
The standard deviation is the square root of the Variance
.
LinearRegression (LR)
Uses the currently selected statistical model to calculate the linear regression
coefficients (intercept and slope) for the selected dependent and independent
variables in the current statistics matrix (reserved variable ΣData
).
The columns of independent and dependent data are specified by the first two
elements in the reserved variable ΣParameters
, set by XCol
and YCol
, respectively.
The default independent and dependent columns are 1 and 2.
The selected statistical model is the fifth element in ΣParameters
.
LR stores the intercept and slope (untagged) as the third and fourth elements,
respectively, in ΣParameters
.
The coefficients of the exponential (ExpFit
), logarithmic (LogFit
),
and power (PwrFit
) models are calculated using transformations that allow
the data to be fitted by standard linear regression.
The equations for these transformations are:
LinFit
:y = slope * x + intercept
LogFit
:y = slope * ln(x) + intercept
ExpFit
:y = intercept * exp(slope * x)
PwrFit
:y = intercept * x ^ slope
where b is the intercept and m is the slope. The logarithmic model requires positive x-values (XCOL), the exponential model requires positive y-values (YCOL), and the power model requires positive x- and y-values.
Intercept
Return the intercept value last computed by LinearRegression
This is a DB48X extension, not present on HP calculators
Slope
Return the slope value last computed by LinearRegression
This is a DB48X extension, not present on HP calculators
BestFit
Select the best linear regression mode based on current data, i.e. the regression mode where the correlation value is the highest.
LinearFit (LINFIT)
Select linear fit, i.e. try to model data with a linear equation y = a*x+b
.
ExponentialFit (EXPFIT)
Select exponential fit, i.e. try to model data with an equation y = b*exp(a*x)
LogarithmicFit (LOGFIT)
Select logarithmic fit, i.e. try to model data with an equation y = a*ln(x)+b
.
PowerFit (PWRFIT)
Select power fit, i.e. try to model data with an equation y = x^a * b
.
FrequencyBins (BINS)
Sorts the elements of the independent column (XCol
) of the current statistics
matrix (the reserved variable ΣDat
) into (nbins + 2
) bins, where the left
edge of bin 1 starts at value xmin
and each bin has width xwidth
.
FrequencyBins
returns a matrix containing the frequency of occurrences in each
bin, and a 2-element array containing the frequency of occurrences falling below
or above the defined range of x-values. The array can be stored into the
reserved variable ΣData
and used to plot a bar histogram of the bin data, for
example, by executing BarPlot
.
xmin
xwidth
nbins
▶ [[ n1 .. n2 ]]
[ nlow nhigh ]
PopulationVariance (PVAR)
Calculates the population variance of the coordinate values in each of the m
columns in the current statistics matrix (ΣData
).
The population variance (equal to the square of the population standard deviation) is returned as a vector of m real numbers, or as a single real number if there is a single column of data.
PopulationStandardDeviation (PSDEV)
Calculates the population standard deviation of each of the m columns of
coordinate values in the current statistics matrix (reserved variable ΣData
).
The command returns a vector of m real numbers, or a single real number if there is a single column of data.
PopulationCovariance (PCOV)
Computes the population covariance of the independent and dependent data columns
in the current statistics matrix (reserved variable ΣData
).
The columns are specified by the first two elements in reserved variable
ΣParameters
, set by XCol
and YCol
respectively. If ΣParameters
does not
exist, PCOV
creates it and sets the elements to their default values, 1 and 2.
IndependentColumn (XCOL)
Set the independent variable column in the reserved variable ΣParameters
.
XCol
▶ (Update ΣParameters
)
DependentColumn (YCOL)
Set the dependent variable column in the reserved variable ΣParameters
.
YCol
▶ (Update ΣParameters
)
DataColumns (COLΣ)
Set both the independent and dependent data columns in the reserved variable
ΣParameters
.
XCol
YCol
▶ (Update ΣParameters
)
Operations with Symbolic Expressions
↑Match
Match pattern up and rewrite expression, starting with the innermost subexpressions first. This approach works well for simplifications. A subexpression simplified during one execution will be a simpler argument of its parent expression, so the parent expression can be simplified further.
Expr
{ From
To
} ▶ Expr
Count
Expr
{ From
To
Cond
} ▶ Expr
Count
The first argument Expr
is the expression to transform.
The second argument is a list containing the pattern to match From
,
the replacement pattern To
,
and an optional condition Cond
on the pattern.
↓Match
Match pattern down and rewrite expression, starting with
the outermost expression first. This approach works well for expansion. An
expression expanded during one execution of ↓Match
will contain additional
subexpressions, and those subexpressions can be expanded further.
Expr
{ From
To
} ▶ Expr
Count
Expr
{ From
To
Cond
} ▶ Expr
Count
The first argument Expr
is the expression to transform.
The second argument is a list containing the pattern to match From
,
the replacement pattern To
,
and an optional condition Cond
on the pattern.
Expression rewrite
Operations such as ↑Match
and ↓Match
apply arbitrary transformations on
algebraic expressions. The way this operates is similar to how HP
calculators perform, but with important differences, controlled by flags.
First, patterns can contain wildcards, which are substituted with the
corresponding sub-expression in the matched Expr
.
-
On HP calculators, the wildcard names must begin with
&
, and only an optional external conditions can control what matches or not. -
On DB48X, by default, any name in the pattern acts as a wildcard, and we use
&
to refer to a specific variable i.e.&A
only matches the variable namedA
.
Rationale: The default DB48X approach makes it easier to write transformation
rules for the common cases, the &
character being a bit harder to access on
the calculator's keyboard. The assumption is that we rarely write patterns to
match a specific variable, i.e. replace an expression only if it refers to X
but not to Y
. The HP behaviour can be restored using the ExplicitWildcards
flag.
A further extension in DB48X is to give a semantic meaning to the first letter of variable names:
a
,b
andc
denote numerical constants, like real or integer values.i
,j
are positive integer values which may be zero and may be the result of a computation, i.e.3-3
will match.k
,l
,m
are non-zero positive integer values, which may be the result of a compuation, i.e.3-2
will match.n
,o
,p
are symbols or names like'ABC'
.u
,v
,w
are unique terms, i.e. terms that cannot be presented more than once in an expression.- Names where the initial is lowercase must be sorted, so that
x+y
will matchA+B
but notB+A
.
Another important difference is that on HP calculators, the number of rewrites
of subexpressions is limited to a single pass, irrespective of flag -100
(step-by-step CAS mode), whereas DB48X will repeat application by default (this
can be changed by setting StepByStepAlgebraResults
, or alternatively, by
clearing flag -100
).
This leads to the last important difference. On HP calculators, ↑Match
and
↓Match
return either 0
or 1
in the first level of the stack to indicate if
a replacement occurred. On DB48X, the number of replaced subexpressions is
returned, and it can be greater than 1.
Examples:
'A+B+0' {'X+0' 'X' } ↓Match
returns'A+B' 1
'A+B+C' { 'X+Y' 'Y-X' } ↓Match
returns'C-(B-A)' 2
'(A+B)^3' { 'X^N' 'X*X^(N-1)' } ↓Match
returns(A+B)*(A+B)^2
.
AutoSimplify
Enable automatic reduction of numeric subexpressions according to usual
arithmetic rules. After evaluating AutoSimplify
'X+0
' will evaluate as 'X'
and 'X*1-B*0'
witll evaluate as 'X'
.
The opposite setting is NoAutoSimplify
NoAutoSimplify
Disable automatic reduction of numeric subexpressions according to usual
arithmetic rules. After evaluating NoAutoSimplify
, equations such as'X+0
'
or X*1-B*0
will no longer be simplified during evaluation.
The opposite setting is AutoSimplify
FinalAlgebraResults
Evaluate algebraic rules on symbolic expressions repeatedly until no futher change results from applying them.
StepByStepAlgebraResults
Evaluate algebraic rules on symbolic expressions one step at a time.
→Num (→Decimal, ToDecimal)
Convert fractions and symbolic constants to decimal form.
For example, 1/4 →Num
results in 0.25
.
→Frac (→Q, ToFraction)
Convert decimal values to fractions. For example 1.25 →Frac
gives 5/4
.
The precision of the conversion in digits is defined by
→FracDigits, and the maximum number of iterations for the
conversion is defined by →FracDigits
ListExpressionNames (LName)
List all variables used in an expression or polynomial, leaving the original object on the stack, and returning the result as an array. Names are sorted in decreasing order of size, and for the same size, in alphabetical order.
'A*Foo*G(X;Y;cos Z)
▶ 'A*Foo*G(X;Y;cos Z)
[ Foo A G X Y Z ]
'(U_V)=(I_A)*(R_Ω)'
▶ '(U_V)=(I_A)*(R_Ω)'
[ I R U ]
As a DB48X extension, this command also applies to programs, list and
arrays. Another extension is the ExpressionVariables
command, which extracts the units associated with the variables if there are
any. The LName
command only returns the names, without the associated unit.
ExpressionVariables (XVars)
List all variables used in an expression or polynomial, returning the result as a list. Names are sorted in decreasing order of size, and for the same size, in alphabetical order. If there are units in the expression, the units are returned in the resulting list.
'A*Foo*G(X;Y;cos Z)
▶ { Foo A G X Y Z }
'(U_V)=(I_A)*(R_Ω)'
▶ { (I_A) (R_Ω) (U_V) }
This is a variation of the HP command LNAME
, which is
a bit more convenient to use in programs.
RULEAPPLY1
Match and apply a rule to an expression only once
TRIGSIN
Simplify replacing cos(x)^2+sin(x)^2=1
ALLROOTS
Expand powers with rational exponents to consider all roots
CLISTCLOSEBRACKET
RANGE
Create a case-list of integers in the given range.
ASSUME
Apply certain assumptions about a variable to an expression.
Time, Alarms and System Commands
Date format
The date format is YYYYMMDD
, with an optional fractional part defining the
time, as in YYYYMMDD.HHMMSS
.
Note: the date format is intentionally different from the format on the HP-48.
Time format
The time format is HH.MMSS
with optional hundredths of a second as
in HH.MMSSCC
.
SetDate
Set current system date.
The date format is YYYYMMDD
, with an optional fractional part defining the
time, as in YYYYMMDD.HHMMSS
. If the fractional part is zero, then the time is
not changed.
Note: the date format is intentionally different from the format on the HP-48.
Date+
Add days to a date. The date format is YYYYMMDD
, with an optional fractional part defining the time, as in YYYYMMDD.HHMMSS
, and an optional unit, as in YYYMMDD_date
.
SetTime
Set current time from a stack value HH.MMSSCC
.
An HMS value can also be given, as returned by the Time
command.
ToHMS
Convert decimal time to HH.MMSS
format.
FomHMS
Convert time in HH.MMSS
format to decimal time.
HMS+
Add time in HH.MMSS
format.
HMS-
Subtract time in HH.MMSS
format
Ticks
Return system clock in milliseconds
TEVAL
Perform EVAL and measure elapsed time
Date
Return the current system date as a unit object in the form YYYYMMDD_date
.
This displays on the stack according to date format settings, in a way similar
to what is shown in the header, e.g. 23/Feb/2024
or 2024-02-23
.
DateTime
Return the current system date as a unit object in the form YYYYMMDD_date
.
This displays on the stack according to date format settings, in a way similar
to what is shown in the header, e.g. 23/Feb/2024
or 2024-02-23
.
DDays
Number of days between dates.
Time
Return the current system time as a unit object in the form HH.MMSS_hms
.
This displays on the stack as HH:MM:SS
.
TSTR
JulianDayNumber
Return the Julian day number for the given date and time
ACK
Acknowledge oldest alarm (dismiss)
ACKALL
Acknowledge (dismiss) all alarms
RCLALARM
Recall specified alarm
STOALARM
Create a new alarm
DELALARM
Delete an existing alarm
FINDALARM
Get first alarm due after the given time
Version
Return DB48X version information as text.
▶ "Version information"
FreeMemory
Return the number of bytes immediately available in memory, without performing a cleanup of temporary values (garbage collection).
See also: GarbageCollect, FreeMemory
AvailableMemory (MEM)
Return the number of bytes available in memory.
Remark: The number returned is only a rough indicator of usable memory. In particular, recovery features consume or release varying amounts of memory with each operation.
Before it can assess the amount of memory available, AvailableMemory
removes
objects in temporary memory that are no longer being used. Like on the HP48, you
can therfore use MEM
DROP
to force garbage collection. However, there is
also a dedicated command for that, GarbageCollect.
See also: FreeMemory, GarbageCollect
GarbageCollect
Perform a clean-up of temporary objects and return number of bytes reclaimed.
In order to speed up normal operations, temporaries are only discarded when necessary to make room. This clean-up process, also called garbage collection, occurs automatically when memory is full. Since garbage collection can slow down calculator operation at undesired times, you can force it to occur at a desired time by executing GarbageCollect.
See also: FreeMemory, Purge
Bytes
Return the size of the object and a hash of its value. On classic RPL systems, teh hash is a 5-nibbles CRC32. On DB48X, the hash is a based integer of the current wordsize corresponding to the binary representation of the object.
For example, the integer 7
hash will be in the form #7xx
, where 7
is the
value of the integer, and xx
represents the integer type, as returned by the
Type command.
X
▶ Hash
Size
Type
Return the type of the object as a numerical value. The value is not guaranteed to be portable across versions of DB48X (and pretty much is guarantteed to not be portable at the current stage of development).
If the CompatibleTypes
setting is active, the returned value roughly matches
the value returned by the HP50G. It always returns 29
for arrays, not 3
(real array) nor 4
(complex array). It returns 1
for both polar and
rectangular complex numbers, irrespective of their precision. 128-bit decimal
values return 21
(extended real), 32-bit and 64-bit return 0
(real number).
The separation between 18
(built-in function) and 19
(built-in command) may
not be accurate.
If the DetailedTypes
setting is active, the return value is negative, and
matches the internal representation precisely. For example, distinct values will
be returned for fractions and expressions.
Note The TypeName command returns the type as text, and
this is less likely to change from one release to the next. DB48X-only code
should favor the use of TypeName
, both for portability and readability.
TypeName
Return the type of the object as text. For example, 12 type
returns
"integer"
.
PEEK
Low-level read memory address
POKE
Low level write to memory address
NEWOB
Make a new copy of the given object
USBFWUPDATE
PowerOff (OFF)
Turn calculator off programmatically
SystemSetup
Display the built-in system setup
SaveState
Save the machine's state to disk, using the current state if one was previously loaded. This is intended to quickly save the state for example before a system upgrade.
ScreenCapture
Capture the current state of the screen in a dated file stored on the flash storage under the SCREENS/
directory. This is activated by holding 🟨 and O simultaneously. Pressing the keys one after another activates the DisplayMenu.
Tagged objects
Tagged objects are a way to indicate what a value represents, using a tag
between colons and preceding the object. For example, :X:3
is a tagged
integer, where the tag is X
and the object is 3
.
When displayed on the stack, tags are shown without the leading colon for
readability. For example, the object above shows as X:3
on the stack.
→Tag (ToTag)
Apply a tag to an object. The tag is in level 1 as text or name. The object to
be tagged is in level 2. For example, "Hello" 1 →Tag
results in :Hello:1
.
Like on the HP calculators, it is possible to next tags.
Tag→ (FromTag)
Expand a tagged object in level 1 into its object and tag. The object will be in level 2, the tag will be in level 1 as a text object.
For example, :Hello:1 Tag→
results in "Hello"
in level 1 and 1
in level 2.
DeleteTag (DTAG)
Remove a tag from an object. For example, :Hello:1 DeleteTag
results in 1
.
If there is no tag, the object is returned as is.
Operations on text
TOUTF
Create a Utf8 string from a list of code points
FROMUTF
List all code points in a Utf8 string
ToText (→STR, →TEXT)
Convert an object to its text representation.
Compile (STR→, TEXT→)
Compile and evaluate the text, as if it was typed on the command line.
"1 2 + 4" TEXT→
will push 3
and 4
on the stack.
Char→Code (NUM, CODEPOINT, CharToUnicode)
Return the Unicode codepoint of the first character in the text, or -1
if the
text is empty. "Hello" NUM
returns 72
.
Text→Code (TextToUnicode)
Return a list of the Unicode codepoints for all codepoints in the given text.
"Hello" Text→Code
returns { 72 101 108 108 111 }
.
Code→Text (CHR, Code→Char)
Build a text out of a Unicode codepoint. The argument can be either a single
numerical value or a list of numerical values. A negative numerical value
produces an empty text. { 87 111 114 -22 108 100 }
returns "World"
, the
value -22
producing no character. 42 CHR
returns "*"
, and 34 CHR
returns
""""
, which is a 1-character text containing an ASCII quote "
.
SREV
Reverse the characters on a string
NTOKENS
Number of tokens in a string
NTHTOKEN
Token at position N in a string
NTHTOKENPOS
Position of token N in a string
TRIM
Remove characters at end of string
RTRIM
Remove characters at start of string
SSTRLEN
Length of string in characters
STRLENCP
Length of string in Unicode code points
TONFC
Normalize a string to Unicode NFC
SREPL
Find and replace text in a string
TODISPSTR
Decompile formatted for display
TOEDITSTR
Decompile formatted for edit
Analytic functions
In mathematics, an analytic function is a function that is locally given by a convergent power series. There exist both real analytic functions and complex analytic functions. Functions of each type are infinitely differentiable, but complex analytic functions exhibit properties that do not generally hold for real analytic functions.
DB48X analytic functions generally have a symbolic differentiation form. Many of them also have a symbolic primitive for symbolic integration.
Transcendental functions
sin
Analytic function returning the sine of the argument.
For real arguments, the current angle mode determines the number’s units, unless
angular units are specified. If the argument for sin
is a unit object, then
the specified angular unit overrides the angle mode to determine the result.
For complex arguments, the computation is always done considering that the real part is in radians.
z
▶ sin z
x_angleunit
▶ sin x_angleunit
symbexpr
▶ sin symbexpr
cos
Analytic function returning the cosine of the argument
For real arguments, the current angle mode determines the number’s units, unless
angular units are specified. If the argument for cos
is a unit object, then
the specified angular unit overrides the angle mode to determine the result.
z
▶ cos z
x_angleunit
▶ cos x_angleunit
symbexpr
▶ cos symbexpr
tan
Analytic function returning the tangent of the argument
For real arguments, the current angle mode determines the number’s units, unless
angular units are specified. If the argument for tan
is a unit object, then
the specified angular unit overrides the angle mode to determine the result.
For a real argument that is an odd-integer multiple of 90 degrees, an infinite result is generated.
z
▶ tan z
x_angleunit
▶ tan x_angleunit
symbexpr
▶ tan symbexpr
ASIN
Compute the arcsine
ACOS
Compute the arccosine
ATAN
Compute the arctangent
ATAN2
Compute arctangent(y/x)
LN
Compute natural logarithm
EXP
Compute exponential function
SINH
Compute the hyperbolic sine
COSH
Compute the hyperbolic cosine
TANH
Compute the hyperbolic tangent
ASINH
Compute the hyperbolic arcsine
ACOSH
Compute the hyperbolic arccosine
ATANH
Compute the hyperbolic arctangent
LOG
Compute logarithm in base 10
ALOG
Compute anti-logarithm in base 10
SQRT
Compute the square root
EXPM
Compute exp(x)-1
LNP1
Compute ln(x+1)
PINUM
Numeric constant π with twice the current system precision
User Interface
COPYCLIP
Copy an object to the clipboard
CUTCLIP
Move an object to the clipboard
PASTECLIP
Insert the clipboard contents on the stack
Wait
Wait for a key press or a time lapse.
When the argument is greater than 0, interrupt the program for the given number of seconds, which can be fractional.
When the argument is 0 or negative, wait indefinitely until a key is pressed. The key code for the key that was pressed will be pushed in the stack. If the argument is negative, the current menu will be displayed on the screen during the wait.
KEYEVAL
Simulate a keypress from within a program
KEY
Get instantaneous state of the keyboard
DOFORM
Take a variable identifier with a form list
EDINSERT
Insert given text into the editor
EDREMOVE
Remove characters in the editor at the cursor position
EDLEFT
Move cursor to the left in the editor
EDRIGHT
Move cursor to the right in the editor
EDUP
Move cursor up in the editor
EDDOWN
Move cursor down in the editor
EDSTART
Move cursor to the start of text in the editor
EDEND
Move cursor to the end of text in the editor
EDLSTART
Move cursor to the start of current line in the editor
EDLEND
Move cursor to the end of current line in the editor
EDTOKEN
Extract one full word at the cursor location in the editor
EDACTOKEN
Extract one word at the left of cursor location (suitable for autocomplete)
EDMODE
Change the cursor mode in the editor
SETTHEME
Set system color theme
GETTHEME
Operations with Units
UDEFINE
Create a user-defined unit
UPURGE
Delete a user-defined unit
UnitValue (UVAL)
Return the numeric part of a unit object.
3_km
▶ 3
BaseUnits (UBASE)
Expand all unit factors to their base units.
3_km
▶ 3000_m
Convert
Convert value from one unit to another. This convert the values in the second level of the stack to the unit of the object in the first level of the stack. Only the unit in the first level of the stack is being considered, the actual value is ignored. For example:
3_km
2_m
▶ 3000_m
FactorUnit (UFACT)
Factor the unit in level 1 from the unit expression of the level 2 unit object.
1_W
1_N
▶ 1_N*m/s
→Unit (ToUnit)
Creates a unit object from a real number and the unit part of a unit object.
→Unit
adds units to a number, combining the number and the unit part of a
unit object. The numerical part of the unit object is ignored.
→Unit
is the reverse of Unit→
or of Obj→
applied to a unit object.
3000
2_km
▶ 3000_km
ULIST
List all user-defined units
USB Communications
USBSTATUS
Get status of the USB driver
USBRECV
Receive an object through USB link
USBSEND
Send an object through the USB link
USBOFF
Disable USB port
USBON
Enable USB port
USBAUTORCV
Receive an object and execute it
USBARCHIVE
Create a backup on a remote machine
USBRESTORE
Restore a backup from a remote machine