Share My Creation Text Expressions Evaluator Code Module

Hello There!

Alternative to Agrahams ExpressionEvaluator Library,
I have just recently converted my evaluator code from B4p to B4a as my start coding for Android.

Function sample use: answer=evaluate.MATHTEXT(txtinp1.Text)

Currently supports the following:

Operators in precedence order are

! : factorial (170 maximum)
^ : exponent
* / mod : multiply, divide and modulus,
+ - : add and subtract

Functions supported are:

COS(r), SIN(r), TAN(r), ACOS(n), ASIN(n), ATAN(n) : radians
COSD(d), SIND(d), TAND(d), ACOSD(n), ASIND(n), ATAND(n) : degrees
LN(n)base e, LOG(n)base 10,
SQRT(n), INT(n),& ABS(n)

Constants recognised are
CPI : Pi
CE : Ex

Also supports Eng'g numbers input like "1.255E-12", "1.255E+12", or "1.255E12"

The code can be easily updated:
Constant values can be added in a lists at line 25
Functions like 'Cos(n)' can be added at line 111 and line 460 (just follow the pattern.)
Customize error messages by searching 'Calcresult' variable.


May not be perfected yet. You can have a look and test for bugs.
Trying and sharing your additions and improvements on this code will be greatly appreciated. Thanks.

EDIT: File updated. Negative result value not returning now fixed.
 

Attachments

  • TextMathExpressionsEvaluatorCodeModule1.1.zip
    8.6 KB · Views: 911
Last edited:
D

Deleted member 103

Guest
Hallo Rioven,

vielen Dank, die Funktionen kann ich gut in mein Programm verwenden.

I can well use the functions in my program.

Ciao,
Filippo
 

Rioven

Active Member
Licensed User
Longtime User
Nice

Hi Filippo!

Good! you can have a look and test. thanks again!
 

RoyalStarz

New Member
Licensed User
Longtime User
Good work on expression evaluator

I am going to use this code in a small project. I am having a bit of a problem with evaluating some strings. 10E-22 yields a return of 0 while all other scientific numbers larger and smaller return properly evaluated results. Any clue as to why this number is a no go?

Thanks again for the hard work.:sign0098:
 

collbarr

Member
Licensed User
Longtime User
Hi Rioven,

Using the guide on how to update the code I have added a couple of functions.
Now I want to add one that uses two parameters - Rnd
Could you suggest how I do it?
 
Top