There was a regression on the i*i=-1 test from the work on constants.
Add it back and extend it to any case that produces real-only results
when auto-simplify is on.
Fixes: #497
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Dynamic constants menu, similar to units menu, which is populated
either from an internal table, or from `config/constants.csv`
Fixes: #497
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we have a flag, show the disabled state with a white circle.
When clicked with a menu, toggle the flag.
Reorganize some settings menu to save a bit of space and add options.
Fixes: #821
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add `R→D` and `D→R` as purely numerical functions, compatible with HP-48.
Add `→Deg`, `→Rad`, `→Grad`, `→πr` commands, which
- Convert a number to the target unit using current angle mode
- Convert an angle to the target angle unit
Fixes: #811
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When the `SetAngleUnits` setting is enabled, `asin`, `acos` and `atan`
will return values with an angle unit that corresponds to the current
angle mode.
The evaluation of such values should be independent from the current
angle mode.
Fixes: #807
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Enable conversions from DMS values to HMS with `ToHMS`,
and from HMS values to DMS with `ToDMS`
Fixes: #813
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
There were some changes in v0.6.5 which impacted tests in a way that
was not correctly taken into account.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This release does not contain much because FOSDEM took a lot of energy.
New features:
* menu: Connect `ceil` and `floor` 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
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add the `dms` unit to angles menu, with value "one degree" so that we
can convert between DMS and decimal degrees using the normal units
menu.
Fixes: #818
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
After the introduction of `_dms` and the parsing of degrees symbols in
numbers, degrees could not be parsed correctly as a unit.
Fixes: #809Fixes: #810
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add an superscript `r` for radians, and superscript `π` for
pi-radians. This commit only adds the glyphs, but changes in parsing
of units is also necessary, see next commits.
Fixes: #809
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When parsing `2∡3°` we should not parse the `°` sign as in
`1°2` (i.e. a DMS number).
Fixes: #806
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add functions to convert real to polar and back.
Update the complex menu to match (and fixes a few other minor things)
Add tests for the complex to real conversion functions.
Fixes; #801
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The functions were implemented but not connected to the corresponding
menu entries in the `RealMenu`.
Fixes: #802
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
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 to `FractionsMenu`
* 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 from `BinaryToFlags`
* 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 to `insert`
* 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
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When doing the sum, we were setting the result as a null pointer,
and collapsing all later results as a consequence.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When running the tests under load, we frequently have issues with the
help tests failing. This is probably due to the time given to draw the
help file being a little too short.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Make sure we do not propagate errors when calling the function to
evaluate, so that the error does not block arithmetic evaluations.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Avoid scrolling when displaying the fractions menu by shortening the
labels for the `FractionIterations` and `FractionDigits` settings.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add `/` to make it easy to enter values such as `1/4` from the
command-line, e.g. when entering complex numbers
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
In order ot make it easier to see plotting as it happens, make refresh
rate for plotting reconfigurable with the `PlotRefreshRate` setting.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This is simply to make testing easier.
The short aliases, `HFP` and `SFP`, are likely to be discarded.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Optimize `abs` and `neg` functions which can be simplified in almost
all cases without invoking the complex "function" mechanism.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add tests checking functions using `float` and `double` formats.
Also add tests running variable-precision code at 120 digits.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The hardware-accelerated floating-point support in the ARM chip is
about 2000 faster than the variable-precision decimal floating point
implementation. It makes sense to use it.
See numbers recorded in `doc/6-Performance.md` for details.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we have a very long message, we were moving `pad` beyond the end
of the padding string. This actually happens for a few rare parsing
tests where the command name is very long, so the overflow check is
necessary.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
If we type `#1234` and then hit the `F1` key in the `BasesMenu`, the
editor is closed, and we need to save last arguments and undo stack.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Rotating left with 64-bit size would return 0, because the bit mask
was incorrectly set to 0.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Add tests for shift and rotate with both small sizes (32, 64, 16 and
13 bits) and for larger sizes (72 and 128 bits).
Fixes: #759
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `FlipFlag` command was not writing the flag state, in effect doing
nothing. Setting the `write` variable ensures that the state is
updated.
The `BinaryToFlags` command was leaving the flags value on the stack
instead of dropping it on success.
Fixes: #800
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
In order to correctly move the selection, it's important to call
`insert`, which knows how to update it, instead of `rt.insert`, which
does not. This also removes a number of explicit `cursor` updates.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Hitting `.` on an existing decimal separator inserts `°`.
Hitting `.` again reverts to `.`.
Hitting `.` after entering a decimal part inserts `′`, and the next
one inserts `″`. This will replace `.` with `°` if necessary.
Fixes: #799
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Parse degree/minutes/second values as fractions
We convert HMS to degrees/minutes/seconds for editing because `:` is
already reserved for tags, and would cause syntax ambiguities.
This is necessary for #799
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Avoid rounding errors for DMS display using fractions for rendering.
Convert to fraction before attaching unit in →HMS.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The `integrate` test is very slow when given polynomials as integrand
and integers as bounds, because it computes everything using large
fractions, and this is quite expensive. Add a test that does it with
decimals and runs much faster.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When using single-line rendering, the `wantCR()` calls would still
cause us to insert undesirable newlines.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Multi-line text and multi-line objects (e.g. matrices) should show
correctly according to the multi-line settings.
Fixes: #479
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>