Simplify the section on keyboard mapping to focus on keys that change,
removing all the menus excpet the most immediately useful ones.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This is a very basic implementation of unit objects.
Unit objects are treated as equations where the outermost object
is an ID_mkunit operator.
Fixes: #16
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Indicate that `{ 1 2 3} 2 -` does not work yet.
Indicate what `{ 1 2 3 4 5 } 2 /` is supposed to do.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Try to write the sections about the shift keys in a way that makes sense both on
the web and on the calculator.
Continuation of #450
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add a section that explains why the DM-32 keyboard layout is not
really usable without an overlay.
This is part of #450.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
There were two `Help` sections, one describing the built-in help, the other
describing the `Help` command itself. Merged the two.
Fixes: #451
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When `MinimumSignificantDigits` setting is -1, show `0.00055` in
`FIX 2` as `0.00` instead of `5.50E-4`
Fixes: #445
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Incorporate feedback from Cyrille de Brébisson about Maubert section.
Add section for HPCalc.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Allow images in the source markdown files, but skip them on calculator
Note that we need to skip them at runtime if we want to be able to
have them in the GitHub file correctly.
Fixes: #438
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The yellow and blue keys were rendered incorrectly, eating text that
was before them.
Additionally, on the calculator, it makes sense to use the same
symbols that are shown in the indicators area. Added code to support
that.
Fixes: #437
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Fixes the bug where the cursor was not blinking correctly unless some other
animation was happening (bug #407).
Add a setting to adjust the cursor blink rate, `CursorBlinkRate`.
Fixes: #407
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Select the minimum number of significant digits before switching to
scientific notation in `FIX` mode.
The default value is 0, which is similar to how HP calculators
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`.
In other words, setting the value to `0` emulates the behaviour of HP
calculators. Seting the value to `34` will switch to scientific
notation if not all digits can be displayed
Fixes: #412
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
New features
- `root` for numerical root finding (#36)
- `integrate` for numerical integration (#42), using Romberg algorithm
- Auto-simplification of `i*i` as -1 (#411)
Bug fixes:
- `LastArg` and `Undo` were not correct after comparisons (#402)
- Invalid equation created for symbolic comparisions, e.g `A=B` (#403)
- Converting `100!` to a based number would display `#00` (#405)
- Avoid crash if running out of memory processing fractions
- Possible memory corruption during negation of complex numbers (#406)
- Fix typo in `User` settings menu, rename it as `UI`
- `->Q` could give incorrect result for decimal32 and decimal64 (#409, #410)
Enhancements:
- Accelerated editor when `VariablesMenu` is shown (#404)
- Being able to pass equations containing equal sign to solver (e.g. `X+1=3`)
- Insert a single colon `:` inside text
- Sharing more code between plotter, solver and integrator
- Simulator uses the DB48X keyboard by default
- Label for constants menu changed to `CNST`
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `Cycle` function is mostly intended for interactive use, mapped
on the `EEX` key.
Currently implemented cycles:
* Polar <-> Rectangular for complex numbers
* Decimal <-> Fraction
* Integer <-> Based (cycles through the bases)
* Array <-> List <-> Program
* Text <-> Symbol
Fixes: #273
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
All the 'last' things are directly accessible, so there is no real
need for a dedicated menu. Having the command directly accessible
makes more sense from a usability point of view.
Fixes: #396
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `LastX` implementation is not part of any RPL implementation that
I am aware of, but it is a staple of RPN. Implementing it in RPL might
make it easier to backport a few RPN programs.
Fixes: #384
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The tag type is used to add a label to any arbitrary object.
It is parsed as `:Label:object`, and renders the same, except on the
stack where it renders as `Label:object`.
Note that the HP48 renders a label with an extra space. The space is
apparently gone on the HP50.
Fixes: #21
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
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.
Fixes: #324
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement `if` `then` `else` blocks, as well as the `iferr` variants.
Being able to test `iferr` also required implementing several
secondary error-management commands, like `errm`, `errn` and `doerr`.
Fixes: #290Fixes: #291
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement the `type` command that returns the type of an object as an
integer. No attempt is made to match the return value of `TYPE` on the
HP48. Maybe someday if this has any value.
Add the `typename` which is a portable version of the above, returning
the type name as text.
Fixes: #285
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `bytes` command on HP calculators returns the size of the object
in the first level of the stack, and the CRC32 (hash) of the object
in the second level fo the stack.
The implememntation here returns the _complete_ representation of the
object in level 2. Also, the size is always an integral number of
bytes (the Saturn-based calculators were 4-bit, so byte sizes could be
half integer)
The lowest part of the number matches the result of the `type` command.
Fixes: #284
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Following several requests from various users, implement `→Num`
(converting numbers to decimal representation) and its counterpart,
`→Q` (converting numbers to fractions), including the special cases
for pi and i.
Fixes: #255Fixes: #282
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Following a discussion on forums, it looks like the handling
of the `+` operator on lists is worth mentioning.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Use level 3 for anything below "Keyboard interaction", and make
"Keyboard interaction" level 2.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Beginning a rewrite variable name with `u`, `v` or `w` forces it to be
unique across all variables. This is useful to ensure that reordering
terms do not match "no-op".
For example, if you want to rewrite `A+B+A` as `A+A+B`, but do _not_
want this to apply to `A+A+A` where it does nothing, then you can
use the pattern `X+U+X`, where the `U` (for "unique") ensures that
there is no match in the `A+A+A` case where that would make `U`
identical to `X`.
Fixes: #244
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Names that begin with one of `ijklmnpq` only match non-zero integers
It is expected that in most cases, zero is a special-case that has its own
terminating rule.
Fixes: #235Fixes: #236
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add a link to the [HP Museum of calculators](https://www.hpmuseum.org)
to explain why HP's legacy in that respect is so important.
Add a link to [Paul Graham's site](http://www.paulgraham.com/avg.html)
to explain why having a Lisp-like programming language is useful.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add documentation for the `Help` command. That may not be accessible since there
is another topic called `help`.
Fixes: #228
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add explicit limits for the number of rewrites and the maximum size
for big numbers.
Fixes: #214
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
After a lot of experimentation, it turns out that it's not really
possible to use the shift key as originally planned, because it is not
reliably visible when two keys are simultaneously visible. It can only
be combined with key N and O (and maybe a few others), and these
combinations are clearly treated specially (they give some magic
keycode, e.g. screen snapshot with Shift-DISP on the DM42).
It turns out only three keys seem somewhat reliable in combination
with alphabetic keys: ON, UP and DOWN. On works with _almost_ all
keys, but apparently B or C is missing (forgot which one). Up and Down
work with all alphabetic keys. This turns out to be a good thing,
because it gives us an additional option that was not originally
planned: quick access to lowercases.
The behavior implemented in this commit is therefore the following:
- "Up" held with any key gives an uppercase letter
- "Down" held with any key gives a lowercase letter.
A minor side effect is that up and down are now active on release and
not on key press. In practice, this is barely noticeable.
Fixes: #204
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Explain how empty slots work, giving an example that works today.
Initially written with `sin()+cos()`, but that does not work due to #212.
Fixes: #211
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add various elements of storytelling corresponding to the recently
implemented features.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement a general equation rewrite engine that we can use
to implement a variety of computer-algebra features.
Fixes: #203
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Document the various differences in behavior between operations on vector and
matrices on DB48X and on HP's RPL implementations.
Fixes: #192
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This file is used as a reminder while telling the story in a video recording
Fixes: #191
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Implement a context-sensitive `ToolsMenu`, bound to the `Σ+` key.
This menu looks at the stack to attempt to figure out the relevant menu.
Implement a context-sensitive `Help` function on the same principle.
Also fixes a bug in the way the help file was closed.
Fixes: #127 (Tools key)
Fixes: #162 (Help command)
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Functions `sin`, `cos`, `tan`, `asin`, `acos`, `atan` and `atan2`
respect angle settings.
Parsing and rendering of polar angles respects that setting, but
that makes the internally-stored angle component setting dependent
(and it is not correctly updated when changing settings)
Fixes: #119
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Shift-Enter would only cycle between lowercase and uppoercase.
It now cycles Alpha off as well.
This is better for discoverability, and accelerates the test suite.
Fixes: #72
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This makes it possible to quickly save the sate of the calculator.
This is the meaning of the 'SAVE' labeling on the proposed keyboard layout.
Fixes: #113
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `PowerOff` command shuts down the system.
The `SystemSetup` command displays the system setup menu
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Centralize the functions saving all the settings in a single
`Modes` function.
Add settings for word-size and base.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The NonSciRange command controls when the display switches from
standard to scientific notation.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add `Precision` and `PrecisionMode` commands, along with documentation.
This makes it possible to properly test variable-precision computations.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The existing code was really hard to read and maintain. I could not get FIX to
really work the way it's supposed to be, so restarted from the ground up.
While I was thinking about this, added the `SIG` mode for display, which
displays significant digits. I remember some other calculator having that, and
it's neat. It's like `STD`, but with a given precision.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
So now hitting shift twice gets Right Shift, while long press gets Alpha.
Rationale: Alpha is more "orthogonal" to the shifts, and this makes it easier to
get right-shifted things while in Alpha mode.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Also added two non-HP48 commands, AvailableMemory (memory without GC) and
GarbageCollect (run garbage collector, return amount saved)
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Improve the on-line help mostly to test some of the features of the help
rendering engine.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This is distantly derived from the help system I implemented for newRPL, but the
low-memory condition on the DM42 means we try to do everything without
allocating any memory.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>