Social Icons

9 July 2012

0 Rules for constructing Real constants

Real constants are often called Floating Point constants. The real constants could be written in two forms—Fractional form and Exponential form.
Following rules must be observed while constructing real constants expressed in fractional 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 or blanks are allowed within a real constant.

Example-
              +425.34
               256.0
              -22.76
              -43.5252

The exponential form of representation of real constants is usually used if the value of the constant is either too small or too large. It however doesn’t restrict us in any way from using exponential form of representation for other real constants.
In exponential form of representation, the real constant is represented in two parts. The part appearing before ‘e’ is called mantissa, whereas the part following ‘e’ is called exponent.
Following rules must be observed while constructing real constants expressed in exponential form:

1.The mantissa part and the exponential part should be separated by a letter e.
2.The mantissa part may have a positive or negative sign.
3.Default sign of mantissa part is positive.
4.The exponent must have at least one digit, which must be a positive or negative integer. Default sign is positive.
5.Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.

Example-
             +1.2e-5
               3.1e8
              -0.2e+3
              -3.2e

0 comments:

Post a Comment

Hey this is a test comment

Related Posts Plugin for WordPress, Blogger...