From 977bee3a7a97d06f29a22a1aa7ed41c1fc56e5bd Mon Sep 17 00:00:00 2001 From: Louis Rubet Date: Sat, 27 May 2017 19:16:00 +0200 Subject: [PATCH] #83: removed bin command and representation --- src/object.cpp | 2 -- src/object.hpp | 3 +-- src/parse.hpp | 2 -- src/program.cpp | 1 - src/rpn-real.hpp | 7 ------- test/02-entry.txt | 11 ++++++----- 6 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/object.cpp b/src/object.cpp index 3afc89d..7577495 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -31,8 +31,6 @@ void object::show(FILE* stream) case number::hex: mpfr_fprintf(stream, string(MPFR_FORMAT_HEX).c_str(), ((number*)this)->_value.mpfr); break; - case number::bin: - fprintf(stream, "\n"); } break; case cmd_string: diff --git a/src/object.hpp b/src/object.hpp index 425c3af..15477a6 100644 --- a/src/object.hpp +++ b/src/object.hpp @@ -151,8 +151,7 @@ struct number : public object enum { dec, - hex, - bin + hex } _representation; // precision diff --git a/src/parse.hpp b/src/parse.hpp index 81f9295..af13e23 100644 --- a/src/parse.hpp +++ b/src/parse.hpp @@ -396,8 +396,6 @@ static bool get_number(const string& entry, program& prog, string& remaining_ent string beg = entry.substr(0, 2); if (beg == "0x" || beg == "0X") num->_representation = number::hex; - else if (beg == "0b" || beg == "0B") - num->_representation = number::bin; else num->_representation = number::dec; diff --git a/src/program.cpp b/src/program.cpp index bf3115e..de54e5a 100644 --- a/src/program.cpp +++ b/src/program.cpp @@ -47,7 +47,6 @@ program::keyword_t program::s_keywords[] = { cmd_undef, "", NULL, "\nREAL REPRESENTATION"}, { cmd_keyword, "dec", &program::dec, "decimal representation" }, { cmd_keyword, "hex", &program::hex, "hexadecimal representation" }, - { cmd_keyword, "bin", &program::bin, "binary representation" }, { cmd_keyword, "std", &program::std, "standard floating numbers representation. ex: [25] std" }, { cmd_keyword, "fix", &program::fix, "fixed point representation. ex: 6 fix" }, { cmd_keyword, "sci", &program::sci, "scientific floating point representation. ex: 20 sci" }, diff --git a/src/rpn-real.hpp b/src/rpn-real.hpp index 9dc5551..2d87a5b 100644 --- a/src/rpn-real.hpp +++ b/src/rpn-real.hpp @@ -144,13 +144,6 @@ void hex() ((number*)_stack->back())->_representation = number::hex; } -void bin() -{ - MIN_ARGUMENTS(1); - ARG_MUST_BE_OF_TYPE(0, cmd_number); - ((number*)_stack->back())->_representation = number::bin; -} - void dec() { MIN_ARGUMENTS(1); diff --git a/test/02-entry.txt b/test/02-entry.txt index 7631821..d1738a7 100644 --- a/test/02-entry.txt +++ b/test/02-entry.txt @@ -18,12 +18,13 @@ erase # real hex erase -0x1234 --> stack should be 4660 +0x1234 0x10.10 +-> stack should be 0x1.234p+12, 0x1.01p+4 -drop -0x10.10 --> stack should be 16.0625 +# real hex (2) +dec swap dec swap +-> stack should be 4660, 16.0625 +erase # real binary erase