Facebook Page Twitter Page LinkedIn Page
× C# Tutorial C# Advanced C# Resources

The C# has a number of methods that are available for mathematical operation like Min(), Max(), Log(), Exp(), Sin(), Ceiling(), Floor(), etc. These methods are listed below. For more details about any one of these, please visit its page.

C# Math Methods
Abs() Returns the absolute (positive) value of the given number.
BigMul() Returns product of two 32 bit numbers.
BitDecrement() Returns the next smallest value that compares less than the argument.
BitIncrement() Returns the next largest value that compares greater than the argument.
Ceiling() Rounds the given number up to the nearest integer.
Clamp() Returns the value clamped to the inclusive range of min and max.
CopySign() Returns a number with magnitude of first argument and sign of second argument.
DivRem() Calculates the quotient of two numbers and also returns the remainder in an output parameter.
Floor() Rounds the given number down to the nearest integer.
FusedMultiplyAdd() FusedMultiplyAdd(x, y, z) returns (x*y) + z.
IEEEremainder() Returns the remainder resulting from the division of specified arguments.
Max() Returns the number with maximum value.
MaxMagnitude() Returns the number with larger magnitude.
Min() Returns the number with minimum value.
MinMagnitude() Returns the number with smaller magnitude.
Round() Rounds a value to the nearest integer or to the specified number of fractional digits.
ScaleB() ScaleB(a, b) returns a x 2b.
Sign() Returns an integer that indicates the sign of the argument.
Truncate() Rounds the given number towards zero.

Power & Logarithmic Methods

Exp() Returns the exponent of e.
Log() Returns the natural logarithm of a given number.
Log10() Returns the base-10 logarithm of a given number.
Log2() Returns the base-2 logarithm of a given number.
ILogB() Returns the base-2 integer logarithm of a given number.
Sqrt() Returns the square root of the given number.
Cbrt() Returns the cube root of the given number.
Pow() Returns base raised to the power of exponent.

Trigonometric Math Methods

Sin() Returns the trigonometric sine of an angle.
Cos() Returns the trigonometric cosine of an angle.
Tan() Returns the trigonometric tangent of an angle.
Asin() Returns the arc sine of a value.
Acos() Returns the arc cosine of a value.
Atan() Returns the arc tangent of a value.
Atan2() Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).

Hyperbolic Math Methods

Sinh() Returns the hyperbolic sine of a value.
Cosh() Returns the hyperbolic cosine of a value.
Tanh() Returns the hyperbolic tangent of a value.
Asinh() Returns the inverse hyperbolic sine of a value
Acosh() Returns the inverse hyperbolic cosine of a value
Atanh() Returns the inverse hyperbolic tangent of a value