Active Calculator Component

Active Calculator 2.0 Released

Features  | HistoryFAQ | Support | Buy!   

Do you ever want to evaluate mathematical expressions in your application? Active Calculator, the heavy-duty number crunching component, is what you want. It provides fast and flexible expression evaluation functions as an ActiveX component. You can easily integrate it into the application written in languages that support ActiveX Component such as Visual C++, Visual Basic, Delphi, C++ Builder, .Net languages like C#, VB.Net,  Java, Scripts like Perl, Php, Python.

Here is a quick example in VBScript:

Dim calc
Set calc = CreateObject("XCalc.XCalculator.1") 'Create the object

'Load custom functions, you can define functions for your special purpose

'Detect if there is error in the file
if not calc.IsOK then
MsgBox calc.GetErrorString
end if

'Execute a statement, assign 1 to variable a
calc.Evaluate("a=1", 0)
if not calc.IsOK then
MsgBox calc.GetErrorString
end if

'Evaluate an expression, calculate the expression and get the result in a
a = calc.Evaluate("100+sin(a)", 1)
if not calc.IsOK then
MsgBox calc.GetErrorString
end if
MsgBox CDbl(a)

My fellow programmers, don't spend your precious time to reinvent the wheel now. Get Active Calculator for ONLY $66 NOW!  Then you can easily add the "expression evaluation " function to your web or desktop applications. You can call it from your favorite development tools. Many working examples are supplied. Just have a look at them, you will find Active Calculator is so easy to use.


"The Best Program Of Its Kind On The Market!"

Nice features - we can script on the fly, and it calculates expressions quickly.

Unsure? Unconvinced? I understand. We'll also throw in FREE tech support

But if you're still not sure, try it out for FREE !

We are committed to improving Active Calculator component constantly. See History

Highlight Features:

  • Support all common mathematical expressions
  • Support arithmetic, logic and bitwise operations
  • Report syntax error in expressions
  • Support common control flow in programming languages like for, while, if etc.
  • Return value is numeric value or string
  • Allow custom variables and functions
  • Have many built-in functions
  • Support long integers
  • Comes with documentation full of examples, as well as ready-to-compile/run sample programs





System Requirements:

All windows versions


Double Evaluate(String strText, BOOL bExpr)

Description: Evaluate a string and return the result in double

strText: The input string

bExpr: indicate if strText is an expression only or a statement.
For example, "1+1", "1+sin(2)/cos(1)", "a" are expressions, but "a=1", "a=b+c" are statements. Active Calculator treats expression and statement differently. The statement can be very complex including flow control like for, while etc. And it can be multiline text. While expression only includes mathematical operators or functions.

String EvaluateStr(String strText, BOOL bExpr)

Description: Evaluate a string and return the result as a string

strText: the input string

bExpr: indicate if strText is an expression only or a statement.


Description: Test if last evaluation operation is successful or not

Return TRUE if successful

String GetErrorString ()

Description: Get the detail error information of evaluation

SetCode(String strCode)


strCode : Set the registration code to eliminate the limitation in trial version.

Expression Syntax:

The syntax of the expression or statement follows the definition of the Python script language.

Here lists the operators commonly used:

Operator Description Example
* The * (multiplication) operator yields the product of its arguments A*B
/ The / (division) operators yield the quotient of their arguments A/B
+ The + (addition) operator yields the sum of its arguments A+B
- The - (subtraction) operator yields the difference of its arguments. A-B
% The % (modulo) operator yields the remainder from the division of the first argument by the second A%B
- (unary) The unary - (minus) operator yields the negation of its numeric argument. -A
** Power operator A**B
<< A left shift by n bits is defined as multiplication with pow(2, n ) A<<B
>> A right shift by n bits is defined as division by pow(2, n ) A>>B
& The & operator yields the bitwise AND of its arguments A&B
^ The ^ operator yields the bitwise XOR (exclusive OR) of its arguments A^B
| The | operator yields the bitwise (inclusive) OR of its arguments A|B

>, ==, <,

>=, <=, <>, !=

Comparison operations A>B
or, and, not Boolean operations A or B, A and B


Build-in math functions:

Name Description
pi The mathematical constant pi.
e The mathematical constant e.
ceil( x) Return the ceiling of x as a float, the smallest integer value greater than or equal to x.
fabs( x) Return the absolute value of x
floor( x) Return the floor of x as a float, the largest integer value less than or equal to x.
fmod( x, y)

Return fmod(x, y), as defined by the platform C library.

exp( x) Return e**x.
log( x[, base]) Return the logarithm of x to the given base
log10( x) Return the base-10 logarithm of x.
pow( x, y) Return x**y.
sqrt( x) Return the square root of x.
acos( x) Return the arc cosine of x, in radians.
asin( x) Return the arc sine of x, in radians.
atan( x) Return the arc tangent of x, in radians.
atan2( y, x) Return atan(y / x), in radians. The result is between -pi and pi
cos( x) Return the cosine of x radians.
hypot( x, y) Return the Euclidean norm, sqrt(x*x + y*y).
sin( x) Return the sine of x radians.
tan( x) Return the tangent of x radians.
degrees( x) Converts angle x from radians to degrees.
radians( x) Converts angle x from degrees to radians.
cosh( x) Return the hyperbolic cosine of x.
sinh( x) Return the hyperbolic sine of x.
tanh( x) Return the hyperbolic tangent of x.



The files that need to redistribute Active Calculator with applications are:

XCalc.dll: the component itself

Once registered, you can redistribute Active Calculator royalty-freely. (For details about redistribution, please refer to the license agreement)


If you have any questions or suggestions regards to Active Calculator. Please feel free to email us:

Guangming Software or


  • How do I register the component?
    Answer: Once you buy the component, a registration code will be sent to you by email. After creating an object instance of Active Calculator in your favorite programming languages, calling the SetCode method with the code you got by email before converting text to mp3. In this way, every limitation in trial mode will be removed.
  • Can you do custom development for special usage?
  • Answer: Sure. Please tell us what you need and we can discuss a cost, and then develop custom version on schedule just for you.


12/15/2004 Initial Release