uCalc API Version: 2.1.3-preview.2 Released: 6/17/2026
Warning
uCalc API Preview Release Notice:The documentation describes the intended behavior of the API. The current preview build contains incomplete features, unoptimized performance, and is subject to breaking changes.
IsCompound = [bool]
Property
Product:
Class:
Determines if the data type represents a compound value, such as a String or Complex number.
Remarks
The IsCompound property helps distinguish between simple, fundamental data types and more complex, composite ones.
A compound data type is one that is not a simple, primitive numeric or boolean value. In uCalc, this currently includes String and Complex types. This is useful for logic that needs to handle strings and numbers differently without checking for every possible numeric type individually.
Type Categories
✅ Returns true for Compound Types
String: A sequence of characters.Complex: A number consisting of a real and an imaginary part.
❌ Returns false for Simple Types
BooleanByte(Int8)Int16,Int32,Int64Single,Double
Comparative Analysis
Without uCalc, determining if a type is "compound" in a host language like C# can be ambiguous. A developer might check if a Type object IsPrimitive or IsValueType, but these concepts don't map directly to uCalc's domain. For example, a C# string is a class (a reference type), not a primitive, while a System.Numerics.Complex is a struct (a value type).
uCalc's IsCompound provides a consistent and straightforward way to classify types based on their role within the expression engine, simplifying the logic for the end-user.
For example, to categorize results:
var dt = uc.DataTypeOf(expression);if (dt.IsCompound()) { // Handle string or complex result} else { // Handle numeric or boolean result}Examples
Determining if a data type is compound or not with IsCompound
using uCalcSoftware;
var uc = new uCalc();
Console.WriteLine(uc.DataTypeOf("2 * (3 + 4)").IsCompound);
Console.WriteLine(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound);
Console.WriteLine(uc.DataTypeOf("3 + 4 * #i").IsCompound);
Console.WriteLine(uc.DataTypeOf(BuiltInType.String).IsCompound);
Console.WriteLine(uc.DataTypeOf("Bool").IsCompound);
False
True
True
True
False using uCalcSoftware; var uc = new uCalc(); Console.WriteLine(uc.DataTypeOf("2 * (3 + 4)").IsCompound); Console.WriteLine(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound); Console.WriteLine(uc.DataTypeOf("3 + 4 * #i").IsCompound); Console.WriteLine(uc.DataTypeOf(BuiltInType.String).IsCompound); Console.WriteLine(uc.DataTypeOf("Bool").IsCompound);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
cout << tf(uc.DataTypeOf("2 * (3 + 4)").IsCompound()) << endl;
cout << tf(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound()) << endl;
cout << tf(uc.DataTypeOf("3 + 4 * #i").IsCompound()) << endl;
cout << tf(uc.DataTypeOf(BuiltInType::String).IsCompound()) << endl;
cout << tf(uc.DataTypeOf("Bool").IsCompound()) << endl;
}
False
True
True
True
False #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; cout << tf(uc.DataTypeOf("2 * (3 + 4)").IsCompound()) << endl; cout << tf(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound()) << endl; cout << tf(uc.DataTypeOf("3 + 4 * #i").IsCompound()) << endl; cout << tf(uc.DataTypeOf(BuiltInType::String).IsCompound()) << endl; cout << tf(uc.DataTypeOf("Bool").IsCompound()) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Console.WriteLine(uc.DataTypeOf("2 * (3 + 4)").IsCompound)
Console.WriteLine(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound)
Console.WriteLine(uc.DataTypeOf("3 + 4 * #i").IsCompound)
Console.WriteLine(uc.DataTypeOf(BuiltInType.String).IsCompound)
Console.WriteLine(uc.DataTypeOf("Bool").IsCompound)
End Sub
End Module
False
True
True
True
False Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Console.WriteLine(uc.DataTypeOf("2 * (3 + 4)").IsCompound) Console.WriteLine(uc.DataTypeOf(" 'Hello ' + 'world!' ").IsCompound) Console.WriteLine(uc.DataTypeOf("3 + 4 * #i").IsCompound) Console.WriteLine(uc.DataTypeOf(BuiltInType.String).IsCompound) Console.WriteLine(uc.DataTypeOf("Bool").IsCompound) End Sub End Module