MathF.Sign(Single) 方法

定义

返回一个整数,该整数表示单精度浮点数字的符号。Returns an integer that indicates the sign of a single-precision floating-point number.

public:
 static int Sign(float x);
public static int Sign (float x);
static member Sign : single -> int
Public Shared Function Sign (x As Single) As Integer

参数

x
Single

有符号的数字。A signed number.

返回

一个指示 x 的符号的数字,如下表所示。A number that indicates the sign of x, as shown in the following table.

返回值Return value 含义Meaning
-1-1 x 小于零。x is less than zero.
00 x 等于零。x is equal to zero.
11 x 大于零。x is greater than zero.

异常

x 等于 NaNx is equal to NaN.

适用于