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.

Math

Product: 

Class: 

Remarks

These functions are mainly derived from the C++ math () standard library.


📐 Trigonometric Functions

FunctionDescription
Cos(x)Computes the cosine of x (radians).
Sin(x)Computes the sine of x (radians).
Tan(x)Computes the tangent of x (radians).
Acos(x)Computes the arc‑cosine of x, returning an angle in radians.
Asin(x)Computes the arc‑sine of x, returning an angle in radians.
Atan(x)Computes the arc‑tangent of x, returning an angle in radians.
Atan2(x, y)Computes the arc‑tangent of x/y using quadrant information.

🌡️ Hyperbolic Functions

FunctionDescription
Cosh(x)Hyperbolic cosine of x.
Sinh(x)Hyperbolic sine of x.
Tanh(x)Hyperbolic tangent of x.
Acosh(x)Inverse hyperbolic cosine.
Asinh(x)Inverse hyperbolic sine.
Atanh(x)Inverse hyperbolic tangent.

📈 Exponential & Logarithmic Functions

FunctionDescription
Exp(x)Computes (e^x).
Frexp(x, y As Int Ptr)Splits x into mantissa and exponent.
Ldexp(x, y As Int)Computes x × 2^y.
Log(x)Natural logarithm of x.
Log10(x)Base‑10 logarithm of x.
Modf(x, y As Double Ptr)Splits x into fractional and integer parts.
Exp2(x)Computes (2^x).
Expm1(x)Computes (e^x - 1) with high precision for small x.
Ilogb(x)Extracts exponent of x as an integer.
Log1p(x)Computes (\log(1 + x)) accurately for small x.
Log2(x)Base‑2 logarithm of x.
Logb(x)Extracts exponent in floating‑point representation.
Scalbn(x, y As Int)Scales x by (2^y).
Scalbln(x, y As Int)Long‑integer version of Scalbn.

🔢 Power Functions

FunctionDescription
Pow(x, y As Int)Raises x to integer power y.
Pow(x, y)Raises x to floating‑point power y.
Sqr(x)Square of x.
Sqrt(x)Square root of x.
Cbrt(x)Cube root of x.
Hypot(x, y)Computes (\sqrt{x2 + y2}) without overflow.

🧮 Error & Gamma Functions

FunctionDescription
Erf(x)Error function.
Erfc(x)Complementary error function.
Tgamma(x)Gamma function.
Lgamma(x)Natural log of the gamma function.

🔄 Rounding & Remainder

FunctionDescription
Ceil(x)Rounds x upward to nearest integer.
Floor(x)Rounds x downward to nearest integer.
Fmod(x, y)Floating‑point remainder of x / y.
Trunc(x)Truncates fractional part of x.
Frac(x)Returns fractional part of x.
Round(x)Rounds x to nearest integer.
Lround(x)Rounds to nearest integer (returns Int).
Llround(x)Rounds to nearest integer (returns Int64).
Rint(x)Rounds using current rounding mode.
Lrint(x)Same as Rint, returns Int.
Llrint(x)Same as Rint, returns Int64.
Nearbyint(x)Rounds using current mode without raising exceptions.
Remainder(x, y)IEEE remainder of x / y.
Remquo(x, y, z As Int Ptr)Remainder plus low bits of quotient.

⚙️ Floating‑Point Manipulation

FunctionDescription
Copysign(x, y)Returns x with the sign of y.
Nextafter(x, y)Next representable value of x toward y.
Nexttoward(x, y)Extended‑precision version of Nextafter.

➕ Max, Min, Difference

FunctionDescription
Fdim(x, y)Positive difference: max(x − y, 0).
Fmax(x, y)Floating‑point max.
Fmin(x, y)Floating‑point min.
Min(x …)Minimum of a variadic list.
Max(x …)Maximum of a variadic list.

🔍 Other

FunctionDescription
Abs(x)Absolute value (generic).
Fabs(x)Floating‑point absolute value.

🎲 Random Functions

FunctionDescription
RandomSeed(x As Int)Sets the random seed.
RandomNumber(x = 0, y = 1000)Returns integer in range ([x, y]).
Rand(MinX, MaxX)Returns integer in range using RandomNumber.
Rand()Returns last random number normalized to ([0,1]).
RandFromSameSeed(x)Seeds with x and returns a random value.
Rand(x)Overloaded: positive → new random, zero → last, negative → deterministic from seed.

♾️ Infinity & Classification

FunctionDescription
Fpclassify(x)Classifies floating‑point value (zero, normal, subnormal, etc.).
Isfinite(x)True if x is finite.
IsInf(x)True if x is infinite.
IsNaN(x)True if x is NaN.
IsNormal(x)True if x is a normal floating‑point value.
SignBit(x)True if sign bit of x is set.

🔢 Complex Number Operations

FunctionDescription
Real(x)Real part of complex number.
Imag(x)Imaginary part.
Abs(x)Magnitude of complex number.
Arg(x)Phase angle.
Norm(x)Squared magnitude.
Conj(x)Complex conjugate.
Polar(x)Constructs complex number from magnitude/angle.
Proj(x)Complex projection onto Riemann sphere.

🔢 Complex Trigonometric & Related Functions

FunctionDescription
Cos(x)Complex cosine.
Cosh(x)Complex hyperbolic cosine.
Exp(x)Complex exponential.
Log(x)Complex natural log.
Log10(x)Complex base‑10 log.
Pow(x, y)Complex power.
Sin(x)Complex sine.
Sinh(x)Complex hyperbolic sine.
Sqrt(x)Complex square root.
Tan(x)Complex tangent.
Tanh(x)Complex hyperbolic tangent.
Acos(x)Complex arc‑cosine.
Acosh(x)Complex inverse hyperbolic cosine.
Asin(x)Complex arc‑sine.
Asinh(x)Complex inverse hyperbolic sine.
Atan(x)Complex arc‑tangent.
Atanh(x)Complex inverse hyperbolic tangent.

Examples