Thread Links | Date Links | ||||
---|---|---|---|---|---|
Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
John, Michel, > The further discussion with Dmitry seems on the lines of whether what was previously un-plated should be chromium-plated, > silver-plated or gold-plated. Stick with chromium, IMO, and defer possible gold to a future revision. Please look at another plate. -Dima ----- Original Message ----- From: j.d.pryce@xxxxxxxxxx To: mhack@xxxxxxx Cc: stds-1788@xxxxxxxxxxxxxxxxx Sent: Monday, June 23, 2014 10:47:32 AM GMT +04:00 Abu Dhabi / Muscat Subject: Re: Proposed replacement for 14.4 and C6.2 (interchange encodings) Michel On 2014 Jun 22, at 19:11, Michel Hack wrote: > The first three paragraphs of 14.4 are ok. I start with rewriting the > fourth paragraph, which currently begins the same way: > > Interchange Level 4 encoding of an interval datum is a bit string that > comprises, in the order defined above, the platform's representation > of the 754-2008 interchange encodings of the two floating-datums, and > of the decoration represented as a small integer, as detailed below. > Since the 754-2008 standard supports two different encodings for > decimal formats, and does not address the Endianness issue at all, > this standard defines a *standard type signature*, described below, > which incorporates the parameters of the encoding... Personally I would be happy with the scheme you propose. The further discussion with Dmitry seems on the lines of whether what was previously un-plated should be chromium-plated, silver-plated or gold-plated. Stick with chromium, IMO, and defer possible gold to a future revision. But I have these criticisms/queries: 1. "... implementation shall provide, for each interchange encoding, a standard type signature" This is meaningless. An implementation doesn't provide concepts, it provides means to create and manipulate objects. I suggest something like "The standard defines, for each interchange encoding, a standard type signature, which is ... A 754-conforming implementation shall provide means to create the signature of each such encoding. This signature may be included, in an application-defined way, in a header that accompanies interchange-encoded intervals for export. This achieves fairly universal portability." Remove the later sentence about portability. 2. Some wording is insufficiently standardese e.g. the several "(assuming ...)" comments. I suggest these go into the Note at the end. 3. From what you said earlier, the \0 null byte seems to be aimed at making it easier to decide endianness. But why? don't the initial 8 bytes of ASCII tell that? I'm wondering if this byte could be used to distinguish bare from decorated interval data. Attached is my first try at typesetting your proposal (§14.4 only). John Pryce
Attachment:
octets.pdf
Description: Adobe PDF document
Index: P1788G_level3_B.tex =================================================================== --- P1788G_level3_B.tex (revision 369) +++ P1788G_level3_B.tex (working copy) @@ -77,10 +77,10 @@ \begin{tabular}{c|c} Decoration & Encoding \\\hline \Dill & 00000000 \\ - \Dtrv & 00100000 \\ - \Ddef & 01000000 \\ - \Ddac & 01100000 \\ - \Dcom & 10000000 \\ + \Dtrv & 00000100 \\ + \Ddef & 00001000 \\ + \Ddac & 00001100 \\ + \Dcom & 00010000 \\ \end{tabular} %\begin{tabular}{l|c|c|c|c|c} % Decoration & \Dill & \Dtrv & \Ddef & \Ddac & \Dcom \\\hline @@ -100,7 +100,7 @@ $3$ & 01000000 00001000 00000000 00000000 00000000 00000000 00000000 00000000 \\ - \Dcom & 10000000 + \Dcom & 00010000 \end{tabular} Index: P1788G_level3.tex =================================================================== --- P1788G_level3.tex (revision 369) +++ P1788G_level3.tex (working copy) @@ -127,10 +127,10 @@ \begin{tabular}{c|c} Decoration & Encoding \\\hline \Dill & 00000000 \\ - \Dtrv & 00100000 \\ - \Ddef & 01000000 \\ - \Ddac & 01100000 \\ - \Dcom & 10000000 \\ + \Dtrv & 00000100 \\ + \Ddef & 00001000 \\ + \Ddac & 00001100 \\ + \Dcom & 00010000 \\ \end{tabular} %\begin{tabular}{l|c|c|c|c|c} % Decoration & \Dill & \Dtrv & \Ddef & \Ddac & \Dcom \\\hline @@ -137,6 +137,9 @@ % Representation & 0 & 1 & 2 & 3 & 4 \\ %\end{tabular} \ec +\note{This encoding permits future refinement without disturbing the natural + propagation order of the decorations, and fits within the range of a C + signed char, namely 0..127.} \example{ The interchange representation of inf-sup \@binary32@ decorated interval $[-1,3]_\Dcom$ is a triple @@ -148,12 +151,12 @@ \begin{tabular}{l|l} -0x1.000000p0 & 10111111\_10000000\_00000000\_00000000 \\ +0x1.800000p1 & 01000000\_01000000\_00000000\_00000000 \\ - \Dcom & 10000000 . \\ + \Dcom & 00010000 . \\ \end{tabular} The interchange encoding of the interval is a bit string of length 72: -10111111\_10000000\_00000000\_00000000\_01000000\_01000000\_00000000\_00000000\_10000000 . +10111111\_10000000\_00000000\_00000000\_01000000\_01000000\_00000000\_00000000\_00010000 . } %Interchange representations of fields are not completely specified by this standard. @@ -180,3 +183,7 @@ attributes besides the standard ones, then how it maps them to an interchange encoding is \Idefd. +The length of an interchange encoding bit string is a multiple of 8 because +interchange media (files, network) is usually organized in bytes/octets. +The mapping from bit strings to sequences of bytes/octets is not defined by this +standard. See the appendix \apref{octets} for examples of this mapping. Index: P1788J2_Octets.tex =================================================================== --- P1788J2_Octets.tex (revision 0) +++ P1788J2_Octets.tex (working copy) @@ -0,0 +1,124 @@ +% !TEX root = P1788_MAIN.tex +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\chapter{Mapping from bit strings to octet sequencess}\label{ap:octets} + +The level 3 representation and level 4 encoding of 754 bare and \dIdts are defined in \ssref{lvl3interchfmt}. +Let $\F$ be a supported 754 format. +The parameters of an encoding are $\F'$ -- a 754 interchange format wider than $\F$ or a $\F$ itself and the choice between densely packed decimal (DPD) or binary integer decimal (BID) significand encoding for decimal 754 interchange formats (754 \S 3.5). +If the length of chosen 754 interchange format $\F'$ is $N$, then the level 4 encoding of the \bintvl inf-sup type $\T$ derived from derived from $\F$ is a bit string of length $2*N$ and the level 4 encoding of the \dIdt\ $\DT$ derived from $\T$ is a bit string of length $2*N+8$. + +The length of bit string is a multiple of 8 because interchange media (file, network) is usually organized into groups of 8 bits named octets or bytes. The mapping from bit strings to sequences of octets is left unspecified in the IEEE 754 standard. This mapping is also unspecified in this standard. This annex gives only some hints on this mapping. + +Let $\name{bits}$ be a bit string -- interchange encoding of the \bintvl inf-sup type $\T$ or the \dIdt\ $\DT$. +We enumerate bits of the bit string by integer indices from $0$ to $2*N-1$ or from $0$ to $2*N+7$. +The bit $\name{bits}_0$ is the sign bit of the encoding the first field of the representation containing floating-point datum $\name{inf}(x)$. + +\section{Plain mapping}~ + +The plain mapping from a bit string encoding $\name{bits}$ of the \bintvl inf-sup type $\T$ or the \dIdt\ $\DT$ +is a sequence of $N/4$ or $N/4+1$ octets where $N$ is the length of chosen 754 interchange format $\F'$. +The octet $i$ contains bits from $\name{bits}_{8*i}$ to $\name{bits}_{8*i+7}$. +It's not specified how the writer application tells the reader application the choice of $\F'$ and the choice between DPD and BID for decimal formats. + +The octets of the example $[-1,3]_\Dcom$ from \ssref{lvl3interchfmt} are +\bc +\begin{tabular}{l} + 10111111 \\ + 10000000 \\ + 00000000 \\ + 00000000 \\ + 01000000 \\ + 01000000 \\ + 00000000 \\ + 00000000 \\ + 00010000 . \\ +\end{tabular} +\ec + +\section{Signature-driven mapping}~ + +Since the 754-2008 standard supports two different encodings for + decimal formats, and does not address mapping to octets issue at all, + this mapping defines a *standard type signature*, described below, + which incorporates the parameters of the encoding and of the mapping. +A signature is an ASCII string. Its syntax is defined by the grammar in \tbref{octetssign}. + +{%start definitions for grammar +\newcommand\M[1]{\mbox{\tt#1}} %for metacharacter like * + ? +\newcommand\C[1]{\mbox{\tt\M[#1\M]}} %for character-list [...] notation +\newcommand\Trm[1]{\mbox{\sf#1}} %term defined on LHS +\newcommand\trm[1]{\,\M\{\mbox{\sf#1}\M\}\,} %term referred to on RHS +\renewcommand\L[1]{\mbox{\tt"#1"}} %for literal string in quotes + +\begin{table}[t] +\begin{tabular}{ll} +\Trm{formatSize} & \trm{natural} \\ +\Trm{encoding} & \M( \L{bin} \M| \L{dpd} \M| \L{bid} \M) \\ +\Trm{decSize} & \trm{natural} \\ +\Trm{bareSignature} & \L{p1788} \L\_ \trm{encoding} \trm{formatSize} \L\_ \M( \L{msb} \M| \L{lsb} \M) \\ +\Trm{decSignature} & \trm{bareSignature} \L\_ \L{d} \trm{decSize} +\end{tabular} +\caption{Grammar for signatures: signature of \bintvl is \Trm{integerLiteral}, signature of \dIdt is \Trm{numberLiteral}, \Trm{formatSize} is a size of valid 754 interchange format, \Trm{decSize} is a multiple of 8.\label{tb:octetssign}} +\end{table} +}%end definitions for grammar + +The msb/lsb choice in the signature is to address so-called endianess. + +The flexibility in the size of the decoration is to accomodate + alignment and padding issues -- or systems whose "small integer" + datatype is a word and not a byte. + +Such a type signature could be included in a header that accompanies +interchange-encoded intervals for export, to achieve fairly universal +portability. + +A mapping defined by bare signature $\name{p1788\_encN\_lsb}$ contains $N/4$ octets +\begin{align*} + \name{octet}_i = + \left\{\begin{array}{ll} + $\name{bits}[{N-i*8-8}:{N-i*8-1}]$ &\text{if $0 \le i < N/8$}, \\ + $\name{bits}[{N*3-i*8-8}:{N*3-i*8-1}]$ &\text{if $N/8 \le i < N/4$}. \\ + \end{array}\right. +\end{align*} + +A mapping defined by decorated signature $\name{p1788\_encN\_lsb\_dM}$ contains $N/4+M/8$ octets +\begin{align*} + \name{octet}_i = + \left\{\begin{array}{ll} + $\name{bits}[{N-i*8-8}:{N-i*8-1}]$ &\text{if $0 \le i < N/8$}, \\ + $\name{bits}[{N*3-i*8-8}:{N*3-i*8-1}]$ &\text{if $N/8 \le i < N/4$}, \\ + $\name{bits}[{N*2}:{N*2+7}]$ &\text{if $i = N/4$}, \\ + 00000000 &\text{if $N/4 \le i < N/4+M/8$} \\ + \end{array}\right. +\end{align*} + +A mapping defined by bare signature $\name{p1788\_encN\_msb}$ contains $N/4$ octets +\begin{align*} + \name{octet}_i = \name{bits}[{i*8}:{i*8+7}]. +\end{align*} + +A mapping defined by decorated signature $\name{p1788\_encN\_msb\_dM}$ contains $N/4+M/8$ octets +\begin{align*} + \name{octet}_i = + \left\{\begin{array}{ll} + $\name{bits}[{i*8}:{i*8+7}]$ &\text{if $0 \le i < N/4$}, \\ + 00000000 &\text{if $N/4 \le i < N/4+M/8-1$} \\ + $\name{bits}[{N*2}:{N*2+7}]$ &\text{if $i = N/4+M/8-1$} \\ + \end{array}\right. +\end{align*} + +\example{ +Here are examples of signatures +\bc +\begin{tabular}{ll} +\text{p1788\_bin64\_msb} & \text{signature for bare infsup\_bin64 equivalent to plain mapping}, \\ +\text{p1788\_bin64\_msb\_d8} & \text{signature for decorated infsup\_bin64 equivalent to plain mapping}, \\ +\text{p1788\_bid32\_msb\_d8} & \text{signature for decorated infsup\_dec32 equivalent to plain mapping}, \\ +\text{p1788\_dpd32\_msb\_d8} & \text{another signature for decorated infsup\_dec32 equivalent to plain mapping}, \\ +\text{p1788\_bin64\_lsb\_d32} & \text{signature for decorated infsup\_bin64 convenient on x86 machines} \\ +\end{tabular} +\ec +} + + Index: P1788_MAIN.tex =================================================================== --- P1788_MAIN.tex (revision 369) +++ P1788_MAIN.tex (working copy) @@ -427,6 +427,7 @@ %\include{P1788J2_FTDIA_case} %\include{P1788J2_Extrastuff} %\include{P1788J2_level2extrabits} +\include{P1788J2_Octets} %-----Kaucher, yet to come-----
% !TEX root = P1788_MAIN.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Mapping from bit strings to octet sequencess}\label{ap:octets} The level 3 representation and level 4 encoding of 754 bare and \dIdts are defined in \ssref{lvl3interchfmt}. Let $\F$ be a supported 754 format. The parameters of an encoding are $\F'$ -- a 754 interchange format wider than $\F$ or a $\F$ itself and the choice between densely packed decimal (DPD) or binary integer decimal (BID) significand encoding for decimal 754 interchange formats (754 \S 3.5). If the length of chosen 754 interchange format $\F'$ is $N$, then the level 4 encoding of the \bintvl inf-sup type $\T$ derived from derived from $\F$ is a bit string of length $2*N$ and the level 4 encoding of the \dIdt\ $\DT$ derived from $\T$ is a bit string of length $2*N+8$. The length of bit string is a multiple of 8 because interchange media (file, network) is usually organized into groups of 8 bits named octets or bytes. The mapping from bit strings to sequences of octets is left unspecified in the IEEE 754 standard. This mapping is also unspecified in this standard. This annex gives only some hints on this mapping. Let $\name{bits}$ be a bit string -- interchange encoding of the \bintvl inf-sup type $\T$ or the \dIdt\ $\DT$. We enumerate bits of the bit string by integer indices from $0$ to $2*N-1$ or from $0$ to $2*N+7$. The bit $\name{bits}_0$ is the sign bit of the encoding the first field of the representation containing floating-point datum $\name{inf}(x)$. \section{Plain mapping}~ The plain mapping from a bit string encoding $\name{bits}$ of the \bintvl inf-sup type $\T$ or the \dIdt\ $\DT$ is a sequence of $N/4$ or $N/4+1$ octets where $N$ is the length of chosen 754 interchange format $\F'$. The octet $i$ contains bits from $\name{bits}_{8*i}$ to $\name{bits}_{8*i+7}$. It's not specified how the writer application tells the reader application the choice of $\F'$ and the choice between DPD and BID for decimal formats. The octets of the example $[-1,3]_\Dcom$ from \ssref{lvl3interchfmt} are \bc \begin{tabular}{l} 10111111 \\ 10000000 \\ 00000000 \\ 00000000 \\ 01000000 \\ 01000000 \\ 00000000 \\ 00000000 \\ 00010000 . \\ \end{tabular} \ec \section{Signature-driven mapping}~ Since the 754-2008 standard supports two different encodings for decimal formats, and does not address mapping to octets issue at all, this mapping defines a *standard type signature*, described below, which incorporates the parameters of the encoding and of the mapping. A signature is an ASCII string. Its syntax is defined by the grammar in \tbref{octetssign}. {%start definitions for grammar \newcommand\M[1]{\mbox{\tt#1}} %for metacharacter like * + ? \newcommand\C[1]{\mbox{\tt\M[#1\M]}} %for character-list [...] notation \newcommand\Trm[1]{\mbox{\sf#1}} %term defined on LHS \newcommand\trm[1]{\,\M\{\mbox{\sf#1}\M\}\,} %term referred to on RHS \renewcommand\L[1]{\mbox{\tt"#1"}} %for literal string in quotes \begin{table}[t] \begin{tabular}{ll} \Trm{formatSize} & \trm{natural} \\ \Trm{encoding} & \M( \L{bin} \M| \L{dpd} \M| \L{bid} \M) \\ \Trm{decSize} & \trm{natural} \\ \Trm{bareSignature} & \L{p1788} \L\_ \trm{encoding} \trm{formatSize} \L\_ \M( \L{msb} \M| \L{lsb} \M) \\ \Trm{decSignature} & \trm{bareSignature} \L\_ \L{d} \trm{decSize} \end{tabular} \caption{Grammar for signatures: signature of \bintvl is \Trm{integerLiteral}, signature of \dIdt is \Trm{numberLiteral}, \Trm{formatSize} is a size of valid 754 interchange format, \Trm{decSize} is a multiple of 8.\label{tb:octetssign}} \end{table} }%end definitions for grammar The msb/lsb choice in the signature is to address so-called endianess. The flexibility in the size of the decoration is to accomodate alignment and padding issues -- or systems whose "small integer" datatype is a word and not a byte. Such a type signature could be included in a header that accompanies interchange-encoded intervals for export, to achieve fairly universal portability. A mapping defined by bare signature $\name{p1788\_encN\_lsb}$ contains $N/4$ octets \begin{align*} \name{octet}_i = \left\{\begin{array}{ll} $\name{bits}[{N-i*8-8}:{N-i*8-1}]$ &\text{if $0 \le i < N/8$}, \\ $\name{bits}[{N*3-i*8-8}:{N*3-i*8-1}]$ &\text{if $N/8 \le i < N/4$}. \\ \end{array}\right. \end{align*} A mapping defined by decorated signature $\name{p1788\_encN\_lsb\_dM}$ contains $N/4+M/8$ octets \begin{align*} \name{octet}_i = \left\{\begin{array}{ll} $\name{bits}[{N-i*8-8}:{N-i*8-1}]$ &\text{if $0 \le i < N/8$}, \\ $\name{bits}[{N*3-i*8-8}:{N*3-i*8-1}]$ &\text{if $N/8 \le i < N/4$}, \\ $\name{bits}[{N*2}:{N*2+7}]$ &\text{if $i = N/4$}, \\ 00000000 &\text{if $N/4 \le i < N/4+M/8$} \\ \end{array}\right. \end{align*} A mapping defined by bare signature $\name{p1788\_encN\_msb}$ contains $N/4$ octets \begin{align*} \name{octet}_i = \name{bits}[{i*8}:{i*8+7}]. \end{align*} A mapping defined by decorated signature $\name{p1788\_encN\_msb\_dM}$ contains $N/4+M/8$ octets \begin{align*} \name{octet}_i = \left\{\begin{array}{ll} $\name{bits}[{i*8}:{i*8+7}]$ &\text{if $0 \le i < N/4$}, \\ 00000000 &\text{if $N/4 \le i < N/4+M/8-1$} \\ $\name{bits}[{N*2}:{N*2+7}]$ &\text{if $i = N/4+M/8-1$} \\ \end{array}\right. \end{align*} \example{ Here are examples of signatures \bc \begin{tabular}{ll} \text{p1788\_bin64\_msb} & \text{signature for bare infsup\_bin64 equivalent to plain mapping}, \\ \text{p1788\_bin64\_msb\_d8} & \text{signature for decorated infsup\_bin64 equivalent to plain mapping}, \\ \text{p1788\_bid32\_msb\_d8} & \text{signature for decorated infsup\_dec32 equivalent to plain mapping}, \\ \text{p1788\_dpd32\_msb\_d8} & \text{another signature for decorated infsup\_dec32 equivalent to plain mapping}, \\ \text{p1788\_bin64\_lsb\_d32} & \text{signature for decorated infsup\_bin64 convenient on x86 machines} \\ \end{tabular} \ec }
%The revision history is stored in the SVN repository. %1 Aug 2012. % However "flavors" is a big change so I record that I % began revising the text to include them, on this date, % to remind where to rewind to if the whole idea is rejected. \documentclass[a4paper,reqno]{amsbook} \usepackage[numbers]{natbib} \renewcommand{\bibfont}{\small} %Version number which appears in title, headers, watermark. \newcommand{\docversion}{9.3} %\usepackage{refcheck} \usepackage{color,enumerate,graphicx,epstopdf,hyperref,listings,mathtools,multicol,xspace}%Must load graphicx before epstopdf! \usepackage[margin=3cm,headheight=.9cm,footskip=1cm]{geometry} \usepackage[normalem]{ulem} \usepackage{fancybox,minitoc,array,tabularx,xspace,moreverb} %\usepackage[color]{changebar} % Draftwatermark seems to be buggy - commented CKE \usepackage{draftwatermark,everypage} \SetWatermarkScale{2} \definecolor{lightgray}{rgb}{0.7,0.7,0.7} \definecolor{viola}{rgb}{1,0.8,0.85} \definecolor{darkred}{rgb}{.5,0,0} \definecolor{darkgreen}{rgb}{0,.5,0} \SetWatermarkText{\color{viola} \sf DRAFT \docversion} \usepackage{fancyhdr} \pagestyle{fancy} % Make tocdepth variable \usepackage{tocvsec2} % Using tocvsec2 %\setcounter{tocdepth}{3} \setcounter{secnumdepth}{4} % For change tracking, commentary and audit trail %\newcommand{\CB}{\cbcolor{darkred}\cbstart} %\newcommand{\CE}{\cbend} % When suppressing changebars (they can be temperamental) use these: \newcommand{\CB}{} \newcommand{\CE}{} %\newcommand{\notecomment}[1]{} %To disable \notecomments for now \newcommand{\notecomment}[1]% {\marginpar[\color{darkred}\small\flushright\hazard #1]% {\color{darkred}\small\hazard #1}} \setlength{\marginparwidth}{2cm} \newcommand{\JWGa}{\notecomment{JWvG\\20091209}}%Wolff von Gudenberg \newcommand{\CKa}{\notecomment{CK\\20100329}}%Keil \newcommand{\UKa}{\notecomment{UK\\20100329}}%Kulisch \newcommand{\hazard}{\quad\raisebox{-.25ex}{\makebox[0pt]{\LARGE$\bigtriangleup$}}\makebox[0pt]{!}\quad} \newcommand{\att}{ % mark at the margin \marginpar[ \hspace*{\fill} \raisebox{-0.2em}{\rule{2mm}{1.2em}} ] {\raisebox{-0.2em}{\rule{2mm}{1.2em}} } } % comments by John Pryce \newcommand{\HI}[1]{\noindent{\sf\color{darkred}\att\hazard #1}} % comments by Arnold Neumaier \newcommand{\at}[1]{\noindent{\color{darkgreen}[*** \att #1 ***]}} % comments by Christian Keil \newcommand{\CK}[1]{\noindent{\sf\color{darkred}\att\hazard #1}} % Christian Keil's Edits \newcommand{\add}[2][]{\marginpar{\textcolor{red}{!}}\textcolor{red}{#2\footnote{\emph{CK} #1}}} \newcommand{\change}[3][]{\marginpar{\textcolor{red}{!}}\textcolor{red}{(}#2\textcolor{red}{)$\rightarrow$#3\footnote{\emph{CK} #1}}} \newcommand{\del}[2][]{\marginpar{\textcolor{red}{!}}\textcolor{red}{(}#2\textcolor{red}{)$\rightarrow$\emph{delete}\footnote{\emph{CK} #1}}} % Dima Nadezhin's Edits \newcommand{\addDN}[2][]{\marginpar{\textcolor{red}{!}}\textcolor{red}{#2\footnote{\emph{DN} #1}}} \newcommand{\changeDN}[3][]{\marginpar{\textcolor{red}{!}}\textcolor{red}{(}#2\textcolor{red}{)$\rightarrow$#3\footnote{\emph{DN} #1}}} \newcommand{\delDN}[2][]{\marginpar{\textcolor{red}{!}}\textcolor{red}{(}#2\textcolor{red}{)$\rightarrow$\emph{delete}\footnote{\emph{DN} #1}}} %Environments \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{definition}[theorem]{Definition} \renewenvironment{proof}{\noindent{\bf Proof.}}{\qed} %Attempt at a simple math-oriented "listing" style %that LaTeX allows inside examples: \newenvironment{simplelisting}% {\def\arraystretch{1.0} \begin{array}{c@{\ =\ }l}}% {\end{array}} %Redefine "itemize" \renewenvironment{itemize}{\begin{list}{--}{\setlength{\leftmargin}{1em}}} {\end{list}} % Layout \newcommand{\bq}{\begin{quote}} \newcommand{\eq}{\end{quote}} \newcommand{\bc}{\begin{center}} \newcommand{\ec}{\end{center}} \newcommand{\note}[1]{\noindent[{\sf\em Note. #1}\noindent]} \newcommand{\notes}[1]{\noindent[{\sf\em Notes. #1}\noindent]} \newcommand{\example}[1]{\noindent[{\sf\em Example. #1}\noindent]} \newcommand{\examples}[1]{\noindent[{\sf\em Examples. #1}\noindent]} \newcommand{\ds}{\displaystyle} \newcommand{\mc}{\multicolumn} \newcommand{\TW}{\textwidth} %Conventions for names of operations in the standard \newcommand\name[1]{\textup{\tt#1}\xspace} %or try it in \tt \newcommand\namep[1]{\textit{#1}\/} %"placeholder" part, italic \newcommand\Fmt{\namep{formatOf}\xspace} \newcommand\Fmtname[1]{\Tname{\Fmt}{#1}} \newcommand\Tname[2]{#1\textrm{-}\name{#2}} %e.g. \Tname{\T}{division} %Particular function names that crop up \newcommand{\Ncase}{\name{case}} %Useful abbreviations \newcommand{\FTIA}{Fundamental Theorem of Interval Arithmetic\xspace} \newcommand{\FTDIA}{Fundamental Theorem of Decorated Interval Arithmetic\xspace} \newcommand{\fp}{floating-point\xspace} %\newcommand{\SD}{single-datatype\xspace} \newcommand{\arex}{arithmetic expression\xspace} \newcommand{\bndex}{bound expression\xspace} \newcommand{\freex}{free expression\xspace} \newcommand{\arexs}{arithmetic expressions\xspace} \newcommand{\arop}{arithmetic operation\xspace} \newcommand{\arops}{arithmetic operations\xspace} \newcommand{\Ifmt}{interval format\xspace} \newcommand{\Ifmts}{interval formats\xspace} \newcommand{\Nfmt}{number format\xspace} \newcommand{\Nfmts}{number formats\xspace} \newcommand{\Idt}{interval type\xspace} \newcommand{\Idts}{interval types\xspace} \newcommand{\bIdt}{bare interval type\xspace} \newcommand{\bIdts}{bare interval types\xspace} \newcommand{\dIdt}{decorated interval type\xspace} \newcommand{\dIdts}{decorated interval types\xspace} \def\hexsig{hexadecimal-significand\xspace} \def\Fdefd{flavor-defined\xspace} \def\Findep{flavor-independent\xspace} \def\Idefd{implementation-defined\xspace} \def\Ldefd{language-defined\xspace} \def\LIdefd{language- or implementation-defined\xspace} %Useful math symbols and layout. \renewcommand{\`}[1]{\text{\sf#1}} %\renewcommand{\`}[1]{#1} %try it without sanserif \newcommand{\comp}{\mathop{\circ}} \renewcommand{\d}{\textup{d}}% "differential" symbol \newcommand{\daw}{\downarrow} \newcommand{\disj}{\mathop{\cap\!\!\!/}} \newcommand{\dom}[1]{\mathop{\textup{Dom}}#1} \def\range(#1|#2){\textup{Rge}(#1\,|\,#2)} \def\drange(#1|#2){\textup{DRge}(#1\,|\,#2)} \def\dec(#1|#2){\textup{Dec}(#1\,|\,#2)} \newcommand{\Emp}{\mbox{\rm Empty}\xspace} \newcommand{\Ent}{\mbox{\rm Entire}\xspace} \newcommand{\emp}{\emptyset} \newcommand{\eps}{\epsilon} \newcommand{\floor}{\textup{floor}} \newcommand{\id}{\textup{Id}} % notation for identity map \newcommand{\op}{\bullet} \renewcommand{\phi}{\varphi} %normal phi is too like empty set \newcommand{\uaw}{\uparrow} \newcommand{\vars}{\mathop{\textup{vars}}}%set of indep vars in expression \newcommand{\x}{\times} %The exponent symbol e with a - or + in decimal floating point: \newcommand{\Em}{\textup{e--}} \newcommand{\Ep}{\textup{e+}} %For concisely presenting options within tables. Brace on left. \newcommand\stack[1]{\ensuremath{\left\{\begin{tabular}{@{}l}#1\end{tabular}\right.}} %As the previous but with 2 columns, "c" and "l", and intercol spacing \newcommand\stackcl[1]{\ensuremath{\left\{\begin{tabular}{cl}#1\end{tabular}\right.}} %Similar, but math mode inside, & no brace \newcommand\stackm[1]{\ensuremath{\begin{array}{@{}c}#1\end{array}}} % Abbreviation for bold (usually single character) in mathematics: \def\~#1{\text{\boldmath$#1$}} %and short pieces of \tt: \def\@#1@{\text{\tt#1}} % Notation for "set of x such that ...". % Second argument is in a mbox, as often it is an English phrase. \def\set#1#2{\{\,#1\mid\mbox{#2}\,\}} %"Explicit set" without "such that", like {some set}. \newcommand\eset[1]{\{\,\mbox{#1}\,\}} % Level 1 datatypes \newcommand{\B}{\mathbb{B}} %booleans \newcommand{\D}{\mathbb{D}} %decorations \newcommand{\I}{\mathbb{I}} %bare intervals \newcommand{\DI}{\mathbb{DI}} %decorated intervals \newcommand{\R}{\mathbb{R}} %reals \newcommand{\St}{\mathbb{S}} %string \newcommand{\Z}{\mathbb{Z}} %integers \newcommand{\xR}{\overline{\R}}%extended reals % For number systems (Level 1 & Level 2) \newcommand{\F}{\mathbb{F}} %a floating-point number type \newcommand{\G}{\mathbb{G}} %alternative floating-point number system \newcommand{\T}{\mathbb{T}} %a bare interval type \renewcommand{\L}{\mathbb{L}} %a set of literal floats \newcommand{\maxr}{{\tt maxreal}} \newcommand{\ninf}{{-\!\infty}} %Extra {} to keep the spacing fixed \newcommand{\pinf}{{+\!\infty}} \newcommand{\npinf}{\{\ninf,\pinf\}} \newcommand{\nzer}{{-\!0}} %Extra {} to keep the spacing fixed \newcommand{\pzer}{{+\!0}} \newcommand{\val}{\mathop{\textup{Val}}}%map of format to extended reals % Interval-related definitions \newcommand{\num}{\textup{num}} \newcommand{\hull}{\textup{hull}} \newcommand{\vset}{\textup{vset}} \def\mr(#1;#2){#1{\pm}#2}% a notation for midrad intervals % logical "and", "or" with rather more space round: \newcommand{\Land}{\,\land\,} \newcommand{\Lor}{\,\lor\,} % \mid with rather less space round: \newcommand{\mmid}{\,|\,} \newcommand{\nan}{\mbox{\rm NaN}\xspace} \newcommand{\nai}{\mbox{\rm NaI}\xspace} \newcommand{\ol}{\overline} \newcommand{\ul}{\underline} \newcommand{\ux}{\ul{x}} \newcommand{\ox}{\ol{x}} \newcommand{\uy}{\ul{y}} \newcommand{\oy}{\ol{y}} \newcommand{\uo}[1]{[\underline{#1},\overline{#1}]} \newcommand{\InfSup}[1]{\overline{\mathbb{I}#1}}%operator to make inf-sup type \newcommand{\InfSupb}{\,\mathbb{I}}%... exclude Empty, & infinite endpoints, from above \newcommand{\IF}{\InfSup\F} %typical inf-sup type \newcommand{\IFb}{\InfSupb\F} %closed bounded nonempty F-intervals \newcommand{\IR}{\InfSup\R} %all closed real intervals \newcommand{\IRb}{\InfSupb\R} %closed bounded nonempty real intervals %\newcommand{\IT}{{\color{red}\InfSup\mathbb{T}}} %typical text interval type %For accuracy modes \newcommand\tightest{{\sl tightest}\xspace} \newcommand\accurate{{\sl accurate}\xspace} \newcommand\valid{{\sl valid}\xspace} %Flavors notation \newcommand{\flavF}{\mathfrak{F}} %a generic flavor \newcommand{\flavf}{\mathfrak{f}} %a generic flavor \newcommand{\flavC}{\mathfrak{C}} %common opinsts of an operation \newcommand{\flavCO}{\mathfrak{CE}} %common opinsts of an operation \newcommand{\opinst}{evaluation instance\xspace} \newcommand{\opinsts}{evaluation instances\xspace} \newcommand\dAF{{\sc (af)}\xspace} % mark of an `all flavors' definition \newcommand\dS{{\sc (s)}\xspace} % mark of a `set based' definition % Overlap operation, see Recommended Ops \newcommand{\overlap}{\mathop{\raisebox{-.25ex}{\LARGE\ensuremath{\circ\!\!\circ}}}} %Used in decorations text \newcommand{\bare}{\textup{bare}} \newcommand{\bintvl}{bare interval\xspace} \newcommand{\bintvls}{bare intervals\xspace} \newcommand{\cintvl}{compressed interval\xspace} \newcommand{\cintvls}{compressed intervals\xspace} \newcommand{\bdec}{bare decoration\xspace} \newcommand{\DIR}{\overline{\mathbb{DIR}}} %decorated intervals \newcommand{\DT}{\D\T} %a decorated interval type \newcommand{\dbox}{decorated box\xspace} \newcommand{\dboxs}{decorated boxes\xspace} \newcommand{\dintvl}{decorated interval\xspace} \newcommand{\dintvls}{decorated intervals\xspace} \newcommand{\sname}{status\xspace}%name of decoration attribute \newcommand{\ssymb}{\delta\xspace}%symbol for decoration attribute \newcommand{\vtrit}[1]{\textup{\sl\ttfamily#1}\xspace} \newcommand{\decn}[1]{\textup{\tt #1}\xspace} \newcommand{\Dein}{\decn{\color{red}ein}}%only in outofdate FTDIA proof now \newcommand{\Dbnd}{\decn{\color{red}bnd}} \newcommand{\Dcom}{\decn{com}} \newcommand{\Ddac}{\decn{dac}} \newcommand{\Ddef}{\decn{def}} \newcommand{\Dtrv}{\decn{trv}} \newcommand{\Demp}{\decn{emp}} \newcommand{\Dill}{\decn{ill}} %Used in picture in exceptions text \newcounter{deca} %For listings.sty %\newcommand\li[1]{\lstinline[basicstyle=\tt]{#1}} \newcommand\li[1]{\lstinline[mathescape,basicstyle=\tt]!#1!} \lstset{ %language=matlab, basicstyle=\small\tt } %Referencing \newcommand{\apref}[1]{Annex~\ref{ap:#1}} \newcommand{\apsref}[1]{Annex~\ref{sc:#1}} \newcommand{\chref}[1]{Chapter~\ref{ch:#1}} \newcommand{\dfref}[1]{Defn~\ref{df:#1}} \newcommand{\fgref}[1]{Figure~\ref{fg:#1}} \newcommand{\itref}[1]{\ref{it:#1}} \newcommand{\scref}[1]{Clause~\ref{sc:#1}} \newcommand{\ssref}[1]{\S\ref{ss:#1}} \newcommand{\tbref}[1]{Table~\ref{tb:#1}} \newcommand{\thref}[1]{Theorem~\ref{th:#1}} \newcommand{\lmref}[1]{Lemma~\ref{lm:#1}} %The next bit is to define multiple refs in the syntax % \rf{mike,john,lois} referring to labels eq:mike, eq:john, eq:lois %and producing something like (21, 22, 25) \makeatletter \def\@endrf.{} %Definition refs \newcommand{\defrf}[1]{Defn \@defrfh#1,.} \def\@defrfh#1,{\ref{df:#1}\@ifnextchar . {\@endrf}{, \@defrfh}} %Equation refs \newcommand{\rf}[1]{(\@rfh#1,.)} \def\@rfh#1,{\ref{eq:#1}\@ifnextchar . {\@endrf}{, \@rfh}} %Clause & subclause refs \newcommand{\scrf}[1]{\@scrfh#1,.} \def\@scrfh#1,{\S\ref{sc:#1}\@ifnextchar . {\@endrf}{, \@scrfh}} \newcommand{\ssrf}[1]{\@ssrfh#1,.} \def\@ssrfh#1,{\S\ref{ss:#1}\@ifnextchar . {\@endrf}{, \@ssrfh}} \makeatother %-----To do with documentclass section & chapter numbering----- %-----Start of macro to stop a counter resetting another counter. \makeatletter \def\@takefromreset#1#2{% \def\@tempa{#1}% \let\@tempd\@elt \def\@elt##1{% \def\@tempb{##1}% \ifx\@tempa\@tempb\else \@addtoreset{##1}{#2}% \fi}% \expandafter\expandafter\let\expandafter\@tempc\csname cl@#2\endcsname \expandafter\def\csname cl@#2\endcsname{}% \@tempc \let\@elt\@tempd } %Use it to stop chapter resetting section number: \@takefromreset{section}{chapter} %But section should reset table & figure numbers, as per (*) below: \@addtoreset{table}{section} \@addtoreset{figure}{section} \makeatother %-----end of macro and its use %(*) Add section number to the label of Tables & Figures: \renewcommand{\thetable}{\arabic{section}.\arabic{table}} \renewcommand{\thefigure}{\arabic{section}.\arabic{figure}} %-----Page header and footer definitions----- \lhead{Chapter \thechapter} \chead{\small\sf P1788/D\docversion, \today\\Draft Standard For Interval Arithmetic} \rhead{\S\thesubsection} \lfoot{} \cfoot{\thepage} \rfoot{\today} \title{{\Huge\sf\bfseries P1788/D\docversion\\Draft Standard For Interval Arithmetic}} \author{\sf John Pryce and Christian Keil, Technical Editors} \date{\today} %%%%%%%%%%%%%%%%%%%%%%%%%% END PREAMBLE %%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \dominitoc \maxtocdepth{subsubsection} \pagestyle{plain} %-----Front Matter----- \frontmatter \maketitle \include{P17880_frontmatter} \tableofcontents %-----Main Matter----- \mainmatter \pagestyle{fancy} %-----Chapter: intro----- \include{P1788B_overview} \include{P1788B_conformance} \include{P1788C_defs} \include{P1788D_levels} %-----Chapter: set-based flavor----- \include{P1788E_level1} \include{P1788E_level1operns} \include{P1788E_level1excep} \include{P1788F_level2} \include{P1788F_level2IO} \include{P1788G_level3} %\include{P1788H_level4} %-----Chapter: Kaucher flavor: suppressed for now----- %\include{P1788Ka_Kaucher_stub} %-----ANNEXES----- %IEEE standards documents seem to use the term "Annex": \renewcommand{\appendixname}{Annex} %must come before \appendix \appendix %"A Chapter" is now "an Annex": make it reset the section number, %and refer to annex sections in the style A.1, A.2, ..., B.1, ... \makeatletter \@addtoreset{section}{chapter} \makeatother \renewcommand{\thesection}{\thechapter\arabic{section}} \renewcommand{\thetable}{\thechapter\arabic{section}.\arabic{table}} %-----Flavor-independent----- \include{P1788J1_AddNewFlavor} %\include{P1788J1_Reproducibility} %-----Set-based----- %\include{P1788J2_ImplHints} %\include{P1788J2_decn_details} \include{P1788J2_FTDIA} %\include{P1788J2_FTDIA_case} %\include{P1788J2_Extrastuff} %\include{P1788J2_level2extrabits} \include{P1788J2_Octets} %-----Kaucher, yet to come----- %-----Basic Standard----- \input{P1788_Basic} %-----Back Matter----- \backmatter \renewcommand{\bibpreamble}{\vspace{-\bigskipamount}\centering {\sc Informative}\\[1ex]} \bibliographystyle{siam} \bibliography{P1788NN} %\include{P1788K_Bibliography} \end{document}
% !TEX root = P1788_MAIN.tex \section{Level 3 description}\label{sc:level3} \subsection{Level 3 introduction}\label{ss:lvl3intro} Level 3 is where Level 2 datums are represented, and operations on them described. %, in terms of more primitive entities and operations. %How this is done is \Idefd. %Implementation may be by hardware, software, or a combination of the two. % Level 3 entities are here called {\em objects}. They represent Level 2 datums and may be referred to as {\em concrete}, while the datums are {\em abstract}. %An implementation shall behave as if the relation between Levels 2 and 3 is as follows. %\begin{itemize} % \item The set of boolean values, the set of integer values, the set of strings \ssrf{lvl1noninterval}, the set $\D$ of decorations \ssrf{lvl1excdefs}, and the set of the states returned by \name{overlap} function \ssrf{lvl1rcomcompar,lvl2rcomcompar} are regarded as being the same at Level 3 as at Levels 1 and 2. % % \item The \bintvl objects are organized into disjoint sets, {\em concrete \bintvl types}, that are in one-to-one correspondence with the abstract \bintvl types of Level 2. % As at Level 2, a \dintvl is an ordered pair (\bintvl, decoration), so this induces a one-to-one correspondence between the abstract and the concrete \dintvl types. % % \item The number objects are organized into disjoint sets, {\em concrete number formats}, that are in one-to-one correspondence with the abstract number formats of Level 2. %\end{itemize} % %Thus intervals of a particular type exist in four forms: bare or decorated, and in either case abstract datums at Level 2 or concrete objects at Level 3. Similarly, numbers of a particular format exist in two forms, abstract or concrete. % %In this document, the same name is normally used for an abstract type or format and its concrete counterpart. %This convention, and the term ``object'', are not intended to constrain the names that an implementation gives to types or formats, nor the data structures it uses. % %\example{The format \name{decimal64} might denote either the set of representations (in the sense of IEEE 754 \S3.2) of decimal64 numbers, or the set of numbers thus represented. Then for instance, all representations in the cohort (IEEE 754 \S3.5.1) of floating-point number $0.1$ are different objects, but represent the same datum.} \subsection{Representation}\label{ss:lvl3represent} Individual datums of an abstract type or format are {\em represented} by individual objects of its concrete type or format. % While the correspondence between abstract and concrete types or formats as a whole is one-to-one, that between datums and objects is not so. The property that defines a representation, for a given type or format, is: \begin{align}\label{eq:repn_def} \parbox{.8\TW}{Each datum shall be represented by at least one object. Each object shall represent at most one datum.} \end{align} %An object that represents a datum is called {\em valid}; one that does not is called {\em invalid}. % %That is, representation is a {\em partial function} that is {\em onto} but usually {\em not one-to-one}, from the set of objects to the set of datums of a given type or format. The set of valid objects is the domain of this function. \examples{Let $\F$ be a 754 format and let $\T$ the derived (bare) inf-sup type. Three possible representations are: \begin{itemize} \item {\bf inf-sup} form. Any $\T$-interval $\~x$ is represented at Level 3 by the object $(\name{inf}(x),\name{sup}(x))$ of two Level 2 numbers -- members of $\F$. All intervals have only one Level 3 representative because operations \name{inf} and \name{sup} are uniquely defined at Level 2 \ssrf{lvl2reqdnumintvlfns}: interval $[0,0]$ has representative $(\nzer,\pzer)$, interval \Emp has representative $(\pinf,\ninf)$. \item {\bf inf-sup-nan} form. The objects are defined to be pairs $(l,u)$ where $l,u$ are members of $\F$. A nonempty $\T$-interval $\~x = \uo{x}$ is represented by an object $(l,u)$ such that the values of $l$ and $u$ are $\ux$ and $\ox$, and \Emp is represented by $(\nan,\nan)$. Its valid objects are $(\nan,\nan)$, together with all $(l,u)$ such that $l,u$ are not \nan and $l\le u$, $l<\pinf$, $u>\ninf$. \item {\bf neginf-sup-nan} form. This is as the previous, except that for a nonempty $\T$-interval $\~x$ the value of $l$ is \ $-\ux$. %Its valid objects are $(\nan,\nan)$, together with all $(l,u)$ such that $l,u$ are not \nan and $0\le l+u$, $l>\ninf$, $u>\ninf$. \end{itemize} If, in these descriptions $l$, $u$ and \nan are viewed as Level 2 datums, then interval $[0,0]$ has four representatives in {\bf inf-sup-nan} and {\bf neginf-sup-nan} forms: $(\nzer,\pzer)$, $(\nzer,\nzer)$, $(\pzer,\pzer)$, $(\pzer,\nzer)$. Each nonempty interval with nonzero bounds has only one representative: there are unique $l$ and $u$. \Emp has also only one representative: there is a unique \nan. However, \nan itself has representatives, and from this viewpoint \Emp has more than one representative: there are many \nan{s}, quiet or signaling and with different payloads, to use in $\Emp=(\nan,\nan)$. %If, in these descriptions $l$, $u$ and \nan are viewed as Level 2 datums, then each interval has only one representative: for a nonempty $\T$-interval there are unique $l$ and $u$, and there is a unique \nan to use in the fields of \Emp. However, $l$, $u$ and \nan themselves have representations, and from this viewpoint some intervals have more than one representative: $[0,1]$ can be either $(-0,1)$ or $(+0,1)$, while there are many \nan{s}, quiet or signaling and with different payloads, to use in $\Emp=(\nan,\nan)$. %It is \Idefd whether an implementation regards quiet and signalling \nan{}s as distinct objects, see IEEE 754 \S3.2. %{\def\xh{\hat{x}} %\def\ud{\underline{\delta}} %\def\od{\overline{\delta}} % Multi-precision interval packages may represent an %interval $\~x = \uo{x}$ by a triple $(\xh, \ud, \od)$ where $\xh$ is %some point in $\~x$, and $\ud$ and $\od$ are very small numbers, and %$\~x = [\xh + \ud, \xh + \od]$ exactly; or in other ways.} } \subsection{Operations and representation}\label{ss:lvl3ops} Each Level 2 (abstract) library operation is implemented by a corresponding Level 3 (concrete) operation, whose behavior shall be consistent with the abstract operation. %That is, let $y=\phi(x_1,x_2,\ldots)$ be a Level 2 operation instance whose inputs and output are any mix of number, interval, decoration, string or boolean datums, and let objects $x_1',x_2',\ldots$ represent $x_1,x_2,\ldots$, respectively. Then $y'=\phi(x_1',x_2',\ldots)$ shall be defined and be a representative of $y$. % %Since for each Level 2 operation, the result is defined for arbitrary input datums, it follows that each Level 3 library operation has a unique result, up to representation, for arbitrary {\em valid} input objects. That is, if one chooses different representatives $x_i'$ for the $x_i$, the result $y'$ may be different but is still a representative of $y$. When an input Level 3 object does not represent a Level 2 datum, the result is \Idefd. An implementation shall provide means for the user to specify that an \name{InvalidOperand} exception be signaled when this occurs. \medskip To promote reproducibility (\ssrf{lang-considerations}, \ssrf{exprrelated}), an implementation should provide a computational mode where, provided certain programming restrictions are adhered to, the computed {\em values} depend only on the Level 2 values of inputs.\\ \note{Such an effect might be achieved by canonicalizing, i.e., ensuring that, at least for operations with numeric output, the {\em representative} of the output is independent of the representatives of the inputs---in the notation above, $y'$ is not changed by changing the $x_i'$. However, doing so incurs a cost, and there will be an \Idefd trade-off between the run time overhead of a ``reproducible mode'', and its scope, i.e., how few programming restrictions it imposes. As an example, let $\F$ be a 754 decimal format and $\T$ the derived inf-sup type. Suppose a $\T$-interval $[l,u]$ is represented at Level 3 as the pair of $\F$-numbers $(l,u)$. Let $f$ be the expression \[ f(x) = \name{sameQuantum}(\name{inf}(\~x),0.3) \] (see 754 \S5.7.3). Suppose a program reads $\~x$ using \name{textToInterval}, first from the string \@[0.3,inf]@, then from \@[0.30,inf]@. A straightforward implementation might store them with the two Level 3 representations $\~x'=(0.3,\pinf)$ and $\~x''=(0.30,\pinf)$, where $0.3$ and $0.30$ stand for the 754 decimal number objects $(0,-1,3)$ and $(0,-2,30)$ denoting the same real value $0.3=3\times 10^{-1}=30\times 10^{-2}$. Thus $\~x'=\~x''$ at both Level 1 and Level 2, and the user might expect they give the same output, but \begin{align*} f(\~x') %&=\name{sameQuantum}(\name{inf}(\~x'),0.3) &= \name{sameQuantum}(0.3,0.3) &&= \@true@;\\ f(\~x'') %&=\name{sameQuantum}(\name{inf}(\~x''),0.3) &= \name{sameQuantum}(0.30,0.3) &&= \@false@. \end{align*} The standard does not say which of these results is ``correct''. Rather than change the implementation, it might be better to document that such code must be avoided if reproducible behavior is required.} \subsection{Interchange representations and encodings}\label{ss:lvl3interchfmt} %\HI{We need a motion on this subclause, which was JDP's invention.} The purpose of interchange representations and encodings is to allow the loss-free exchange of Level 2 interval data between 754-conforming implementations. This is done by imposing a standard Level 3 representation using Level 2 number datums and delegating interchange encoding of number datums to the IEEE 754 standard. %This is done by imposing a standard Level 3 representation using Level 2 number datums and delegating choice of interchange format of number datums to the IEEE 754 standard. Let $\~x$ be a datum of the \bintvl inf-sup type $\T$ derived from a supported 754 format $\F$. Its standard Level 3 representative is an ordered pair $(\name{inf}(x),\name{sup}(x))$ of two Level 2 $\F$-numbers as defined in \ssrf{lvl2reqdnumintvlfns}. For example, the only representative of \Emp is the pair $(\pinf,\ninf)$ and the only representative of $[0,0]$ is the pair $(\nzer,\pzer)$. Let $\~x_{dx}$ be a datum of the \dIdt\ $\DT$ derived from $\T$. Its standard Level 3 representative is an ordered triple $(\name{inf}(\~x),\name{sup}(\~x),dx)$ of two Level 2 $\F$-datums and a decoration. For example, the only representative of $\Emp_{\Dtrv}$ is the triple $(\pinf,\ninf,\Dtrv)$ and the only representative of \nai is the triple $(\nan,\nan,\Dill)$. Interchange Level 4 encoding of an interval datum is a bit string that comprises the interchange encodings of fields of the ordered pair/triple above, in the order given. %Interchange representation of an interval datum comprises the interchange representations of fields of the ordered pair/triple above, in the order given. Interchange encoding of the $\F$-datum fields is a bit string encoding of one of the 754 interchange formats (754 \S 3.6). The first bit is the sign bit and the last bit is the least significant bit (LSB) of the significand. The choice of interchange format and the choice between densely packed decimal (DPD) or binary integer decimal (BID) significand encoding for decimal 754 interchange formats (754 \S 3.5) are parameters of interchange encoding. Interchange encoding of the decoration field is an 8-bit string according with the table \bc \begin{tabular}{c|c} Decoration & Encoding \\\hline \Dill & 00000000 \\ \Dtrv & 00000100 \\ \Ddef & 00001000 \\ \Ddac & 00001100 \\ \Dcom & 00010000 \\ \end{tabular} %\begin{tabular}{l|c|c|c|c|c} % Decoration & \Dill & \Dtrv & \Ddef & \Ddac & \Dcom \\\hline % Representation & 0 & 1 & 2 & 3 & 4 \\ %\end{tabular} \ec \note{This encoding permits future refinement without disturbing the natural propagation order of the decorations, and fits within the range of a C signed char, namely 0..127.} \example{ The interchange representation of inf-sup \@binary32@ decorated interval $[-1,3]_\Dcom$ is a triple (-0x1.000000p0, +0x1.800000p1, \Dcom). The interchange encodings of its fields are these bit strings (with underscores for readability): \begin{tabular}{l|l} -0x1.000000p0 & 10111111\_10000000\_00000000\_00000000 \\ +0x1.800000p1 & 01000000\_01000000\_00000000\_00000000 \\ \Dcom & 00010000 . \\ \end{tabular} The interchange encoding of the interval is a bit string of length 72: 10111111\_10000000\_00000000\_00000000\_01000000\_01000000\_00000000\_00000000\_00010000 . } %Interchange representations of fields are not completely specified by this standard. %Choices that are \Idefd, and that an implementation shall document, include: %\begin{itemize} %\item choice of wider 754 interchange format if $\F$ is not 754 interchange format (754 \S 3.6) itself. %\item choice of densely packed decimal (DPD) or binary integer decimal (BID) significand encoding for decimal 754 interchange formats. %\item choice of size in bytes of integer decoration representation (one byte is recommended). %\end{itemize} %Issues of endianness, which affect how interchange representations map to sequences of bytes at Level 4, are outside the scope of the standard. \note{The above rules imply that an interval has a unique interchange representation if it is not \nai and in a binary format, but not generally otherwise. The reason for the rules is that the sign of a zero bound cannot convey any information relevant to intervals; but an implementation may potentially use cohort information, or a \nan payload.} A 754-conforming implementation shall provide an interchange encoding for each supported 754 interval type. Interchange encodings for non-754 interval types, and on non-754 systems, are \Idefd. If an implementation provides other decoration attributes besides the standard ones, then how it maps them to an interchange encoding is \Idefd. The length of an interchange encoding bit string is a multiple of 8 because interchange media (files, network) is usually organized in bytes/octets. The mapping from bit strings to sequences of bytes/octets is not defined by this standard. See the appendix \apref{octets} for examples of this mapping.