NCalc allows me to use { } [ ] in a math operation?

485 views Asked by At

So, I want to give the answer of { [ 4+(3+2)]} I already have this in a String, but when i tried to use DataTable, it give me error.. Or another way to calculate it with the { } [ ] Thanks

1

There are 1 answers

0
MvG On

When evaluating simple arithmetic expressions, [] or {} are just a notational variant of () to make matching parentheses easier. So you could simply replace them by () and then proceed with that.

There are many corners in Mathematics where these symbols would mean completely different things, e.g. [] for floor, equivalence class, vector, … or {} for fractional part, set, … So it would be wrong to say that any mathematical expression retains its semantics by the above replacement. Be sure you know what kinds of expressions you're dealing with.