uCalc API Version: 2.1.3-preview.2 Released: 6/16/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.

Arg1

Method

Product: 

Fast Math Parser

Class: 

Callback

Returns the first argument passed to a callback function as a double-precision number.

Syntax

Arg1()

Parameters

[None]

Return

double

The double-precision floating-point value of the first argument.

Remarks

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.

💡 Why uCalc? (Comparative Analysis)

In most languages, accessing function arguments involves indexing into an array or list.

  • C# / VB.NET: Similar to accessing args[0] in a params object[] args array, but Arg1 is type-specific and avoids the casting and indexing steps.
  • C++: Conceptually similar to accessing the first element in a variadic template pack or a 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.

Examples