Minimum to pass 005-test-framework.md

This commit is contained in:
Louis Rubet 2024-01-24 18:38:26 +01:00
parent 6b1544437e
commit c47bf58c38
3 changed files with 8 additions and 2 deletions

@ -1 +1 @@
Subproject commit 2cf6f9a9e56405f21d4b5800e270e47423fb4e7b
Subproject commit bb78d3621a023d30eae744f470c059413f64a186

View file

@ -167,7 +167,7 @@ bool Lexer::GetNumberAt(const string& entry, size_t idx, size_t& next_idx, int&
if (base < 2 || base > 62) return false;
if (numberIdx != 0) token = token.substr(numberIdx);
*r = new mpreal;
if (bfdec_atof(&(*r)->toBfdec(), token.c_str(), nullptr, (limb_t)Bfdec::get_default_prec(), (bf_flags_t)Bfdec::get_default_rnd()) == 0) {
if (bfdec_atof(&(*r)->toBfdec(), token.c_str(), nullptr, Bfdec::get_default_prec(), Bfdec::get_default_rnd()) == 0 && !isnan(**r)) {
if (!positive) *(*r) = -*(*r);
return true;
} else {

View file

@ -74,7 +74,9 @@ vector<Program::keyword_t> Program::keywords_ = {
"set float rounding mode in \n\t\"nearest (even)\", \"toward zero\", \"toward "
"+inf\", \"toward -inf\", \"away from zero\", \"faithful rounding\", \"nearest (away from zero)\""
"\n\tex: \"nearest (even)\" round"},
#endif
{kKeyword, "default", {.prog = &Program::RpnDefault}, "set float representation and precision to default"},
#if 0
{kKeyword, "type", {.prog = &Program::RpnType}, "show type of stack first entry"},
{kKeyword, "hex", {.prog = &Program::RpnHex}, "hexadecimal representation, applies on stack level 0 only"},
{kKeyword, "dec", {.prog = &Program::RpnDec}, "decimal representation, applies on stack level 0 only"},
@ -98,11 +100,15 @@ vector<Program::keyword_t> Program::keywords_ = {
// STACK
{kUndef, "", {.prog = nullptr}, "\nSTACK"},
{kKeyword, "swap", {.prog = &Program::RpnSwap}, "swap 2 first stack entries"},
#endif
{kKeyword, "drop", {.prog = &Program::RpnDrop}, "drop first stack entry"},
#if 0
{kKeyword, "drop2", {.prog = &Program::RpnDrop2}, "drop 2 first stack entries"},
{kKeyword, "dropn", {.prog = &Program::RpnDropn}, "drop n first stack entries"},
#endif
{kKeyword, "del", {.prog = &Program::RpnErase}, "drop all stack entries"},
{kKeyword, "erase", {.prog = &Program::RpnErase}, ""},
#if 0
{kKeyword, "rot", {.prog = &Program::RpnRot}, "rotate 3 first stack entries"},
{kKeyword, "dup", {.prog = &Program::RpnDup}, "duplicate first stack entry"},
{kKeyword, "dup2", {.prog = &Program::RpnDup2}, "duplicate 2 first stack entries"},