# 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.

- A Real Constant must have at least one digit
- It must have a decimal point.
- It could be either positive or negative.
- Default sign is positive.
- 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.

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

## Representation of floating point numbers in memory

### Steps

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

**Example:**

Number: 3.5

Binary Equivalent : 11.1

Exponential notation: 1.11e 1 + 127

1.11 e 128

1.11e10000000

mantissa : 11

exponent : 10000000

Sign value : 0

### About the Author:

*No further information.*

## Related Online Articles:

- What is PHP and what is its use
- Object Persistence & Distribution
- Object Oriented Programming: Introduction
- Intro to Flash and Making Moving Text
- Introduction To QBASIC
- Common Pitfalls for PHP Coders
- HTML Headings & Tables
- Mouse Events and colors in Visual Basic 6
- Learning Photoshop: Navigating the Workspace
- About Ruby

## Comments

Rajesh Kumar Gupta on Nice writeup man. But it can be more informative. | |

Vikash Jaiswal on explanation was impressive | |

Aditya Prabhakar on thanks :) | |

Aditya Prabhakar on thanks :) |