tmp/tmp6s1ghyza/{from.md → to.md}
RENAMED
|
@@ -1,23 +1,23 @@
|
|
| 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
|
|
@@ -52,46 +52,51 @@ digit-sequence:
|
|
| 52 |
digit
|
| 53 |
digit-sequence '''ₒₚₜ digit
|
| 54 |
```
|
| 55 |
|
| 56 |
``` bnf
|
| 57 |
-
floating-suffix: one of
|
| 58 |
'f l F L'
|
| 59 |
```
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
|
|
|
|
|
|
| 95 |
If the scaled value is not in the range of representable values for its
|
| 96 |
-
type, the program is ill-formed.
|
|
|
|
|
|
|
|
|
|
| 97 |
|
|
|
|
| 1 |
+
### Floating-point literals <a id="lex.fcon">[[lex.fcon]]</a>
|
| 2 |
|
| 3 |
``` bnf
|
| 4 |
+
floating-point-literal:
|
| 5 |
+
decimal-floating-point-literal
|
| 6 |
+
hexadecimal-floating-point-literal
|
| 7 |
```
|
| 8 |
|
| 9 |
``` bnf
|
| 10 |
+
decimal-floating-point-literal:
|
| 11 |
+
fractional-constant exponent-partₒₚₜ floating-point-suffixₒₚₜ
|
| 12 |
+
digit-sequence exponent-part floating-point-suffixₒₚₜ
|
| 13 |
```
|
| 14 |
|
| 15 |
``` bnf
|
| 16 |
+
hexadecimal-floating-point-literal:
|
| 17 |
+
hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part floating-point-suffixₒₚₜ
|
| 18 |
+
hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-point-suffixₒₚₜ
|
| 19 |
```
|
| 20 |
|
| 21 |
``` bnf
|
| 22 |
fractional-constant:
|
| 23 |
digit-sequenceₒₚₜ '.' digit-sequence
|
|
|
|
| 52 |
digit
|
| 53 |
digit-sequence '''ₒₚₜ digit
|
| 54 |
```
|
| 55 |
|
| 56 |
``` bnf
|
| 57 |
+
floating-point-suffix: one of
|
| 58 |
'f l F L'
|
| 59 |
```
|
| 60 |
|
| 61 |
+
The type of a *floating-point-literal* is determined by its
|
| 62 |
+
*floating-point-suffix* as specified in [[lex.fcon.type]].
|
| 63 |
+
|
| 64 |
+
**Table: Types of *floating-point-literal*{s}** <a id="lex.fcon.type">[lex.fcon.type]</a>
|
| 65 |
+
|
| 66 |
+
| *floating-point-suffix* | type |
|
| 67 |
+
| ----------------------- | --------------- |
|
| 68 |
+
| none | `double` |
|
| 69 |
+
| `f` or `F` | `float` |
|
| 70 |
+
| `l` or `L` | `long` `double` |
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
The *significand* of a *floating-point-literal* is the
|
| 74 |
+
*fractional-constant* or *digit-sequence* of a
|
| 75 |
+
*decimal-floating-point-literal* or the
|
| 76 |
+
*hexadecimal-fractional-constant* or *hexadecimal-digit-sequence* of a
|
| 77 |
+
*hexadecimal-floating-point-literal*. In the significand, the sequence
|
| 78 |
+
of *digit*s or *hexadecimal-digit*s and optional period are interpreted
|
| 79 |
+
as a base N real number s, where N is 10 for a
|
| 80 |
+
*decimal-floating-point-literal* and 16 for a
|
| 81 |
+
*hexadecimal-floating-point-literal*.
|
| 82 |
+
|
| 83 |
+
[*Note 1*: Any optional separating single quotes are ignored when
|
| 84 |
+
determining the value. — *end note*]
|
| 85 |
+
|
| 86 |
+
If an *exponent-part* or *binary-exponent-part* is present, the exponent
|
| 87 |
+
e of the *floating-point-literal* is the result of interpreting the
|
| 88 |
+
sequence of an optional *sign* and the *digit*s as a base 10 integer.
|
| 89 |
+
Otherwise, the exponent e is 0. The scaled value of the literal is
|
| 90 |
+
s × 10ᵉ for a *decimal-floating-point-literal* and s × 2ᵉ for a
|
| 91 |
+
*hexadecimal-floating-point-literal*.
|
| 92 |
+
|
| 93 |
+
[*Example 1*: The *floating-point-literal*s `49.625` and `0xC.68p+2`
|
| 94 |
+
have the same value. The *floating-point-literal*s `1.602'176'565e-19`
|
| 95 |
+
and `1.602176565e-19` have the same value. — *end example*]
|
| 96 |
+
|
| 97 |
If the scaled value is not in the range of representable values for its
|
| 98 |
+
type, the program is ill-formed. Otherwise, the value of a
|
| 99 |
+
*floating-point-literal* is the scaled value if representable, else the
|
| 100 |
+
larger or smaller representable value nearest the scaled value, chosen
|
| 101 |
+
in an *implementation-defined* manner.
|
| 102 |
|