共用方式為


Float.FloatToRawIntBits(Single) Method

Definition

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values.

[Android.Runtime.Register("floatToRawIntBits", "(F)I", "")]
public static int FloatToRawIntBits (float value);
[<Android.Runtime.Register("floatToRawIntBits", "(F)I", "")>]
static member FloatToRawIntBits : single -> int

Parameters

value
Single

a floating-point number.

Returns

the bits that represent the floating-point number.

Attributes

Remarks

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values.

Bit 31 (the bit that is selected by the mask 0x80000000) represents the sign of the floating-point number. Bits 30-23 (the bits that are selected by the mask 0x7f800000) represent the exponent. Bits 22-0 (the bits that are selected by the mask 0x007fffff) represent the significand (sometimes called the mantissa) of the floating-point number.

If the argument is positive infinity, the result is 0x7f800000.

If the argument is negative infinity, the result is 0xff800000.

If the argument is NaN, the result is the integer representing the actual NaN value. Unlike the floatToIntBits method, floatToRawIntBits does not collapse all the bit patterns encoding a NaN to a single "canonical" NaN value.

In all cases, the result is an integer that, when given to the #intBitsToFloat(int) method, will produce a floating-point value the same as the argument to floatToRawIntBits.

Added in 1.3.

Java documentation for java.lang.Float.floatToRawIntBits(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