Formal Definition
The real constants are used to specify floating-point numbers.
Simplified Syntax
sign unsigned_number.unsigned_number
sign unsigned_number.unsigned_number e sign unsigned_number
sign unsigned_number.unsigned_number E sign unsigned_number
Description
A real constant can be specified using only digits, underscores, decimal points and exponential symbols (e or E). It cannot be specified with size or base format. If a decimal point is provided then the real number should have at least one digit on both sides of a decimal point. Real numbers can be specified in the decimal notation (Example 1) or in the scientific notation (Example 2).
Examples
Example 1
17.5
0.5
1_000_000.0
Example 2
10e5
0.5694_e-5
Important Notes
· The real constants cannot be specified with size or base format.
No comments:
Post a Comment
Please provide valuable comments and suggestions for our motivation. Feel free to write down any query if you have regarding this post.