What is the result of the built-in value Float.floatToRawIntBits (float value)?

The JRE documentation says that the native function Float.floatToRawIntBits(Float value) ...

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

What is the "single format" bitmap? I have never heard this expression.

I gave an example:

 float f = 1; System.out.println(Float.floatToRawIntBits(f)); 

What are the outputs of 1065353216 .

What does this function actually do?

+4
source share
1 answer

IEEE 754 one-bit floating point bit format:

Bit 31 of the result represents the sign of the float; bits 30-23 represent the (offset) exponent; bits 22 - 0 represent the mantissa.

The return value of int is an integer representation of this 32-bit string.

Wikipedia details on how to convert float to IEEE 754. http://en.wikipedia.org/wiki/Single-precision_floating-point_format

+5
source

Source: https://habr.com/ru/post/1393204/


All Articles