Number Functions
Functions for numeric calculations, conversions, and formatting.
- Byte.FromConverts a value to an 8-bit unsigned integer (0 to 255).
- Currency.FromConverts a value to a currency number — a fixed-decimal type with exactly 4 decimal places.
- Decimal.FromConverts a value to a decimal (fixed-point) number with high precision for exact decimal arithmetic.
- Double.FromConverts a value to a double-precision floating-point number (64-bit IEEE 754).
- Int16.FromConverts a value to a 16-bit signed integer (-32,768 to 32,767).
- Int32.FromConverts a value to a 32-bit signed integer (-2,147,483,648 to 2,147,483,647).
- Int64.FromConverts a value to a 64-bit signed integer (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807).
- Int8.FromConverts a value to an 8-bit signed integer (-128 to 127).
- Number.AbsReturns the absolute value of a number.
- Number.AcosReturns the arccosine (inverse cosine) of a number, in radians.
- Number.AsinReturns the arcsine (inverse sine) of a number, in radians.
- Number.AtanReturns the arctangent (inverse tangent) of a number, in radians.
- Number.Atan2Returns the angle in radians between the positive x-axis and the point (x, y), correctly handling all four quadrants.
- Number.BitwiseAndPerforms a bitwise AND operation on two integer values.
- Number.BitwiseNotPerforms a bitwise NOT (bitwise complement) on an integer value, flipping all bits.
- Number.BitwiseOrPerforms a bitwise OR operation on two integer values.
- Number.BitwiseShiftLeftShifts the bits of an integer left by a specified number of positions.
- Number.BitwiseShiftRightShifts the bits of an integer right by a specified number of positions.
- Number.BitwiseXorPerforms a bitwise exclusive OR (XOR) operation on two integer values.
- Number.CombinationsReturns the number of combinations for choosing k items from a set of n items, where order does not matter (C(n,k)).
- Number.CosReturns the cosine of an angle specified in radians.
- Number.CoshReturns the hyperbolic cosine of a number.
- Number.ExpReturns e raised to the power of a number (the inverse of Number.Ln).
- Number.FactorialReturns the factorial of a non-negative integer (n! = 1 × 2 × ... × n).
- Number.FromConverts a value to a number.
- Number.FromTextConverts a text representation of a number to a number value, with optional locale-aware parsing.
- Number.IntegerDividePerforms integer (floor) division, returning the quotient without the remainder.
- Number.IsEvenReturns true if a number is even.
- Number.IsNaNReturns true if the number is NaN (Not a Number), such as the result of 0/0.
- Number.IsOddReturns true if a number is odd.
- Number.LnReturns the natural logarithm (base e) of a number.
- Number.LogReturns the logarithm of a number to the specified base. If no base is provided, returns the natural logarithm (base e).
- Number.Log10Returns the base-10 logarithm of a number.
- Number.ModReturns the remainder from dividing a number by a divisor.
- Number.PermutationsReturns the number of permutations for choosing k items from a set of n items, where order matters (P(n,k)).
- Number.PowerRaises a number to a specified power.
- Number.RandomReturns a random number between 0 (inclusive) and 1 (exclusive). The value changes on each call.
- Number.RandomBetweenReturns a random number between bottom and top (inclusive).
- Number.RoundRounds a number to a specified number of digits.
- Number.RoundAwayFromZeroRounds a number to the specified number of decimal places, always rounding away from zero on ties (the traditional "round half up" rule for positives).
- Number.RoundDownRounds a number down toward zero (floor).
- Number.RoundTowardZeroTruncates a number toward zero to the specified number of decimal places, always rounding toward zero regardless of the fractional part.
- Number.RoundUpRounds a number up away from zero (ceiling).
- Number.SignReturns a number indicating the sign of a value: 1 for positive, -1 for negative, 0 for zero.
- Number.SinReturns the sine of an angle specified in radians.
- Number.SinhReturns the hyperbolic sine of a number.
- Number.SqrtReturns the square root of a number.
- Number.TanReturns the tangent of an angle specified in radians.
- Number.TanhReturns the hyperbolic tangent of a number.
- Number.ToTextConverts a number to a text string, with optional format specifier and culture for locale-aware formatting.
- Percentage.FromConverts a value to a percentage number type.
- Single.FromConverts a value to a single-precision floating-point number (32-bit IEEE 754).