uCalc API Version: 5.7.0-preview.1 Released: 7/30/2026
Warning
uCalc API Preview Release Notice:This preview documentation describes the intended behavior of the API. It is not fully accurate or complete.The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.Use of the preview version in your production code is not recommended.
Product:
Class:
ID: 13
using uCalcSoftware;
var uc = new uCalc();
static void DisplayArgs(uCalc.Callback cb) {
for (int x = 1; x <= cb.ArgCount(); x++) {
Console.WriteLine(cb.ArgItem(x).ValueStr() + " Type: " + cb.ArgItem(x).DataType.Name);
}
}
uc.DefineFunction("DisplayArgs(ByHandle Arg As AnyType ...)", DisplayArgs);
uc.Eval("DisplayArgs(5, 3+2*#i, 'Hello', True, False, Int16(5+4.1))");
5 Type: double
3+2i Type: complex
Hello Type: string
true Type: bool
false Type: bool
9 Type: int16 using uCalcSoftware; var uc = new uCalc(); static void DisplayArgs(uCalc.Callback cb) { for (int x = 1; x <= cb.ArgCount(); x++) { Console.WriteLine(cb.ArgItem(x).ValueStr() + " Type: " + cb.ArgItem(x).DataType.Name); } } uc.DefineFunction("DisplayArgs(ByHandle Arg As AnyType ...)", DisplayArgs); uc.Eval("DisplayArgs(5, 3+2*#i, 'Hello', True, False, Int16(5+4.1))");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
void ucalc_call DisplayArgs(uCalcBase::Callback cb) {
for (int x = 1; x <= cb.ArgCount(); x++) {
cout << cb.ArgItem(x).ValueStr() + " Type: " + cb.ArgItem(x).DataType().Name() << endl;
}
}
int main() {
uCalc uc;
uc.DefineFunction("DisplayArgs(ByHandle Arg As AnyType ...)", DisplayArgs);
uc.Eval("DisplayArgs(5, 3+2*#i, 'Hello', True, False, Int16(5+4.1))");
}
5 Type: double
3+2i Type: complex
Hello Type: string
true Type: bool
false Type: bool
9 Type: int16 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call DisplayArgs(uCalcBase::Callback cb) { for (int x = 1; x <= cb.ArgCount(); x++) { cout << cb.ArgItem(x).ValueStr() + " Type: " + cb.ArgItem(x).DataType().Name() << endl; } } int main() { uCalc uc; uc.DefineFunction("DisplayArgs(ByHandle Arg As AnyType ...)", DisplayArgs); uc.Eval("DisplayArgs(5, 3+2*#i, 'Hello', True, False, Int16(5+4.1))"); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub DisplayArgs(ByVal cb As uCalc.Callback)
For x As Integer = 1 To cb.ArgCount()
Console.WriteLine(cb.ArgItem(x).ValueStr() + " Type: " + cb.ArgItem(x).DataType.Name)
Next
End Sub
Public Sub Main()
Dim uc As New uCalc()
uc.DefineFunction("DisplayArgs(ByHandle Arg As AnyType ...)", AddressOf DisplayArgs)
uc.Eval("DisplayArgs(5, 3+2*#i, 'Hello', True, False, Int16(5+4.1))")
End Sub
End Module
5 Type: double
3+2i Type: complex
Hello Type: string
true Type: bool
false Type: bool
9 Type: int16 Imports System Imports uCalcSoftware Public Module Program Public Sub DisplayArgs(ByVal cb As uCalc.Callback) For x As Integer = 1 To cb.ArgCount() Console.WriteLine(cb.ArgItem(x).ValueStr() + " Type: " + cb.ArgItem(x).DataType.Name) Next End Sub Public Sub Main() Dim uc As New uCalc() uc.DefineFunction("DisplayArgs(ByHandle Arg As AnyType ...)", AddressOf DisplayArgs) uc.Eval("DisplayArgs(5, 3+2*#i, 'Hello', True, False, Int16(5+4.1))") End Sub End Module
ID: 32
using uCalcSoftware;
var uc = new uCalc();
var VariableX = uc.DefineVariable("x");
var ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer
// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer
// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer
// (such as evaluating a variable that was explicitly defined as integer;
// other arithmetic operators typically evaluate to Double floating point).
for (double x = 1; x <= 10; x++) {
VariableX.Value(x);
Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString());
}
ParsedExpr.Release();
VariableX.Release();
x = 1 Result = 0
x = 2 Result = 1
x = 3 Result = 1
x = 4 Result = 2
x = 5 Result = 2
x = 6 Result = 3
x = 7 Result = 3
x = 8 Result = 4
x = 9 Result = 4
x = 10 Result = 5 using uCalcSoftware; var uc = new uCalc(); var VariableX = uc.DefineVariable("x"); var ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer // NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer // (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer // (such as evaluating a variable that was explicitly defined as integer; // other arithmetic operators typically evaluate to Double floating point). for (double x = 1; x <= 10; x++) { VariableX.Value(x); Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString()); } ParsedExpr.Release(); VariableX.Release();
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
auto VariableX = uc.DefineVariable("x");
auto ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer
// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer
// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer
// (such as evaluating a variable that was explicitly defined as integer;
// other arithmetic operators typically evaluate to Double floating point).
for (double x = 1; x <= 10; x++) {
VariableX.Value(x);
cout << "x = " + VariableX.ValueStr() + " Result = " + to_string(ParsedExpr.EvaluateInt32()) << endl;
}
ParsedExpr.Release();
VariableX.Release();
}
x = 1 Result = 0
x = 2 Result = 1
x = 3 Result = 1
x = 4 Result = 2
x = 5 Result = 2
x = 6 Result = 3
x = 7 Result = 3
x = 8 Result = 4
x = 9 Result = 4
x = 10 Result = 5 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; auto VariableX = uc.DefineVariable("x"); auto ParsedExpr = uc.Parse("x / 2", "Integer"); // Causes output of "x / 2" to convert to an integer // NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer // (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer // (such as evaluating a variable that was explicitly defined as integer; // other arithmetic operators typically evaluate to Double floating point). for (double x = 1; x <= 10; x++) { VariableX.Value(x); cout << "x = " + VariableX.ValueStr() + " Result = " + to_string(ParsedExpr.EvaluateInt32()) << endl; } ParsedExpr.Release(); VariableX.Release(); }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Dim VariableX = uc.DefineVariable("x")
Dim ParsedExpr = uc.Parse("x / 2", "Integer") '// Causes output of "x / 2" to convert to an integer
'// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer
'// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer
'// (such as evaluating a variable that was explicitly defined as integer;
'// other arithmetic operators typically evaluate to Double floating point).
For x As Double = 1 To 10
VariableX.Value(x)
Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString())
Next
ParsedExpr.Release()
VariableX.Release()
End Sub
End Module
x = 1 Result = 0
x = 2 Result = 1
x = 3 Result = 1
x = 4 Result = 2
x = 5 Result = 2
x = 6 Result = 3
x = 7 Result = 3
x = 8 Result = 4
x = 9 Result = 4
x = 10 Result = 5 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Dim VariableX = uc.DefineVariable("x") Dim ParsedExpr = uc.Parse("x / 2", "Integer") '// Causes output of "x / 2" to convert to an integer '// NOTE: EvaluateInt32 should only be used when Parse() explicitly specifies Integer '// (Or Int, or Int32) as the second argument, or if the expression evaluates to an integer '// (such as evaluating a variable that was explicitly defined as integer; '// other arithmetic operators typically evaluate to Double floating point). For x As Double = 1 To 10 VariableX.Value(x) Console.WriteLine("x = " + VariableX.ValueStr() + " Result = " + (ParsedExpr.EvaluateInt32()).ToString()) Next ParsedExpr.Release() VariableX.Release() End Sub End Module