Class Math
Provides mathematical constants and methods for various mathematical operations
public static class Math
- Inheritance
-
Math
- Inherited Members
Fields
EpsilonF
An epsilon constant, used for comparing float values
public const float EpsilonF = 1.1920929E-07
Field Value
Pi
The value of the mathematical constant π as a double constant
public const double Pi = 3.141592653589793
Field Value
PiF
The value of the mathematical constant π as a float constant
public const float PiF = 3.1415927
Field Value
Methods
Abs(double)
Computes the absolute value of a specified real value
public static double Abs(double x)
Parameters
xdoubleThe real value whose absolute value should be calculated
Returns
- double
The absolute value of
x. The return value is in the range [0, ∞].
Abs(int)
Computes the absolute value of a specified integer value
public static int Abs(int x)
Parameters
xintThe integer value whose absolute value should be calculated
Returns
- int
The absolute value of
x
Abs(float)
Computes the absolute value of a specified real value
public static float Abs(float x)
Parameters
xfloatThe real value whose absolute value should be calculated
Returns
- float
The absolute value of
x. The return value is in the range [0, ∞].
Acos(double)
Computes the arc cosine of a specified real value
public static double Acos(double x)
Parameters
xdoubleThe real value whose arc cosine should be calculated. Should be in the range [-1, 1].
Returns
- double
The arc cosine of
x, in radians. The return value is in the range [0, π].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Acos(float)
Computes the arc cosine of a specified real value
public static float Acos(float x)
Parameters
xfloatThe real value whose arc cosine should be calculated. Should be in the range [-1, 1].
Returns
- float
The arc cosine of
x, in radians. The return value is in the range [0, π].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Asin(double)
Computes the arc sine of a specified real value
public static double Asin(double x)
Parameters
xdoubleThe real value whose arc sine should be calculated. Should be in the range [-1, 1].
Returns
- double
The arc sine of
x, in radians. The return value is in the range [-½π, ½π].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Asin(float)
Computes the arc sine of a specified real value
public static float Asin(float x)
Parameters
xfloatThe real value whose arc sine should be calculated. Should be in the range [-1, 1].
Returns
- float
The arc sine of
x, in radians. The return value is in the range [-½π, ½π].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Atan(double)
Computes the arc tangent of a specified real value
public static double Atan(double x)
Parameters
xdoubleThe real value whose arc tangent should be calculated
Returns
- double
The arc tangent of
x, in radians, or0ifxis0. The return value is in the range [-½π, ½π].
Remarks
To calculate the arc tangent of a quotient of two real values, use Atan2(double, double) instead.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Atan(float)
Computes the arc tangent of a specified real value
public static float Atan(float x)
Parameters
xfloatThe real value whose arc tangent should be calculated
Returns
- float
The arc tangent of
x, in radians, or0ifxis0. The return value is in the range [-½π, ½π].
Remarks
To calculate the arc tangent of a quotient of two real values, use Atan2(float, float) instead.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Atan2(double, double)
Compute the arc tangent of a quotient of two specified real values, using their signs to adjust the result's quadrant
public static double Atan2(double y, double x)
Parameters
ydoubleThe real value of the numerator of the quotient (y coordinate) whose arc tangent should be calculated
xdoubleThe real value of the denominator of the quotient (x coordinate) whose arc tangent should be calculated
Returns
- double
The arc tangent of
, in radians, or ify/xxis0, either -½π, 0, ½π, depending on the value ofy. The return value is in the range [-π, π].
Remarks
To calculate the arc tangent of a single real value, use Atan(double) instead.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Atan2(float, float)
Compute the arc tangent of a quotient of two specified real values, using their signs to adjust the result's quadrant
public static float Atan2(float y, float x)
Parameters
yfloatThe real value of the numerator of the quotient (y coordinate) whose arc tangent should be calculated
xfloatThe real value of the denominator of the quotient (x coordinate) whose arc tangent should be calculated
Returns
- float
The arc tangent of
, in radians, or ify/xxis0, either -½π, 0, ½π, depending on the value ofy. The return value is in the range [-π, π].
Remarks
To calculate the arc tangent of a single real value, use Atan(float) instead.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Ceil(double)
Computes the ceiling of a specified real value
public static double Ceil(double x)
Parameters
xdoubleThe real value whose ceiling should be calculated
Returns
- double
The ceiling of
x, which is the smallest integerysuch thaty ≥x
Ceil(float)
Computes the ceiling of a specified real value
public static float Ceil(float x)
Parameters
xfloatThe real value whose ceiling should be calculated
Returns
- float
The ceiling of
x, which is the smallest integerysuch thaty ≥x
Clamp<T>(T, T, T, IDispatchComparable<T>?)
Clamps a specified value to a specified range
public static T Clamp<T>(T value, T min, T max, Math.IDispatchComparable<T>? _ = null) where T : IComparable<T>
Parameters
valueTThe value which should be clamped to the specified range
minTThe lower end value of the range to which the value should be clamped
maxTThe upper end value of the range to which the value should be clamped
_Math.IDispatchComparable<T>Please ignore and do not explicitly set this parameter
Returns
- T
minormaxas appropriate, ifvalueis outside the range [min,max]; otherwisevalue
Type Parameters
TThe type of value to clamp
Remarks
This method will produce incorrect results if max is less than min. Note: There are no additional checks in place to prevent that kind of behavior.
This method works for types of value T which implement IComparable<T>.
If T implements both IComparable<T> and IComparisonOperators<TSelf, TOther, TResult>,
overload resolution prioritizes Clamp<T>(T, T, T, IDispatchComparisonOperators<T>?) instead.
Please ignore and do not explicitly set the _ parameter. This parameter is just used in the method's signature to dispatch calls to this method for types of value T which implement IComparable<T>.
Clamp<T>(T, T, T, IDispatchComparisonOperators<T>?)
Clamps a specified value to a specified range
public static T Clamp<T>(T value, T min, T max, Math.IDispatchComparisonOperators<T>? _ = null) where T : IComparisonOperators<T, T, bool>
Parameters
valueTThe value which should be clamped to the specified range
minTThe lower end value of the range to which the value should be clamped
maxTThe upper end value of the range to which the value should be clamped
_Math.IDispatchComparisonOperators<T>Please ignore and do not explicitly set this parameter
Returns
- T
minormaxas appropriate, ifvalueis outside the range [min,max]; otherwisevalue
Type Parameters
TThe type of value to clamp
Remarks
This method will produce incorrect results if max is less than min. Note: There are no additional checks in place to prevent that kind of behavior.
This method works for types of value T which implement IComparisonOperators<TSelf, TOther, TResult>.
If T implements both IComparisonOperators<TSelf, TOther, TResult> and IComparable<T>,
overload resolution prioritizes this method.
Please ignore and do not explicitly set the _ parameter. This parameter is just used in the method's signature to dispatch calls to this method for types of value T which implement IComparisonOperators<TSelf, TOther, TResult>.
CopySign(double, double)
Copies the sign of a real value to another
public static double CopySign(double x, double y)
Parameters
xdoubleThe real value to use as the results magnitude
ydoubleThe real value to use as the results sign
Returns
- double
A real value with the sign of
yand the magnitude ofx
Remarks
This method essentially returns abs(x) ⋅ sgn(y).
-
If you want to compute the magnitude of a real number
x(a.k.a absolute value or abs), you can useCopySign(x, 1). You also could use Abs(double) instead. -
If you want to get the sign of a real number
x(a.k.a sgn), you can useCopySign(1, x)
CopySign(float, float)
Copies the sign of a real value to another
public static float CopySign(float x, float y)
Parameters
xfloatThe real value to use as the results magnitude
yfloatThe real value to use as the results sign
Returns
- float
A real value with the sign of
yand the magnitude ofx
Remarks
This method essentially returns abs(x) ⋅ sgn(y).
-
If you want to compute the magnitude of a real number
x(a.k.a absolute value or abs), you can useCopySign(x, 1)/// You also could use Abs(float) instead. -
If you want to get the sign of a real number
x(a.k.a sgn), you can useCopySign(1, x)
Cos(double)
Computes the cosine of a specified real value
public static double Cos(double x)
Parameters
xdoubleThe real value, in radians, whose cosine should be calculated
Returns
- double
The cosine of
x. The return value is in the range [-1, 1].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Cos(float)
Computes the cosine of a specified real value
public static float Cos(float x)
Parameters
xfloatThe real value, in radians, whose cosine should be calculated
Returns
- float
The cosine of
x. The return value is in the range [-1, 1].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Exp(double)
Computes the exponential of a specified real value
public static double Exp(double x)
Parameters
xdoubleThe real value whose exponential should be calculated
Returns
- double
The value of
eraised to the power ofx, whereeis Euler's number. The return value is in the range [0, ∞].
Remarks
Note: The result will overflow if e raised to power of x is too large to be represented as a double.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Exp(float)
Computes the exponential of a specified real value
public static float Exp(float x)
Parameters
xfloatThe real value whose exponential should be calculated
Returns
- float
The value of
eraised to the power ofx, whereeis Euler's number. The return value is in the range [0, ∞].
Remarks
Note: The result will overflow if e raised to power of x is too large to be represented as a float.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Floor(double)
Computes the floor of a specified real value
public static double Floor(double x)
Parameters
xdoubleThe real value whose floor should be calculated
Returns
- double
The floor of
x, which is the largest integerysuch thaty ≤x
Floor(float)
Computes the floor of a specified real value
public static float Floor(float x)
Parameters
xfloatThe real value whose floor should be calculated
Returns
- float
The floor of
x, which is the largest integerysuch thaty ≤x
IsInfinity(double)
Determines whether a floating point value represents infinity
public static bool IsInfinity(double x)
Parameters
xdoubleThe floating point value which should be checked if it represents infinity
Returns
IsInfinity(float)
Determines whether a floating point value represents infinity
public static bool IsInfinity(float x)
Parameters
xfloatThe floating point value which should be checked if it represents infinity
Returns
IsNaN(double)
Determines whether a floating point value represents not a number (NaN)
public static bool IsNaN(double x)
Parameters
xdoubleThe floating point value which should be checked if it represents not a number (NaN)
Returns
IsNaN(float)
Determines whether a floating point value represents not a number (NaN)
public static bool IsNaN(float x)
Parameters
xfloatThe floating point value which should be checked if it represents not a number (NaN)
Returns
Log(double)
Computes the natural logarithm of a specified real value
public static double Log(double x)
Parameters
xdoubleThe real value whose natural logarithm should be calculated. Must be greater than
0.
Returns
- double
The natural logarithm of
x
Remarks
Note: There are no additional checks in place to prevent x from being less than or equal to 0. Using such values as arguments for x for Log(double) is an error! You must make sure on your own that x is greater than 0.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Log(float)
Computes the natural logarithm of a specified real value
public static float Log(float x)
Parameters
xfloatThe real value whose natural logarithm should be calculated. Must be greater than
0.
Returns
- float
The natural logarithm of
x
Remarks
Note: There are no additional checks in place to prevent x from being less than or equal to 0. Using such values as arguments for x for Log(float) is an error! You must make sure on your own that x is greater than 0.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Log10(double)
Computes the logarithm of a specified real value to base 10
public static double Log10(double x)
Parameters
xdoubleThe real value whose logarithm to base 10 should be calculated. Must be greater than
0.
Returns
- double
The logarithm of
xto base 10
Remarks
Note: There are no additional checks in place to prevent x from being less than or equal to 0. Using such values as arguments for x for Log(double) is an error! You must make sure on your own that x is greater than 0.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Log10(float)
Computes the logarithm of a specified real value to base 10
public static float Log10(float x)
Parameters
xfloatThe real value whose logarithm to base 10 should be calculated. Must be greater than
0.
Returns
- float
The logarithm of
xto base 10
Remarks
Note: There are no additional checks in place to prevent x from being less than or equal to 0. Using such values as arguments for x for Log(double) is an error! You must make sure on your own that x is greater than 0.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Max<T>(T, T, IDispatchComparable<T>?)
Returns the greater value of two specified values
public static T Max<T>(T x, T y, Math.IDispatchComparable<T>? _ = null) where T : IComparable<T>
Parameters
xTThe first value to compare
yTThe second value to compare
_Math.IDispatchComparable<T>Please ignore and do not explicitly set this parameter
Returns
- T
The greater value of
xandy
Type Parameters
TThe type of value
Remarks
This method works for types of x and y T which implement IComparable<T>.
If T implements both IComparable<T> and IComparisonOperators<TSelf, TOther, TResult>,
overload resolution prioritizes Max<T>(T, T, IDispatchComparisonOperators<T>?) instead.
Please ignore and do not explicitly set the _ parameter. This parameter is just used in the method's signature to dispatch calls to this method for types of x and y T which implement IComparable<T>.
Max<T>(T, T, IDispatchComparisonOperators<T>?)
Returns the greater value of two specified values
public static T Max<T>(T x, T y, Math.IDispatchComparisonOperators<T>? _ = null) where T : IComparisonOperators<T, T, bool>
Parameters
xTThe first value to compare
yTThe second value to compare
_Math.IDispatchComparisonOperators<T>Please ignore and do not explicitly set this parameter
Returns
- T
The greater value of
xandy
Type Parameters
TThe type of value
Remarks
This method works for types of x and y T which implement IComparisonOperators<TSelf, TOther, TResult>.
If T implements both IComparable<T> and IComparisonOperators<TSelf, TOther, TResult>,
overload resolution prioritizes this method.
Please ignore and do not explicitly set the _ parameter. This parameter is just used in the method's signature to dispatch calls to this method for types of x and y T which implement IComparisonOperators<TSelf, TOther, TResult>.
Min<T>(T, T, IDispatchComparable<T>?)
Returns the lesser value of two specified values
public static T Min<T>(T x, T y, Math.IDispatchComparable<T>? _ = null) where T : IComparable<T>
Parameters
xTThe first value to compare
yTThe second value to compare
_Math.IDispatchComparable<T>Please ignore and do not explicitly set this parameter
Returns
- T
The lesser value of
xandy
Type Parameters
TThe type of value
Remarks
This method works for types of x and y T which implement IComparable<T>.
If T implements both IComparable<T> and IComparisonOperators<TSelf, TOther, TResult>,
overload resolution prioritizes Max<T>(T, T, IDispatchComparisonOperators<T>?) instead.
Please ignore and do not explicitly set the _ parameter. This parameter is just used in the method's signature to dispatch calls to this method for types of x and y T which implement IComparable<T>.
Min<T>(T, T, IDispatchComparisonOperators<T>?)
Returns the lesser value of two specified values
public static T Min<T>(T x, T y, Math.IDispatchComparisonOperators<T>? _ = null) where T : IComparisonOperators<T, T, bool>
Parameters
xTThe first value to compare
yTThe second value to compare
_Math.IDispatchComparisonOperators<T>Please ignore and do not explicitly set this parameter
Returns
- T
The lesser value of
xandy
Type Parameters
TThe type of value
Remarks
This method works for types of x and y T which implement IComparisonOperators<TSelf, TOther, TResult>.
If T implements both IComparable<T> and IComparisonOperators<TSelf, TOther, TResult>,
overload resolution prioritizes this method.
Please ignore and do not explicitly set the _ parameter. This parameter is just used in the method's signature to dispatch calls to this method for types of x and y T which implement IComparisonOperators<TSelf, TOther, TResult>.
Mod(double)
Splits a specified real value into its integer and fractional parts
public static (double Integer, double Fractional) Mod(double x)
Parameters
xdoubleThe real value which should be split into its integer and fractional part
Returns
- (double Integer, double Fractional)
The integer and fractional part of
x
Mod(double, double)
Computes the remainder of the division of two specified real values
public static double Mod(double x, double y)
Parameters
xdoubleThe real value of the numerator of the division whose remainder should be calculated
ydoubleThe real value of the denominator of the division whose remainder should be calculated. Must not be
0.
Returns
- double
The remainder of the division of
xbyy. The return value is in the range [-y,y].
Remarks
Note: There are no additional checks in place to prevent y from being 0. You must make sure on your own that y is not 0.
Mod(double, out double)
Splits a specified real value into its integer and fractional parts
public static double Mod(double x, out double integerPart)
Parameters
xdoubleThe real value which should be split into its integer and fractional parts
integerPartdoubleThe integer part of
x
Returns
- double
The fractional part of
x
Mod(float)
Splits a specified real value into its integer and fractional parts
public static (float Integer, float Fractional) Mod(float x)
Parameters
xfloatThe real value which should be split into its integer and fractional part
Returns
- (float Integer, float Fractional)
The integer and fractional part of
x
Mod(float, float)
Computes the remainder of the division of two specified real values
public static float Mod(float x, float y)
Parameters
xfloatThe real value of the numerator of the division whose remainder should be calculated
yfloatThe real value of the denominator of the division whose remainder should be calculated. Must not be
0.
Returns
- float
The remainder of the division of
xbyy. The return value is in the range [-y,y].
Remarks
Note: There are no additional checks in place to prevent y from being 0. You must make sure on your own that y is not 0.
Mod(float, out float)
Splits a specified real value into its integer and fractional parts
public static float Mod(float x, out float integerPart)
Parameters
xfloatThe real value which should be split into its integer and fractional parts
integerPartfloatThe integer part of
x
Returns
- float
The fractional part of
x
Pow(double, double)
Computes the exponentiation of a specified real value raised to another specified real value
public static double Pow(double x, double y)
Parameters
xdoubleThe real value which should be the base of the exponentiation to be calculated
ydoubleThe real value which shoudl be the exponent of the exponentiation to be calculated
Returns
- double
The value of
xraised to the power ofy
Remarks
If y shall be Euler's number (a.k.a. the base of the natural logarithm e), consider using Exp(double) instead.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Pow(float, float)
Computes the exponentiation of a specified real value raised to another specified real value
public static float Pow(float x, float y)
Parameters
xfloatThe real value which should be the base of the exponentiation to be calculated
yfloatThe real value which shoudl be the exponent of the exponentiation to be calculated
Returns
- float
The value of
xraised to the power ofy
Remarks
If y shall be Euler's number (a.k.a. the base of the natural logarithm e), consider using Exp(float) instead.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Round(double)
Rounds a specified real value to the nearest integer value
public static double Round(double x)
Parameters
xdoubleThe real value which should get rounded to the nearest integer value
Returns
- double
The nearest integer value to
x
Remarks
Values for x which are halfway between integers will be rounded away from zero.
Round(float)
Rounds a specified real value to the nearest integer value
public static float Round(float x)
Parameters
xfloatThe real value which should get rounded to the nearest integer value
Returns
- float
The nearest integer value to
x
Remarks
Values for x which are halfway between integers will be rounded away from zero.
RoundToInteger(double)
Rounds a specified real value to the nearest integer value
public static long RoundToInteger(double x)
Parameters
xdoubleThe real value which should get rounded to the nearest integer value
Returns
- long
The nearest integer value to
x
Remarks
Values for x which are halfway between integers will be rounded away from zero.
On Windows, the return value is capped in the range of [MinValue, MaxValue].
The get the result as a floating-point value, you can use Round(double) instead.
RoundToInteger(float)
Rounds a specified real value to the nearest integer value
public static long RoundToInteger(float x)
Parameters
xfloatThe real value which should get rounded to the nearest integer value
Returns
- long
The nearest integer value to
x
Remarks
Values for x which are halfway between integers will be rounded away from zero.
On Windows, the return value is capped in the range of [MinValue, MaxValue].
The get the result as a floating-point value, you can use Round(float) instead.
ScaleByPowerOfTwo(double, int)
Scales a specified real value by a specified integer power of two
public static double ScaleByPowerOfTwo(double x, int n)
Parameters
xdoubleThe real value which should get scaled by an integer power of two
nintThe integer exponent to raise two to
Returns
- double
The result of
xmultiplied by two raised to the power ofn()x*2^n
ScaleByPowerOfTwo(float, int)
Scales a specified real value by a specified integer power of two
public static float ScaleByPowerOfTwo(float x, int n)
Parameters
xfloatThe real value which should get scaled by an integer power of two
nintThe integer exponent to raise two to
Returns
- float
The result of
xmultiplied by two raised to the power ofn()x*2^n
Sin(double)
Computes the sine of a specified real value
public static double Sin(double x)
Parameters
xdoubleThe real value, in radians, whose sine should be calculated
Returns
- double
The cosine of
x. The return value is in the range [-1, 1].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Sin(float)
Computes the sine of a specified real value
public static float Sin(float x)
Parameters
xfloatThe real value, in radians, whose sine should be calculated
Returns
- float
The cosine of
x. The return value is in the range [-1, 1].
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Sqrt(double)
Computes the square root of a specified real value
public static double Sqrt(double x)
Parameters
xdoubleThe real value whose square should be calculated. Must be greater than or equal to
0.
Returns
- double
The square root of
x. The return value is in the range [0, ∞].
Remarks
Note: There are no additional checks in place to prevent x from being less than 0. You must make sure on your own that x is greater than or equal to 0.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Sqrt(float)
Computes the square root of a specified real value
public static float Sqrt(float x)
Parameters
xfloatThe real value whose square should be calculated. Must be greater than or equal to
0.
Returns
- float
The square root of
x. The return value is in the range [0, ∞].
Remarks
Note: There are no additional checks in place to prevent x from being less than 0. You must make sure on your own that x is greater than or equal to 0.
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Tan(double)
Computes the tangent of a specified real value
public static double Tan(double x)
Parameters
xdoubleThe real value, in radians, whose tangent should be calculated
Returns
- double
The tangent of
x
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Tan(float)
Computes the tangent of a specified real value
public static float Tan(float x)
Parameters
xfloatThe real value, in radians, whose tangent should be calculated
Returns
- float
The tangent of
x
Remarks
This method may use a different approximation across different versions, platforms and configurations. It could return a different value given the same input on different machines or operating systems, or if SDL is updated.
Trunc(double)
Truncates a specified real value to the next closesest integer value to 0
public static double Trunc(double x)
Parameters
xdoubleThe real value which should get truncated to the next closesest integer value to 0
Returns
- double
The next closesest integer value to 0 from
x
Remarks
This is equivalent to removing the fractional part of x, only leaving the integer part.
Trunc(float)
Truncates a specified real value to the next closesest integer value to 0
public static float Trunc(float x)
Parameters
xfloatThe real value which should get truncated to the next closesest integer value to 0
Returns
- float
The next closesest integer value to 0 from
x
Remarks
This is equivalent to removing the fractional part of x, only leaving the integer part.