1
Vote

Issue at 'pi' and 'e' constants

description

I was working in C# using the Mathos Parser (v1.0.5.1), and I noticed that when I used the command

parser.Parse("pi");

the value returned by the parser was 314159265358979 (pi * 100000000000000). The comma/dot just disappeared.

I've already found a solution by myself, I'll write it here so it can be fixed for everyone:
At line 407 of MathParser.cs, the command

_tokens[i] = LocalVariables[_tokens[i]].ToString();

has been returning a value with comma, and the program just work with dot. That's the issue. The solution is to change this command to this:

_tokens[i] = LocalVariables[_tokens[i]].ToString().Replace(',', '.');

I did this change and the problem is solved.
I hope it can help someone!
P.S.: Good work Artem Los, your code helped me a lot!

comments

artemlos wrote Oct 25, 2014 at 1:24 PM

Thank you for your solution! :)
I am very happy Mathos Parser was to some help!

/Artem

P.S. Sorry for such a late reply. I did not receive any notification that this issue was created. If you would like to contact me in future, please use the form at http://artemlos.net/contact or my twitter: @artemlos.