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>
Update copyright to 2024.
Update About text to include the same details as in `VERSION`
Shorten `VERSION` text so that it shows multi-line when no menu is active.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When indexing past the end of a text, return a null pointer.
This allows `GETI` to correctly wrap around.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
When we get a bad arguent value, return the same error as the HP50G
(although an index error would seem more appropriate).
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Test the `min` and `max` commands. The interesting cases are related
to type handling, e.g. rejecting mixed types or preserving all
arithmetic types.
Fixes: #786
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The last regression tests was failing because `XSHIFT` was incorrectly
clearing the `alpha` settting.
Add special keys to reach any of the shift states, e.g. `ALPHA_LS` for
`ALPHA` with left shift.
Fixes: #796
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Integer values were not handled by `algebraic::decimal_to_fraction`,
leading to an incorrect type error.
Fixes: #797
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
There are two possible results for 0^0, depending on the
`ZeroPowerZeroIsUndefined` / `ZeroPowerZeroIsOne` flag.
Fixes: #780
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>
When we are on USB power, we can wait forever, drawing very little
power, preserving whatever is shown on screen.
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
The focus of this release was to reactivate the test suite and fix the
problems that were found activating it.
[![Recording of a full run of the test suite](https://img.youtube.com/vi/aHW2GcX5S6o/maxresdefault.jpg)](https://www.youtube.com/watch?v=aHW2GcX5S6o&list=PLz1qkflzABy-Cs1R07zGB8A9K5Yjolmlf)
New features:
- HMS and DMS operations
- unit: Rendering of `dms` and `hms` 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` and `2+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` with `EXIT_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` and `RCL`
- 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` and `GAnd`
- 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
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Check the `CurveFilling` and `NoPlotAxes` setting, as well as numeric
flags -31 and -29.
Fixes: #778
Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>