diff options
author | Adrian Kummerländer | 2012-03-10 20:38:44 +0100 |
---|---|---|
committer | Adrian Kummerländer | 2012-03-10 20:38:44 +0100 |
commit | 6db003f22eef964bca90104902b7597c57ddaa81 (patch) | |
tree | 2076f4551c54da1e8dadba507b9078c485032921 | |
parent | 5d618cc8affb959ac64f9cf502dbddf53fb5e7c5 (diff) | |
download | SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.tar SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.tar.gz SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.tar.bz2 SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.tar.lz SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.tar.xz SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.tar.zst SimpleParser-6db003f22eef964bca90104902b7597c57ddaa81.zip |
Enabled full precision output of results
-rw-r--r-- | main.cpp | 6 | ||||
-rw-r--r-- | tree.cpp | 4 |
2 files changed, 9 insertions, 1 deletions
@@ -1,4 +1,5 @@ #include <iostream> +#include <limits> #include "parser.h" int main(int argc, char *argv[]) @@ -10,7 +11,10 @@ int main(int argc, char *argv[]) Parser *parser = new Parser(); try { - std::cout << parser->calculate(inputTerm, true).result << std::endl; + typedef std::numeric_limits<double> dbl; + std::cout.precision(dbl::digits10); + + std::cout << parser->calculate(inputTerm, false).result << std::endl; } catch ( exception &e ) { @@ -1,4 +1,5 @@ #include "tree.h" +#include <limits> Node::Node() { @@ -103,6 +104,9 @@ Node* Tree::addOperator(Node **place, char oper) string Tree::print(string term) { std::stringstream out; + + typedef std::numeric_limits<double> dbl; + out.precision(dbl::digits10); out << "digraph \"" << term << "\"" << endl << "{" << endl << "node [shape = box];" << endl; |