Commit graph

14 commits

Author SHA1 Message Date
Christophe de Dinechin
9e95425850 library: Add equations library and object library
These are two catalogs that behave much like the constants catalog,
and inherit most of the code.

The equations library is intended to store standard equations.

The library is for standard objects and various useful objects or
programs.

Both can be organized by topics.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
2dccc72885 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 optional `config/constants.csv` file, in a way
  similar to what existed for units.
* Inverse trigonometric functions (`asin`, `acos` and `atan`) now
  produce unit objects with the current angle mode as a unit. This can
  be configured by the `SetAngleUnits` / `NoAngleUnits` flags.
* `Cycle` (EEX key) now cycles between angle units.
* `R→D` and `D→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 as `Fri 5/Dec/1968`,
  with a format configuration using the same flags as for the header.
  Note that the date format is `YYYYMMDD`, _not_ the same as on HP
  calculators. This allows `YYYYMMDD.hhmmss` for dates with time.
* `Date` and `Time` command to return the current date and time.
  Additionally, `DateTime` returns both date and time, and
  `ChronoTime` returns the time with 1/100s precision.
* `→Date` and `→Time` commands to set the system date and time
* `Date+`, `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,
  adding `1000000_s` to `19681205_date` generates a date with time
  result, `Tue 16/Dec/1968, 13:46:40`
* `JulianDayNumber` and `DateFromJulianDayNumber` 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 in `200!`. 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 for `Show` is set by `MaxW`
  (default is the width of the LCD), the maximum height is set by
  `MaxH` (default is 2048 pixels).
* `AutoScaleStack` and `NoAutoScaleStack` 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 -` returns `0_s` and not `0`.
* Perform computations for `→Q` using integer values, which avoids an
  issue where increasing the number of iterations with an unachievable
  precision could prodduce `1/1` as the fractional result.
* Repair auto-simplification for `i*i=-1`
* Display a negative mixed fraction as `-1 1/3` and not `1 -1/3`.
* Do not insert `()` after a multiplication in algebraic mode
* Accept units and tagged objects in `PolarToReal` and `RealToPolar`
* 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` and `LinFit` in `RegressionMenu`.

== 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, adding videos and screenshots
* doc: Improve the documentation for sin, cos and tan
* tests: Make it possible to interrupt a running test
* help: Skip HTML tags, e.g. <video>
* simulator: Add screenshot capability, and reduce window height
* menus: `ToolsMenu` selects time, date or angle menu based on units

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 15:36:39 +01:00
Christophe de Dinechin
5cf4b7f4ef doc: Update some of the not-implemented features
Some have been implemented now...

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-02-21 00:40:45 +01:00
Christophe de Dinechin
583d1bf5e7 settings: Rename MaxBigNumBits to MaxNumberBits
The idea of "big num" should not make it to the user interface.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-01 16:50:23 +01:00
Christophe de Dinechin
604a1d172b Implement shift and rotate instructions
Implement the following instructions:

* `RotateLeft` (`RL`)
* `RotateRight` (`RR`)
* `RotateLeftByte` (`RLB`)
* `RotateRightByte` (`RRB`)
* `ShiftLeft` (`SL`)
* `ShiftRight` (`SR`)
* `ShiftLeftByte` (`SLB`)
* `ShiftRightByte` (`SRB`)
* `ArithmeticShiftRight` (`ASR`)

DB48X adds counted variants of the above, that shift by an amount other than one
or eight.

* `RotateLeftCount` (`RLC`), rotating left several bits
* `RotateRightCount` (`RRC`), rotating right several bits
* `ShiftLeftCount` (`SLC`), shift left several bits
* `ShiftRightCount` (`SRC`), shift right several bits
* `ArithmeticShiftRightCount` (`ASRC`), arithmetic shift right several bits

Also slight rework of the `BasesMenu`.

Fixes: #622

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-12-01 16:50:06 +01:00
Christophe de Dinechin
e1a7e2fc43 Min and Max operations
The `Min` and `Max` functions compare two elements.

For arrays, they perform an element-by-element comparison.
For lists, they perform a a lexicographic order comparison.

Fixes: #603

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-26 22:46:21 +01:00
Christophe de Dinechin
7e485451d1 Implement the IP and FP commands
The `IP` command return the integer part.
The `FP` command return the fractional part.

Fixes: #601

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-26 22:46:21 +01:00
Christophe de Dinechin
d2394103ad Implement the OBJ→ command
The `OBJ→` explodes 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.

* Fractions are split into numerator and denominator. This is a deviation from
  the HP50G, which treats fractions as algebraic expressions.

* Text is evaluated as if it had been executed on the command line, in a way
  similar to the `STR→` command.

Fixes: #596

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-26 22:46:21 +01:00
Christophe de Dinechin
5646ce709e rpl: Implement Compile (aka STR→)
Implement the `Compile` command, which evaluates a text as if
it was on the command line.

Fixes: #590

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-26 22:46:21 +01:00
Christophe de Dinechin
bd5aa36923 rpl: Implement case statement
Implement the RPL `case` statement, including a `case...when`
extension to traditional RPL.

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 an `if` statement.

* A condition preceding `when` is a value that must match the current
  value on the stack exactly.

For example, the following tests the sign of `X`:

```
X
case
  dup 0 < then "Neg" end
  dup 0 > then "Pos" end
  "Zero"
end
```

The `when` syntax is useful to test exact values, for example, you can
check return the spelling of the ten digits with:

```
X
case
   0 when "zero"  end
   1 when "one"   end
   2 when "two"   end
   3 when "three" end
   4 when "four"  end
   5 when "five"  end
   6 when "size"  end
   7 when "seven" end
   8 when "eight" end
   9 when "nine"  end
end
```

Fixes: #374

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-26 22:46:21 +01:00
Christophe de Dinechin
9f90d6e2b5 stats: Update documentation of implemented features
This is part of #569

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-18 19:48:06 +01:00
Christophe de Dinechin
13ecc55866 debugging: Implement debug features
Thanks to the RPL-stack evaluation loop, it is relatively easy to
implement debugging capabilities without impacting the performance of
the main evaluation loop significantly.

This commit implements the `Debug`, `SingleStep`, `MultipleSteps`,
`StepOver`, `StepOut`, `Halt`, `Continue` and `Kill` commands.

Fixes: #552

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-10 18:09:00 +01:00
Christophe de Dinechin
f0295f9748 units: Add commands to control display of units in menus
Add the `ShowBuiltinUnits` and `HideBuiltinUnits` commands to show or
hide built-in units when a units file is loaded.

Fixes: #542

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-05 14:19:59 +01:00
Christophe de Dinechin
9504166dd9 documentation: Add status of implementation for commands
Copied the various commands from the HP50G's advanced reference manual,
and split them between implemented and not-implemented parts.

Copied the various entries in the `ids.tbl` file to build a section about
commands that only exist in DB48X.

Applied to magic Emacs-fu to add markdown links everywhere.

Fixes: #530

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2023-11-03 16:08:52 +01:00