Skip to content

Use C++ to evaluate a string. Support complex numbers, function names and variables.

License

Notifications You must be signed in to change notification settings

T-V-J/String_Evaluate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Evaluate

Use C++ to evaluate a string. Support complex numbers, function names and variables.

Call the evaluation function

string msg;
// eval with variables 'x' and 'y'
cout << eval("log(-2) * i + 2 $x ^ ($y - 1)", { "x", "y"} , { Comp(1, 2), Comp(3, 4) }, &msg) << endl;
cout << eval("-arcsin(2-i)") << endl;
cout << eval("abs(3 + 4i)") << endl;
  • Variable Names are started with the symbol $.
  • +, -, *, /, ^ and normal maths function names are supported.
  • Imaginary unit can be i, I, j or J.
  • Brackets can be (), [] or {}.

About

Use C++ to evaluate a string. Support complex numbers, function names and variables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%