answersLogoWhite

0

You should not concern yourself with the internal bit representation of a floating point variable, because that is an implementation specific thing. Writing code that depends on the internal format is certainly not-portable, and possibly dangerous.

That said, many implementations use the IEEE 754-2008 format. The binary32 format has 1 sign bit, 8 exponent bits, and 23+1 mantissa bits for a total of 32 bits.

The sign bit is 0 for positive and 1 for negative.

The exponent is in excess 128 format, which means that it is biased by 128. Simply put, a value of 011111112 means "mantissa x 21".

The mantissa is the binary fraction, i.e. the binary point is to the left of the first bit. It is normalized, meaning that it is left or right shifted until the high order bit is 1, placing its value in the range [0.5, 1.0). Since the high order bit is one, it is left shifted again, and the high order bit is not stored, i.e. it is assumed, giving one more bit of precision. That is why the exponent appears to be excess 127 instead of excess 128.

If the number is actually zero, then all of the bits are zero. There are some reserved bit patterns for special numbers, such as invalid, positive infinity, and negative infinity.

In the Intel format, the order of the bytes are reversed, with the low order mantissa first, and the sign/first exponent byte last.

Again, all of this is an implementation specific thing, and should not be depended on.

User Avatar

Wiki User

14y ago

What else can I help you with?

Continue Learning about Engineering

Why the float takes 4 bytes in turbo c plus plus?

What's your problem with that? It's a (quasi-)standard value for a 'float'.


Can an float value be assigned to int variable?

Yes, an integer can be assigned as a float value.But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.eg:float b=12;// an integer constant is assigned to a float variableprintf("%f",b);// when printing b it will print as 12.000000


How do you invoke function result () takes two float argument and returns an integer in c plus plus program?

You can do this by creating a forwarddeclaration of the function. You can call the forward drclared function inside the main to use it.int result(float num1, float num2);intmain(void){int value = result(3.14, 2.74);return (0);}intresult(float num1, float num2){int value = 0;// function codes goes here// you can alter the value of variable 'value'return (value);}The returning value of the 'result()' function is assigned to variable 'value' in 'main()'.


Can a double value be assigned to float variable?

THIS IS FOR JAVA i don't know about anything about other languages yes it can be assignedthe syntax is:int (number) = (float) numberFOR EXAMPLE:int = a;a = (float ) 5.5;if the (float) is not there then in Java it gives an error saying precision loss of data type


What is the difference between datatype and keyword in c?

data type refers to the kind of value that is held by a particular variable. For ex: an int variable contains integer value, a string holds a alpha numeric value etc. variable refers to the name of a value using which we can refer to this value. Ex: public int age = 28; here int is the data type and age is the variable.

Related Questions

When you assign the value 5.628 into a float variable how can you avoid getting the decimal truncation warning?

When assigning a literal value, such as 5.628, to a float variable, you can avoid the decimal truncation warning by either using the float form of the constant (float var = 5.628f), typecasting the assignment (float var = (float) 5.628), or by making the variable double (double var = 5.628).


Why the float takes 4 bytes in turbo c plus plus?

What's your problem with that? It's a (quasi-)standard value for a 'float'.


How do you declare a variable with initial value of 20.1234?

float myVariable = 20.1234;


How can I convert a float to a double in Java?

To convert a float to a double in Java, you can simply assign the float value to a double variable. Java will automatically perform the conversion for you. Here's an example: java float floatValue 10.5f; double doubleValue floatValue; In this example, the float value 10.5f is assigned to the double variable doubleValue, which will now hold the converted double value.


What is the difference between pointer variable and simple variable What are the advantages of pointer variable?

normal variable stores a value of the given datatype where as the pointer variable stores the address of a variable. for example int n=10; int *p; p=&n; here p is a pointer variable and n is a normal variable.p stores the address of n where as n stores an integer value. *p prints the value of n,p prints the address of n.


What is the by default value of globally declaration variable?

int, float: 0 pointer: NULL


Can an float value be assigned to int variable?

Yes, an integer can be assigned as a float value.But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.eg:float b=12;// an integer constant is assigned to a float variableprintf("%f",b);// when printing b it will print as 12.000000


How do you invoke function result () takes two float argument and returns an integer in c plus plus program?

You can do this by creating a forwarddeclaration of the function. You can call the forward drclared function inside the main to use it.int result(float num1, float num2);intmain(void){int value = result(3.14, 2.74);return (0);}intresult(float num1, float num2){int value = 0;// function codes goes here// you can alter the value of variable 'value'return (value);}The returning value of the 'result()' function is assigned to variable 'value' in 'main()'.


Can a double value be assigned to float variable?

THIS IS FOR JAVA i don't know about anything about other languages yes it can be assignedthe syntax is:int (number) = (float) numberFOR EXAMPLE:int = a;a = (float ) 5.5;if the (float) is not there then in Java it gives an error saying precision loss of data type


What is the difference between datatype and keyword in c?

data type refers to the kind of value that is held by a particular variable. For ex: an int variable contains integer value, a string holds a alpha numeric value etc. variable refers to the name of a value using which we can refer to this value. Ex: public int age = 28; here int is the data type and age is the variable.


Assign the value of pie ie 3.142 to a variable with requisite data type?

float pi = 3.142; // Note: pi is an irrational number, there is no "exact" value of pi


What is the value of xytohbyte?

10 to the 36th power in Bytes or 1,000,000,000,000,000,000,000,000,000,000,000,000 Bytes