Commit graph

9 commits

Author SHA1 Message Date
Christophe de Dinechin
d64fdb3452 config: Use config files only for user configuration
Switch to using the built-in data files by default, and extending them
with teh configuration file.

The `ShowBuiltinConstants`, `ShowBuiltinCharacters` and
`ShowBuiltinUnits` are not on by default. The size of the
corresponding `config/*.csv` files are reduced to a really simple
example.

Fixes: #1052

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-27 17:34:02 +02:00
Christophe de Dinechin
ee95439090 constants: Update some outdated values
Some constant values from the HP50G advanced reference manual do not match the
latest data from CODATA.

Fixes: #1045

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-07-27 02:01:47 +02:00
Christophe de Dinechin
6b8fe4bb87 constants: Get values of pi and e by name, not value
We want to be able to have adjusted (short) labels, yet get a
full-precision value, so base the lookup on the name of the constant
instead of its value.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
a1f3cf8392 constants: Add prefix to identify constants, equations and xlib
There was a prefix in the editor in the first iteration of the
implementation for constants. This was actually a good idea, since it
lets us distinguish if you really want a constant or a normal symbol.

One of the main benefits is that there is no namespace clash. For
example, you can again use the `g` name, since the g constant will
actually be (cst) g. This was breaking the part in the Demo that used
`g` as a value for the level of green.

Visually, added three characters that show as (cst), (eq) and (lib) in
the text editor, in order to know what kind of name we are dealing
with.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 11:20:42 +01:00
Christophe de Dinechin
535072fc87 constants: Represent constants with an index
Instead of identifying a constant using a name, use an index in the
constants list, which takes less space and is more efficient at
runtime.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:10 +01:00
Christophe de Dinechin
e2096dcc32 constants: Parse units containing text
Allow `"Hello World"` in a constant

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-11 01:49:09 +01:00
Christophe de Dinechin
9484413d55 constants: Do not use units that don't parse correctly
The unit parser is not too happy with dot multiplication

Fixes: #842

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-03 17:33:54 +01:00
Christophe de Dinechin
dd5db54d97 arithmetic: Symbolic and numeric infinity
Add support for the `InfinityValue` (-22) flag, described in the
HP50G as the "Infinite result exception" flag.

When the flag is set, infinite results are returned either as symbolic
constant infinity `∞` or as its value, currently defined as
`9.99999E999999`.

Whether the infinity value is returned symbolically or numerially
depends on the `NumericalConstants` (-2) and `NumericalResults` (-3)
flags.

Fixes: #835

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
2024-03-02 14:02:14 +01:00
Christophe de Dinechin
beaaee23e4 constants: Evaluate constants from config/constants.csv
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>
2024-03-02 00:55:00 +01:00