matheval / expression-evaluator-c-sharp

Matheval is a mathematical expressions evaluator library written in C#. Allows to evaluate mathematical, boolean, string and datetime expressions
https://matheval.org/
MIT License
107 stars 29 forks source link

Evaluating decimal constants #1

Open ErosOlmi opened 2 years ago

ErosOlmi commented 2 years ago

Hi,

I tried to evaluate "pi/2" and result is ok: 1.570796 Then I tried to evaluate "pi/2+1.570796" but result is "1570797,570796" It seems decimal separator (.) is not interpreted or I'm missing something.

My system is in Italian and if I try to use comma as decimal separator I get error.

Thanks a lot

matheval commented 2 years ago

Dear @ErosOlmi , Thank you for using my library, I will check this error soon.

Gedof commented 2 years ago

Hello, I am having the same problem. My system is in brazilian portuguese if that makes any difference.

Edit: Setting "CultureInfo.CurrentCulture = CultureInfo.InvariantCulture" before the evaluation "fixed it".

matheval commented 2 years ago

Hello, I am having the same problem. My system is in brazilian portuguese if that makes any difference.

Edit: Setting "CultureInfo.CurrentCulture = CultureInfo.InvariantCulture" before the evaluation "fixed it".

@Gedof Thank you somuch,