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.
ValueInt64()
Method
Product:
Class:
Retrieves the 64-bit integer value from a uCalc variable.
Syntax
Parameters
Return
int64
The 64-bit integer value of the variable.
Remarks
Retrieving 64-bit Integer Values
The ValueInt64() method provides a direct, type-safe way to retrieve the value of a uCalc variable defined as a 64-bit integer (Int64 or Int64u).
Core Usage
This method is the counterpart to the ValueInt64 setter. It is used to access the current value of a variable from the host application, typically after it has been manipulated by a uCalc expression or set programmatically.
// Define a 64-bit integer variablevar myId = uc.DefineVariable("myId As Int64");// Set its valuemyId.ValueInt64(9007199254740991);// Retrieve its value using the type-safe getterint64_t retrievedId = myId.ValueInt64();Console.WriteLine($"Retrieved ID: {retrievedId}");🆚 Comparative Analysis: Why Use a Type-Specific Getter?
While uCalc offers several ways to retrieve a variable's value, ValueInt64() is the best choice for 64-bit integers due to performance and data integrity.
ValueInt64()(Type-Safe Getter - Recommended)- Pros: Fastest method, returns the exact binary value without conversion, and preserves the full precision of 64-bit integers.
- Cons: Specific to one data type.
- Best for: Performance-critical code and handling large numbers like timestamps, database IDs, or financial calculations.
Value()(Generic Getter - Potential Precision Loss)- This method always returns a
double. While convenient, adoubleonly has about 15-17 decimal digits of precision. A 64-bit integer can have up to 19 digits. UsingValue()on largeInt64values will result in precision loss. - Best for: General-purpose numeric retrieval where maximum precision is not critical.
- This method always returns a
ValueStr()(String-Based Getter)- This method returns the value as a string. It preserves precision but is slower due to the overhead of converting the number to a string and subsequent parsing if you need to use it as a number in your host application.
- Best for: Displaying values or when a string representation is the desired final format.
In summary, always use ValueInt64() to retrieve Int64 or Int64u variables to guarantee both speed and data integrity.