Skip to content

Commit e826219

Browse files
committed
Merge 2016-02 CWG Motion 12
2 parents 897071a + 4f09435 commit e826219

File tree

1 file changed

+76
-17
lines changed

1 file changed

+76
-17
lines changed

source/lex.tex

Lines changed: 76 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@
497497
pp-number \terminal{'} nondigit\br
498498
pp-number \terminal{e} sign\br
499499
pp-number \terminal{E} sign\br
500+
pp-number \terminal{p} sign\br
501+
pp-number \terminal{P} sign\br
500502
pp-number \terminal{.}
501503
\end{bnf}
502504

@@ -803,9 +805,7 @@
803805

804806
\begin{bnf}
805807
\nontermdef{hexadecimal-literal}\br
806-
\terminal{0x} hexadecimal-digit\br
807-
\terminal{0X} hexadecimal-digit\br
808-
hexadecimal-literal \terminal{'}\opt hexadecimal-digit
808+
hexadecimal-prefix hexadecimal-digit-sequence
809809
\end{bnf}
810810

811811
\begin{bnf}
@@ -824,6 +824,17 @@
824824
\terminal{1 2 3 4 5 6 7 8 9}
825825
\end{bnf}
826826

827+
\begin{bnf}
828+
\nontermdef{hexadecimal-prefix} \textnormal{one of}\br
829+
\terminal{0x 0X}
830+
\end{bnf}
831+
832+
\begin{bnf}
833+
\nontermdef{hexadecimal-digit-sequence}\br
834+
hexadecimal-digit\br
835+
hexadecimal-digit-sequence \terminal{'}\opt hexadecimal-digit
836+
\end{bnf}
837+
827838
\begin{bnf}
828839
\nontermdef{hexadecimal-digit} \textnormal{one of}\br
829840
\terminal{0 1 2 3 4 5 6 7 8 9}\br
@@ -1202,22 +1213,46 @@
12021213
\indextext{literal!floating}%
12031214
\begin{bnf}
12041215
\nontermdef{floating-literal}\br
1216+
decimal-floating-literal\br
1217+
hexadecimal-floating-literal
1218+
\end{bnf}
1219+
1220+
\begin{bnf}
1221+
\nontermdef{decimal-floating-literal}\br
12051222
fractional-constant exponent-part\opt floating-suffix\opt\br
12061223
digit-sequence exponent-part floating-suffix\opt
12071224
\end{bnf}
12081225

1226+
\begin{bnf}
1227+
\nontermdef{hexadecimal-floating-literal}\br
1228+
hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part floating-suffix\opt\br
1229+
hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-suffix\opt
1230+
\end{bnf}
1231+
12091232
\begin{bnf}
12101233
\nontermdef{fractional-constant}\br
12111234
digit-sequence\opt{} \terminal{.} digit-sequence\br
12121235
digit-sequence \terminal{.}
12131236
\end{bnf}
12141237

1238+
\begin{bnf}
1239+
\nontermdef{hexadecimal-fractional-constant}\br
1240+
hexadecimal-digit-sequence\opt{} \terminal{.} hexadecimal-digit-sequence\br
1241+
hexadecimal-digit-sequence \terminal{.}
1242+
\end{bnf}
1243+
12151244
\begin{bnf}
12161245
\nontermdef{exponent-part}\br
12171246
\terminal{e} sign\opt digit-sequence\br
12181247
\terminal{E} sign\opt digit-sequence
12191248
\end{bnf}
12201249

1250+
\begin{bnf}
1251+
\nontermdef{binary-exponent-part}\br
1252+
\terminal{p} sign\opt digit-sequence\br
1253+
\terminal{P} sign\opt digit-sequence
1254+
\end{bnf}
1255+
12211256
\begin{bnf}
12221257
\nontermdef{sign} \textnormal{one of}\br
12231258
\terminal{+ -}
@@ -1236,23 +1271,45 @@
12361271

12371272
\pnum
12381273
\indextext{literal!floating}%
1239-
A floating literal consists of an integer part, a decimal point, a
1240-
fraction part, an
1274+
A floating literal consists of
1275+
an optional prefix specifying a base,
1276+
an integer part,
1277+
a radix point,
1278+
a fraction part,
12411279
\indextext{suffix!\idxcode{e}}%
12421280
\indextext{suffix!\idxcode{E}}%
1243-
\tcode{e} or \tcode{E}, an optionally signed integer exponent, and an
1244-
optional type suffix. The integer and fraction parts both consist of a
1245-
sequence of decimal (base ten) digits. Optional separating single quotes in a
1246-
\grammarterm{digit-sequence} are ignored when determining its value.
1281+
\indextext{suffix!\idxcode{p}}%
1282+
\indextext{suffix!\idxcode{P}}%
1283+
an \tcode{e}, \tcode{E}, \tcode{p} or \tcode{P},
1284+
an optionally signed integer exponent, and
1285+
an optional type suffix.
1286+
The integer and fraction parts both consist of
1287+
a sequence of decimal (base ten) digits if there is no prefix, or
1288+
hexadecimal (base sixteen) digits if the prefix is \tcode{0x} or \tcode{0X}.
1289+
\indextext{literal!decimal floating}%
1290+
The literal is a \term{decimal floating literal} in the former case and
1291+
\indextext{literal!hexadecimal floating}%
1292+
a \term{hexadecimal floating literal} in the latter case.
1293+
Optional separating single quotes in
1294+
a \grammarterm{digit-sequence} or \grammarterm{hexadecimal-digit-sequence}
1295+
are ignored when determining its value.
12471296
\enterexample The literals \tcode{1.602'176'565e-19} and \tcode{1.602176565e-19}
12481297
have the same value. \exitexample
1249-
Either the integer part or the
1250-
fraction part (not both) can be omitted; either the decimal point or the
1251-
letter \tcode{e} (or \tcode{E} ) and the exponent (not both) can be
1252-
omitted. The integer part, the optional decimal point and the optional
1253-
fraction part form the \term{significant part} of the
1254-
floating literal. The exponent, if present, indicates the power of 10 by
1255-
which the significant part is to be scaled. If the scaled value is in
1298+
Either the integer part or the fraction part (not both) can be omitted.
1299+
Either the radix point or the letter \tcode{e} or \tcode{E} and
1300+
the exponent (not both) can be omitted from a decimal floating literal.
1301+
The radix point (but not the exponent) can be omitted
1302+
from a hexadecimal floating literal.
1303+
The integer part, the optional radix point, and the optional fraction part,
1304+
form the \defn{significand} of the floating literal.
1305+
In a decimal floating literal, the exponent, if present,
1306+
indicates the power of 10 by which the significand is to be scaled.
1307+
In a hexadecimal floating literal, the exponent
1308+
indicates the power of 2 by which the significand is to be scaled.
1309+
\enterexample
1310+
The literals \tcode{49.625} and \tcode{0xC.68p+2} have the same value.
1311+
\exitexample
1312+
If the scaled value is in
12561313
the range of representable values for its type, the result is the scaled
12571314
value if representable, else the larger or smaller representable value
12581315
nearest the scaled value, chosen in an \impldef{choice of larger or smaller value of
@@ -1615,7 +1672,9 @@
16151672
\begin{bnf}
16161673
\nontermdef{user-defined-floating-literal}\br
16171674
fractional-constant exponent-part\opt ud-suffix\br
1618-
digit-sequence exponent-part ud-suffix
1675+
digit-sequence exponent-part ud-suffix\br
1676+
hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part ud-suffix\br
1677+
hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part ud-suffix
16191678
\end{bnf}
16201679

16211680
\begin{bnf}

0 commit comments

Comments
 (0)