Returns the first argument passed to a callback function as a double-precision number.
Product:
Class:
Warning
uCalc API Preview Release Notice:The uCalc engine has successfully transitioned to modern cross-platform environments.The next phase envolves some structural changes, performance optimizations, and API refinements.The API is subject to breaking changes prior to the stable release. Please evaluate the preview version thoroughly before production use.
The double-precision floating-point value of the first argument.
The Arg1 method is a high-performance shortcut for retrieving the first (or only) argument passed to a Callback function. It is functionally identical to calling Arg(1) but is slightly more efficient as it avoids the overhead of an indexed lookup.
This method is exclusively used within the body of a callback function that has been registered with DefineFunction or DefineOperator. It simplifies the implementation of unary functions and operators where only one input is expected.
In most languages, accessing function arguments involves indexing into an array or list.
args[0] in a params object[] args array, but Arg1 is type-specific and avoids the casting and indexing steps.va_list.uCalc provides Arg1 (and its counterpart Arg2) as a convenience that leads to cleaner and more readable callback code, especially for simple mathematical operations. It reinforces the contract that a particular callback expects a specific number of arguments.
For arguments of other data types or for accessing arguments by a dynamic index, use the general-purpose Arg method or its type-specific variants like ArgStr or ArgInt32.
This page last modified on: