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>
This commit is contained in:
Christophe de Dinechin 2023-11-30 07:47:54 +01:00
parent aa1ba7c7d1
commit 583d1bf5e7
8 changed files with 37 additions and 13 deletions

View file

@ -900,7 +900,7 @@ Hewlett-Packard RPL implementation.
* [MathMenu](#mathmenu)
* [MathModesMenu](#mathmodesmenu)
* [MatrixMenu](#matrixmenu)
* [MaxBigNumBits](#maxbignumbits): Maximum number of bits for a big integer
* [MaxNumberBits](#maxnumberbits): Maximum number of bits used by a number
* [MaxRewrites](#maxrewrites): Maximum number of equation rewrites
* [MemMenu](#memmenu)
* [MenuFirstPage](#menufirstpage)

View file

@ -5,7 +5,7 @@ shifts. They operate on [based numbers](#based-numbers),
[integers](#integers) or [big integers](#big-integers). When operating on based
numbers, the operation happens on the number of bits defined by the
[WordSize](#wordsize) setting. For integer values, the maximum number of bits is
defined by the [MaxBigNumBits](#maxbignumbits) setting.
defined by the [MaxNumberBits](#maxnumberbits) setting.
## ShiftLeft (SL)

View file

@ -276,15 +276,21 @@ Defines the maximum number of rewrites in an equation.
'B+A' rewrite` can never end, since it keeps rewriting terms. This setting
indicates how many attempts at rewriting will be done before erroring out.
## MaxBigNumBits
## MaxNumberBits
Define the maxmimum number of bits for a large integer.
Define the maxmimum number of bits for numbers.
Large integer operations can take a very long time, notably when displaying them
on the stack. With the default value of 1024 bits, you can compute `100!` but
computing `200!` will result in an error, `Number is too big`. You can however
compute it seting a higher value for `MaxBigNumBits`, for example
`2048 MaxBigNumBits`.
compute it seting a higher value for `MaxNumberBits`, for example
`2048 MaxNumberBits`.
This setting applies to integer components in a number. In other words, it
applies separately for the numerator and denominator in a fraction, or for the
real and imaginary part in a complex number. A complex number made of two
fractions can therefore take up to four times the number of bits specified by
this setting.
## ToFractionIterations (→QIterations, →FracIterations)
@ -353,6 +359,24 @@ When this setting is active, statistics functions that return sums, such as
in special variable `ΣParameters`, in the same way as required for
`LinearRegression`.
## DetailedTypes
The `Type` command returns detailed DB48X type values, which can distinguish
between all DB48X object types, e.g. distinguish between polar and rectangular
objects, or the three internal representations for decimal numbers. Returned
values are all negative, which distinguishes them from RPL standard values, and
makes it possible to write code that accepts both the compatible and detailed
values.
This is the opposite of [CompatibleTypes](#compatibletypes).
## CompatibleTypes
The `Type` command returns values as close to possible to the values documented
on page 3-262 of the HP50G advanced reference manual. This is the opposite of
[NativeTypes](#nativetypes).
# States
The calculator can save and restore state in files with extension `.48S`.

View file

@ -506,7 +506,7 @@ bignum_g bignum::multiply(bignum_r yg, bignum_r xg, id ty)
size_t wbits = wordsize(xt);
size_t wbytes = (wbits + 7) / 8;
size_t needed = xs + ys;
if (needed * 8 > Settings.MaxBigNumBits())
if (needed * 8 > Settings.MaxNumberBits())
{
rt.number_too_big_error();
return nullptr;
@ -820,7 +820,7 @@ bignum_p bignum::shift(bignum_r xg, int bits, bool rotate, bool arith)
size_t wbytes = (wbits + 7) / 8;
size_t abits = bits < 0 ? 0 : bits;
size_t needed = std::max(xs + (abits + 7) / 8, wbytes) ;
if (needed * 8 > Settings.MaxBigNumBits())
if (needed * 8 > Settings.MaxNumberBits())
{
rt.number_too_big_error();
return nullptr;

View file

@ -324,7 +324,7 @@ bignum_g bignum::binary(Op op, bignum_r xg, bignum_r yg, id ty)
size_t wbytes = (wbits + 7) / 8;
uint16_t c = 0;
size_t needed = std::max(xs, ys) + 1;
if (needed * 8 > Settings.MaxBigNumBits())
if (needed * 8 > Settings.MaxNumberBits())
{
rt.number_too_big_error();
return nullptr;

View file

@ -721,7 +721,7 @@ SETTING_BITS(BasedSeparatorCommand, 2, ID_BasedSpaces, ID_BasedUnderscore, ID
SETTING(WordSize, 1U, 256U * 1024U, 512U)
ALIAS(WordSize, "stws")
OP(RecallWordSize, "rcws")
SETTING(MaxBigNumBits, 1U, 256U * 1024U, 512U)
SETTING(MaxNumberBits, 1U, 256U * 1024U, 512U)
SETTING(MaxFlags, 8U, 32768U, 128U)
SETTING(MaxRewrites, 1U, 10000U, 100U)
SETTING(FractionIterations, 1U, 10000U, 10U)

View file

@ -1382,7 +1382,7 @@ MENU(MathModesMenu,
"0^0=1", ID_ZeroPowerZeroIsOne,
"0^0=?", ID_ZeroPowerZeroIsUndefined,
MaxBigNumBits::label, ID_MaxBigNumBits,
MaxNumberBits::label, ID_MaxNumberBits,
MaxRewrites::label, ID_MaxRewrites,
FractionIterations::label, ID_FractionIterations,
FractionDigits::label, ID_FractionDigits,

View file

@ -575,8 +575,8 @@ cstring setting::label(object::id ty)
return printf("MLEd %u", s.MultilineEditorFont());
case ID_CursorBlinkRate:
return printf("Blink %u", s.CursorBlinkRate());
case ID_MaxBigNumBits:
return printf("Bits %u", s.MaxBigNumBits());
case ID_MaxNumberBits:
return printf("Bits %u", s.MaxNumberBits());
case ID_MaxRewrites:
return printf("Rwr %u", s.MaxRewrites());