From Jason Turner

[lex.fcon]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpgd_dnfxm/{from.md → to.md} +60 -19
tmp/tmpgd_dnfxm/{from.md → to.md} RENAMED
@@ -1,25 +1,49 @@
1
  ### Floating literals <a id="lex.fcon">[[lex.fcon]]</a>
2
 
3
  ``` bnf
4
  floating-literal:
 
 
 
 
 
 
5
  fractional-constant exponent-partₒₚₜ floating-suffixₒₚₜ
6
  digit-sequence exponent-part floating-suffixₒₚₜ
7
  ```
8
 
 
 
 
 
 
 
9
  ``` bnf
10
  fractional-constant:
11
  digit-sequenceₒₚₜ '.' digit-sequence
12
  digit-sequence '.'
13
  ```
14
 
 
 
 
 
 
 
15
  ``` bnf
16
  exponent-part:
17
  'e' signₒₚₜ digit-sequence
18
  'E' signₒₚₜ digit-sequence
19
  ```
20
 
 
 
 
 
 
 
21
  ``` bnf
22
  sign: one of
23
  '+ -'
24
  ```
25
 
@@ -32,25 +56,42 @@ digit-sequence:
32
  ``` bnf
33
  floating-suffix: one of
34
  'f l F L'
35
  ```
36
 
37
- A floating literal consists of an integer part, a decimal point, a
38
- fraction part, an `e` or `E`, an optionally signed integer exponent, and
39
- an optional type suffix. The integer and fraction parts both consist of
40
- a sequence of decimal (base ten) digits. Optional separating single
41
- quotes in a *digit-sequence* are ignored when determining its value. The
42
- literals `1.602'176'565e-19` and `1.602176565e-19` have the same value.
43
- Either the integer part or the fraction part (not both) can be omitted;
44
- either the decimal point or the letter `e` (or `E` ) and the exponent
45
- (not both) can be omitted. The integer part, the optional decimal point
46
- and the optional fraction part form the *significant part* of the
47
- floating literal. The exponent, if present, indicates the power of 10 by
48
- which the significant part is to be scaled. If the scaled value is in
49
- the range of representable values for its type, the result is the scaled
50
- value if representable, else the larger or smaller representable value
51
- nearest the scaled value, chosen in an *implementation-defined* manner.
52
- The type of a floating literal is `double` unless explicitly specified
53
- by a suffix. The suffixes `f` and `F` specify `float`, the suffixes `l`
54
- and `L` specify `long` `double`. If the scaled value is not in the range
55
- of representable values for its type, the program is ill-formed.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
 
1
  ### Floating literals <a id="lex.fcon">[[lex.fcon]]</a>
2
 
3
  ``` bnf
4
  floating-literal:
5
+ decimal-floating-literal
6
+ hexadecimal-floating-literal
7
+ ```
8
+
9
+ ``` bnf
10
+ decimal-floating-literal:
11
  fractional-constant exponent-partₒₚₜ floating-suffixₒₚₜ
12
  digit-sequence exponent-part floating-suffixₒₚₜ
13
  ```
14
 
15
+ ``` bnf
16
+ hexadecimal-floating-literal:
17
+ hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part floating-suffixₒₚₜ
18
+ hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-suffixₒₚₜ
19
+ ```
20
+
21
  ``` bnf
22
  fractional-constant:
23
  digit-sequenceₒₚₜ '.' digit-sequence
24
  digit-sequence '.'
25
  ```
26
 
27
+ ``` bnf
28
+ hexadecimal-fractional-constant:
29
+ hexadecimal-digit-sequenceₒₚₜ '.' hexadecimal-digit-sequence
30
+ hexadecimal-digit-sequence '.'
31
+ ```
32
+
33
  ``` bnf
34
  exponent-part:
35
  'e' signₒₚₜ digit-sequence
36
  'E' signₒₚₜ digit-sequence
37
  ```
38
 
39
+ ``` bnf
40
+ binary-exponent-part:
41
+ 'p' signₒₚₜ digit-sequence
42
+ 'P' signₒₚₜ digit-sequence
43
+ ```
44
+
45
  ``` bnf
46
  sign: one of
47
  '+ -'
48
  ```
49
 
 
56
  ``` bnf
57
  floating-suffix: one of
58
  'f l F L'
59
  ```
60
 
61
+ A floating literal consists of an optional prefix specifying a base, an
62
+ integer part, a radix point, a fraction part, an `e`, `E`, `p` or `P`,
63
+ an optionally signed integer exponent, and an optional type suffix. The
64
+ integer and fraction parts both consist of a sequence of decimal (base
65
+ ten) digits if there is no prefix, or hexadecimal (base sixteen) digits
66
+ if the prefix is `0x` or `0X`. The floating literal is a *decimal
67
+ floating literal* in the former case and a *hexadecimal floating
68
+ literal* in the latter case. Optional separating single quotes in a
69
+ *digit-sequence* or *hexadecimal-digit-sequence* are ignored when
70
+ determining its value.
71
+
72
+ [*Example 1*: The floating literals `1.602'176'565e-19` and
73
+ `1.602176565e-19` have the same value. *end example*]
74
+
75
+ Either the integer part or the fraction part (not both) can be omitted.
76
+ Either the radix point or the letter `e` or `E` and the exponent (not
77
+ both) can be omitted from a decimal floating literal. The radix point
78
+ (but not the exponent) can be omitted from a hexadecimal floating
79
+ literal. The integer part, the optional radix point, and the optional
80
+ fraction part, form the *significand* of the floating literal. In a
81
+ decimal floating literal, the exponent, if present, indicates the power
82
+ of 10 by which the significand is to be scaled. In a hexadecimal
83
+ floating literal, the exponent indicates the power of 2 by which the
84
+ significand is to be scaled.
85
+
86
+ [*Example 2*: The floating literals `49.625` and `0xC.68p+2` have the
87
+ same value. — *end example*]
88
+
89
+ If the scaled value is in the range of representable values for its
90
+ type, the result is the scaled value if representable, else the larger
91
+ or smaller representable value nearest the scaled value, chosen in an
92
+ *implementation-defined* manner. The type of a floating literal is
93
+ `double` unless explicitly specified by a suffix. The suffixes `f` and
94
+ `F` specify `float`, the suffixes `l` and `L` specify `long` `double`.
95
+ If the scaled value is not in the range of representable values for its
96
+ type, the program is ill-formed.
97