Class MathF
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.
Inherited Members
Namespace: System
Assembly: Evergine.Mathematics.dll
Syntax
public static class MathF
Fields
E
Represents the natural logarithmic base, specified by the constant, e.
Declaration
public const float E = 2.7182817
Field Value
Type | Description |
---|---|
float |
PI
Represents the ratio of the circumference of a circle to its diameter, specified by the constant, p.
Declaration
public const float PI = 3.1415927
Field Value
Type | Description |
---|---|
float |
Tau
Represents the number of radians in one turn, specified by the constant, τ.
Declaration
public const float Tau = 6.2831855
Field Value
Type | Description |
---|---|
float |
Methods
Abs(float)
Returns the absolute value of a single-precision floating-point number.
Declaration
public static float Abs(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number that is greater than or equal to System.Single.MinValue, but less than or equal to System.Single.MaxValue. |
Returns
Type | Description |
---|---|
float | A single-precision floating-point number, x, such that 0 ≤ x ≤ System.Single.MaxValue. |
Acos(float)
Returns the angle whose cosine is the specified number.
Declaration
public static float Acos(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number representing a cosine, where x must be greater than or equal to -1, but less than or equal to 1. |
Returns
Type | Description |
---|---|
float | An angle, θ, measured in radians, such that 0 ≤ θ ≤ π. -or- System.Single. |
Asin(float)
Returns the angle whose sine is the specified number.
Declaration
public static float Asin(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number representing a sine, where x must be greater than or equal to -1, but less than or equal to 1. |
Returns
Type | Description |
---|---|
float | An angle, θ, measured in radians, such that -π/2 ≤ θ ≤ π/2. |
Atan(float)
Returns the angle whose tangent is the specified number.
Declaration
public static float Atan(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number representing a tangent. |
Returns
Type | Description |
---|---|
float | An angle, θ, measured in radians, such that -π/2 ≤ θ ≤ π/2. |
Atan2(float, float)
Returns the angle whose tangent is the quotient of two specified numbers.
Declaration
public static float Atan2(float y, float x)
Parameters
Type | Name | Description |
---|---|---|
float | y | The y coordinate of a point. |
float | x | The x coordinate of a point. |
Returns
Type | Description |
---|---|
float | An angle, θ, measured in radians, such that -π ≤ θ ≤ π, and tan(θ) = y / x, where (x, y) is a point in the Cartesian plane. |
Ceiling(float)
Returns the smallest integral value that is greater than or equal to the specified single-precision floating-point number.
Declaration
public static float Ceiling(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number. |
Returns
Type | Description |
---|---|
float | The smallest integral value that is greater than or equal to x. |
Cos(float)
Returns the cosine of the specified angle.
Declaration
public static float Cos(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | An angle, measured in radians. |
Returns
Type | Description |
---|---|
float | The cosine of x. |
Cosh(float)
Returns the hyperbolic cosine of the specified angle.
Declaration
public static float Cosh(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | An angle, measured in radians. |
Returns
Type | Description |
---|---|
float | The hyperbolic cosine of x. |
Exp(float)
Returns e raised to the specified power.
Declaration
public static float Exp(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number specifying a power. |
Returns
Type | Description |
---|---|
float | The number e raised to the power x. |
Floor(float)
Returns the largest integral value less than or equal to the specified single-precision floating-point number.
Declaration
public static float Floor(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number. |
Returns
Type | Description |
---|---|
float | The largest integral value less than or equal to x. |
IEEERemainder(float, float)
Returns the remainder resulting from the division of a specified number by another specified number.
Declaration
public static float IEEERemainder(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | A dividend. |
float | y | A divisor. |
Returns
Type | Description |
---|---|
float | A number equal to x - (y Q), where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers, the even integer is returned). |
Log(float)
Returns the natural (base e) logarithm of a specified number.
Declaration
public static float Log(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | The number whose logarithm is to be found. |
Returns
Type | Description |
---|---|
float | Returns the natural (base e) logarithm. |
Log(float, float)
Returns the logarithm of a specified number in a specified base.
Declaration
public static float Log(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The number whose logarithm is to be found. |
float | y | The base. |
Returns
Type | Description |
---|---|
float | Returns the logarithm. |
Log10(float)
Returns the base 10 logarithm of a specified number.
Declaration
public static float Log10(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number whose logarithm is to be found. |
Returns
Type | Description |
---|---|
float | Returns the base 10 logarithm. |
Max(float, float)
Returns the larger of two single-precision floating-point numbers.
Declaration
public static float Max(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The first of two single-precision floating-point numbers to compare. |
float | y | The second of two single-precision floating-point numbers to compare. |
Returns
Type | Description |
---|---|
float | Parameter x or y, whichever is larger. If x, or y, or both x and y are equal to System.Single.NaN, System.Single.NaN is returned. |
MaxMagnitude(float, float)
Returns the larger magnitude of two single-precision floating-point numbers.
Declaration
public static float MaxMagnitude(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The first of two single-precision floating-point numbers to compare. |
float | y | The second of two single-precision floating-point numbers to compare. |
Returns
Type | Description |
---|---|
float | Parameter x or y, whichever has the larger magnitude. If x, or y, or both x and y are equal to System.Single.NaN, System.Single.NaN is returned. |
Min(float, float)
Returns the smaller of two single-precision floating-point numbers.
Declaration
public static float Min(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The first of two single-precision floating-point numbers to compare. |
float | y | The second of two single-precision floating-point numbers to compare. |
Returns
Type | Description |
---|---|
float | Parameter x or y, whichever is smaller. If x, y, or both x and y are equal to System.Single.NaN, System.Single.NaN is returned. |
Pow(float, float)
Returns a specified number raised to the specified power.
Declaration
public static float Pow(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number to be raised to a power. |
float | y | A single-precision floating-point number that specifies a power. |
Returns
Type | Description |
---|---|
float | The number x raised to the power y. |
Round(float)
Rounds a single-precision floating-point value to a specified number of fractional digits using the specified rounding convention.
Declaration
public static float Round(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number to be rounded. |
Returns
Type | Description |
---|---|
float | The number that x is rounded to that has digits fractional digits. If x has fewer fractional digits than digits, x is returned unchanged. |
Round(float, int)
Rounds a single-precision floating-point value to a specified number of fractional digits using the specified rounding convention.
Declaration
public static float Round(float x, int digits)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number to be rounded. |
int | digits | The number of fractional digits in the return value. |
Returns
Type | Description |
---|---|
float | The number that x is rounded to that has digits fractional digits. If x has fewer fractional digits than digits, x is returned unchanged. |
Round(float, int, MidpointRounding)
Rounds a single-precision floating-point value to a specified number of fractional digits using the specified rounding convention.
Declaration
public static float Round(float x, int digits, MidpointRounding mode)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number to be rounded. |
int | digits | The number of fractional digits in the return value. |
MidpointRounding | mode | One of the enumeration values that specifies which rounding strategy to use. |
Returns
Type | Description |
---|---|
float | The number that x is rounded to that has digits fractional digits. If x has fewer fractional digits than digits, x is returned unchanged. |
Round(float, MidpointRounding)
Rounds a single-precision floating-point value to an integer using the specified rounding convention.
Declaration
public static float Round(float x, MidpointRounding mode)
Parameters
Type | Name | Description |
---|---|---|
float | x | A single-precision floating-point number to be rounded. |
MidpointRounding | mode | One of the enumeration values that specifies which rounding strategy to use. |
Returns
Type | Description |
---|---|
float | The integer that x is rounded to using the mode rounding convention. This method returns a System.Single instead of an integral type. |
Sign(float)
Returns an integer that indicates the sign of a single-precision floating-point number.
Declaration
public static int Sign(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A signed number. |
Returns
Type | Description |
---|---|
int | Returns an integer that indicates the sign of a number. |
Sin(float)
Returns the sine of the specified angle.
Declaration
public static float Sin(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | An angle, measured in radians. |
Returns
Type | Description |
---|---|
float | The sine of x. |
Sinh(float)
Returns the hyperbolic sine of the specified angle.
Declaration
public static float Sinh(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | An angle, measured in radians. |
Returns
Type | Description |
---|---|
float | The hyperbolic sine of x. |
Sqrt(float)
Returns the square root of a specified number.
Declaration
public static float Sqrt(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | The number whose square root is to be found. |
Returns
Type | Description |
---|---|
float | Returns the square root. |
Tan(float)
Returns the tangent of the specified angle.
Declaration
public static float Tan(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | An angle, measured in radians. |
Returns
Type | Description |
---|---|
float | Returns the tangent. |
Tanh(float)
Returns the hyperbolic tangent of the specified angle.
Declaration
public static float Tanh(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | An angle, measured in radians. |
Returns
Type | Description |
---|---|
float | The hyperbolic tangent of x. |
Truncate(float)
Calculates the integral part of a specified single-precision floating-point number.
Declaration
public static float Truncate(float x)
Parameters
Type | Name | Description |
---|---|---|
float | x | A number to truncate. |
Returns
Type | Description |
---|---|
float | The integral part of x. |