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
- 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 2nd high order byte.
- Filthe binary value of the mantissa startingfrom the 2nd high order byte to the low order byte.
Binary Equivalent : 11.1
Exponential notation: 1.11e 1 + 127
1.11 e 128
mantissa : 11
exponent : 10000000
Sign value : 0
Related Online Articles:
- Introduction To QBASIC
- HTML Basics
- Object Oriented Programming: Introduction
- Remote Method Invocation (RMI)
- What is PHP and what is its use
- Intro to Flash and Making Moving Text
- Mouse Events and colors in Visual Basic 6
- Java XML Digital Signature API
- Learning Photoshop: Navigating the Workspace
- HTML Headings & Tables