Real constants are often called Floating Point constants. The real constants could be written in two forms.
Ex:
+235.33
516.0
-34.73
-36.5789
Exponential form:
Ex:
+2.3e-5
5.1e5
-0.2e+4
-3.5e-4
- Fractional form
- Exponential form.
Fractional 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 or blanks are allowed within a real constant.
Ex:
+235.33
516.0
-34.73
-36.5789
Exponential form:
- The mantissa part and the exponential part should be separated by a letter e.
- The mantissa part may have a positive or negative sign.
- Default sign of mantissa part is positive.
- The exponent must have at least one digit, which must be a positive or negative integer. Default sign is positive.
- Range of real constants expressed in exponential form is -3.4e38 to 3.4e38.
Ex:
+2.3e-5
5.1e5
-0.2e+4
-3.5e-4
No comments:
Post a Comment