Something new for the weekend ;-)
(well, I had a long weekend, so Monday counts!)
BaH.muParser is an extensible high performance math parser library. The speed comes with the conversion of the expression into bytecode.
You can define your own variables, constants, operators and functions.
Currently available via the maxmods SVN repository. Still working on the documentation, and will be released proper once that's done.
A small example of usage :
Enjoy
:o)
(well, I had a long weekend, so Monday counts!)
BaH.muParser is an extensible high performance math parser library. The speed comes with the conversion of the expression into bytecode.
You can define your own variables, constants, operators and functions.
Currently available via the maxmods SVN repository. Still working on the documentation, and will be released proper once that's done.
A small example of usage :
SuperStrict Framework BaH.muParser Import BRL.StandardIO Try Local parser:TmuParser = New TmuParser Local fVal:Double = 1 Local expr:String = "MyFunc(a) * sin(a)" parser.DefineVar("a", fVal) parser.DefineFun1("MyFunc", MyFunction) parser.SetExpr(expr) Print parser.Eval() ' change the value of the variable and re-evaluate fVal = 15 Print parser.Eval() Catch e:TmuParserException Print e.message End Try Function MyFunction:Double(fVal:Double) Return fVal * 10 End Function ' ' Output : ' 0.17452406437283513 ' 38.822856765378113
Enjoy
:o)