# Floating Point Representation - Online Article

## Rules for Constructing Real Constant

Real Constants are often called Floating point Constant. The real Constant could be written in two forms - Fractional Form and Exponential Form.

1. A Real Constant must have at least one digit
2. It must have a decimal point.
3. It could be either positive or negative.
4. Default sign is positive.
5. No commas orblanks are allowed within a real Constant.

Example: +325.34, 426.0,-32.70,-48.5792

The exponential form of presentationof real Constants is usually used if the value of the Constant is either toosmall or too large. The Real Constant is represented in two parts. The partappearing before ‘e’ is called mantissa, where as the part following ‘e’ iscalled exponent. Thus 0.000342 can be represented in exponential form as 3.42e-4.

1. The mantissa part and the exponential part should beseparated by a letter e or E.
2. The mantissa part may have a positive or negative sign.
3. Default sign of mantissa part is positive.
4. Range of Real Constantsexpressed in exponential form is -3.4e38 to 3.4e38.

## Representation of floating point numbers in memory

### Steps

1. Expressthe number in exponential form.
2. Addthe bias component to the exponent.(for float 127 For long float :1023)
3. Filthe sgn bit with the binary value 0 or 1 for +ve or –ve of the mantisa
4. Fillthe binary value of the exponent in the high order byte.
5. Fillthe remaining bit binary value of the exponent in the 2nd high order byte.
6. Filthe binary value of the mantissa startingfrom the 2nd high order byte to the low order byte.

Example:

`Number: 3.5Binary Equivalent : 11.1Exponential notation: 1.11e 1 + 1271.11 e 1281.11e10000000mantissa :  11exponent :  10000000Sign value : 0`