From 1fd3c57898f5779db97f1c3a1e9920d2020ee19f Mon Sep 17 00:00:00 2001 From: Louis RUBET Date: Thu, 4 Sep 2014 17:26:38 +0200 Subject: [PATCH] Add representation mode --- src/rpn-mode.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/rpn-mode.h diff --git a/src/rpn-mode.h b/src/rpn-mode.h new file mode 100644 index 0000000..c728db2 --- /dev/null +++ b/src/rpn-mode.h @@ -0,0 +1,21 @@ +void std() +{ + cout << setprecision(FLOATING_DEFAULT_PRECISION); + cout.unsetf(ios_base::floatfield); +} + +void fix() +{ + MIN_ARGUMENTS(1); + ARG_IS_OF_TYPE(0, cmd_number); + + cout << setprecision((int)getf()) << fixed; +} + +void sci() +{ + MIN_ARGUMENTS(1); + ARG_IS_OF_TYPE(0, cmd_number); + + cout << setprecision((int)getf()) << scientific; +}