C# Math Methods

Beginner
5 min read
Updated: Nov 2026
43 method guides
Method index

About This Index

This page is the C# Math Methods index. Each row links to a full guide with syntax, parameters, return value, three examples, and FAQs. The examples use small numbers whose answers are exact, such as Math.Sqrt(16) or Math.Pow(2, 10), and they round or format any other value, so the output you see is the output you get.

Learn what the Math class is for on /c-sharp/math. Use this page when you need a specific API such as Sqrt(), Round(), or Pow().

Angles are in radians.

Math.Sin, Math.Cos, and Math.Tan expect radians. Convert degrees with degrees * Math.PI / 180. Also remember that a double can hold NaN and Infinity, which is how many Math methods report a bad input instead of throwing an exception.

How to Call a Math Method

Every Math method is static, so you call it on the class name. There is nothing to create first:

C#
using System;

double root = Math.Sqrt(16);          // 4
double power = Math.Pow(2, 10);       // 1024
double rounded = Math.Round(3.14159, 2);   // 3.14
int bigger = Math.Max(7, 12);         // 12
int size = Math.Abs(-5);              // 5
double pi = Math.PI;                  // 3.141592653589793 (a constant, no parentheses)

C# Math Methods Table

All method guides in this C# tutorial series (43 tutorials), grouped by purpose.

Basic

7 methods

Everyday helpers: size of a number, its sign, the bigger or smaller of two numbers, and keeping a value inside a range.

MethodDescriptionTutorial
Abs()Return the absolute value of a number: its distance from zero, never negative.Try it
Sign()Return -1, 0, or 1 to tell whether a number is negative, zero, or positive.Try it
Max()Return the larger of two numbers.Try it
Min()Return the smaller of two numbers.Try it
Clamp()Keep a value between a minimum and a maximum.Try it
MaxMagnitude()Return whichever of two numbers is farther from zero, keeping its sign.Try it
MinMagnitude()Return whichever of two numbers is closer to zero, keeping its sign.Try it

Rounding

4 methods

Turn a number with decimals into a whole number, or round to a chosen number of decimal places.

MethodDescriptionTutorial
Round()Round a number to the nearest whole number or to a chosen number of decimal places.Try it
Floor()Round a number down to the nearest whole number, toward negative infinity.Try it
Ceiling()Round a number up to the nearest whole number, toward positive infinity.Try it
Truncate()Drop the decimal part of a number, always moving toward zero.Try it

Powers and roots

5 methods

Raise to a power, take roots, use e to a power, or multiply by a power of two.

MethodDescriptionTutorial
Pow()Raise a number to a power: Pow(2, 10) is 1024.Try it
Sqrt()Return the square root of a number: Sqrt(16) is 4.Try it
Cbrt()Return the cube root of a number, including negative numbers.Try it
Exp()Return e raised to a power, where e is about 2.71828.Try it
ScaleB()Multiply a number by 2 raised to an int power, quickly and exactly.Try it

Logarithms

4 methods

Find the power a base must be raised to, using base e, base 10, base 2, or any base. ILogB returns the binary exponent as an int.

MethodDescriptionTutorial
Log()Return the natural logarithm of a number, or the logarithm in any base you choose.Try it
Log10()Return the base-10 logarithm: how many times you multiply 10 to reach a number.Try it
Log2()Return the base-2 logarithm: how many times you double 1 to reach a number.Try it
ILogB()Return the binary exponent of a number as an int: the power of two just below it.Try it

Trigonometry

8 methods

Sine, cosine, tangent, and their inverses. All angles are in radians, not degrees.

MethodDescriptionTutorial
Sin()Return the sine of an angle given in radians.Try it
Cos()Return the cosine of an angle given in radians.Try it
Tan()Return the tangent of an angle given in radians.Try it
SinCos()Return the sine and cosine of the same angle together, as a tuple.Try it
Asin()Return the angle (in radians) whose sine is a given number.Try it
Acos()Return the angle (in radians) whose cosine is a given number.Try it
Atan()Return the angle (in radians) whose tangent is a given number.Try it
Atan2()Return the angle (in radians) of the point (x, y), using both signs to find the right quarter of the circle.Try it

Hyperbolic

6 methods

Hyperbolic sine, cosine, tangent, and their inverses, built from the exponential function.

MethodDescriptionTutorial
Sinh()Return the hyperbolic sine of a number: (e to the x minus e to the minus x) divided by 2.Try it
Cosh()Return the hyperbolic cosine of a number: (e to the x plus e to the minus x) divided by 2.Try it
Tanh()Return the hyperbolic tangent of a number, a smooth value squeezed between -1 and 1.Try it
Asinh()Return the inverse hyperbolic sine: the number whose Sinh is the input.Try it
Acosh()Return the inverse hyperbolic cosine: the non-negative number whose Cosh is the input.Try it
Atanh()Return the inverse hyperbolic tangent for inputs between -1 and 1.Try it

Integer and division

3 methods

Quotient and remainder together, a full-size product of two integers, and the IEEE remainder.

MethodDescriptionTutorial
DivRem()Get the quotient and the remainder of a whole-number division in one call.Try it
BigMul()Multiply two integers and keep the full answer, even when it is too big for the original type.Try it
IEEERemainder()Return x minus y times the nearest whole number of divisions, so the result can be negative.Try it

Floating-point details

6 methods

Advanced tools that work on the bits of a double: the next number up or down, copying a sign, one-step multiply-add, and fast estimates.

MethodDescriptionTutorial
BitIncrement()Return the very next double above a number: the smallest step up that a double can show.Try it
BitDecrement()Return the very next double below a number: the smallest step down that a double can show.Try it
CopySign()Return the size of one number with the sign of another number.Try it
FusedMultiplyAdd()Compute x times y plus z with only one rounding step, for a more accurate answer.Try it
ReciprocalEstimate()Return a quick estimate of 1 divided by a number. It is only approximate.Try it
ReciprocalSqrtEstimate()Return a quick estimate of 1 divided by the square root of a number. It is only approximate.Try it

Frequently Asked Questions

They are the static methods of System.Math. They find the absolute value, round numbers, raise to powers, take roots and logarithms, work with angles (sine, cosine, tangent), and handle details of floating-point numbers.
This index lists 43 guides: Abs, Sign, Max, Min, Clamp, MaxMagnitude, MinMagnitude, Round, Floor, Ceiling, Truncate, Pow, Sqrt, Cbrt, Exp, ScaleB, Log, Log10, Log2, ILogB, Sin, Cos, Tan, SinCos, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh, Asinh, Acosh, Atanh, DivRem, BigMul, IEEERemainder, BitIncrement, BitDecrement, CopySign, FusedMultiplyAdd, ReciprocalEstimate, and ReciprocalSqrtEstimate.
No. Math is a static class. You write Math.Sqrt(16) with the class name, never new Math(). Add using System; at the top of your file.
Radians. Sin, Cos, Tan, and the other angle methods all work in radians. To convert degrees to radians, multiply by Math.PI / 180.
Read the C# Math hub first. Then open Sqrt(), Round(), Pow(), and Abs() from the tables below. Come back for the advanced floating-point guides when you are curious.

Start with Abs()

Learn the simplest Math method first: drop the minus sign from a number.

Abs() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful