다음을 통해 공유


StrictMath.Abs Method

Definition

Overloads

Abs(Double)

Returns the absolute value of a double value.

Abs(Int32)

Returns the absolute value of an int value.

Abs(Int64)

Returns the absolute value of a long value.

Abs(Single)

Returns the absolute value of a float value.

Abs(Double)

Returns the absolute value of a double value.

[Android.Runtime.Register("abs", "(D)D", "")]
public static double Abs (double a);
[<Android.Runtime.Register("abs", "(D)D", "")>]
static member Abs : double -> double

Parameters

a
Double

the argument whose absolute value is to be determined

Returns

the absolute value of the argument.

Attributes

Remarks

Returns the absolute value of a double value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases: <ul><li>If the argument is positive zero or negative zero, the result is positive zero. <li>If the argument is infinite, the result is positive infinity. <li>If the argument is NaN, the result is NaN.</ul>

Java documentation for java.lang.StrictMath.abs(double).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Abs(Int32)

Returns the absolute value of an int value.

[Android.Runtime.Register("abs", "(I)I", "")]
public static int Abs (int a);
[<Android.Runtime.Register("abs", "(I)I", "")>]
static member Abs : int -> int

Parameters

a
Int32

the argument whose absolute value is to be determined.

Returns

the absolute value of the argument.

Attributes

Remarks

Returns the absolute value of an int value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Note that if the argument is equal to the value of Integer#MIN_VALUE, the most negative representable int value, the result is that same value, which is negative. In contrast, the StrictMath#absExact(int) method throws an ArithmeticException for this value.

Java documentation for java.lang.StrictMath.abs(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Abs(Int64)

Returns the absolute value of a long value.

[Android.Runtime.Register("abs", "(J)J", "")]
public static long Abs (long a);
[<Android.Runtime.Register("abs", "(J)J", "")>]
static member Abs : int64 -> int64

Parameters

a
Int64

the argument whose absolute value is to be determined.

Returns

the absolute value of the argument.

Attributes

Remarks

Returns the absolute value of a long value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned.

Note that if the argument is equal to the value of Long#MIN_VALUE, the most negative representable long value, the result is that same value, which is negative. In contrast, the StrictMath#absExact(long) method throws an ArithmeticException for this value.

Java documentation for java.lang.StrictMath.abs(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Abs(Single)

Returns the absolute value of a float value.

[Android.Runtime.Register("abs", "(F)F", "")]
public static float Abs (float a);
[<Android.Runtime.Register("abs", "(F)F", "")>]
static member Abs : single -> single

Parameters

a
Single

the argument whose absolute value is to be determined

Returns

the absolute value of the argument.

Attributes

Remarks

Returns the absolute value of a float value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases: <ul><li>If the argument is positive zero or negative zero, the result is positive zero. <li>If the argument is infinite, the result is positive infinity. <li>If the argument is NaN, the result is NaN.</ul>

Java documentation for java.lang.StrictMath.abs(float).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to