%--*- latex -*-----------------------------------------------------------------
%$Author: saulius $
%$Date: 2020-06-04 14:58:32 +0300 (Thu, 04 Jun 2020) $ 
%$Revision: 1524 $
%$URL: svn+ssh://saulius-grazulis.lt/home/saulius/svn-repositories/seminarai/2020-verifikacjos-seminarui/slides.tex $
%------------------------------------------------------------------------------

\documentclass[mathserif]{beamer}
\usetheme{Warwick}
\useoutertheme{infolines}
\setbeamertemplate{headline}{} % removes the headline the infolines inserts
%\setbeamertemplate{footline}[frame number]
\renewcommand\familydefault{\rmdefault}
% For XeLaTeX:
% https://tex.stackexchange.com/questions/452151/how-do-i-render-the-word-v%C7%ABlundarkvi%C3%B0a-with-bookman-and-xelatex
% "Use an OpenType clone of Bookman, for instance TeX Gyre Bonum":
\usepackage{fontspec}
\setmainfont{TeX Gyre Bonum}

\usepackage[style=authoryear,maxnames=1,doi=true,url=true,backend=biber]{biblatex}
%\addbibresource{bibliography/citations.bib}
%% \addbibresource{bibliography/Intel.bib}
%% \addbibresource{bibliography/Jorgensen.bib}
\addbibresource{bibliography/AMD.bib}
\addbibresource{bibliography/Zhmakin.bib}
\addbibresource{bibliography/Gustafson.bib}
\addbibresource{bibliography/Coleman.bib}
\addbibresource{bibliography/Engelen.bib}
\addbibresource{bibliography/Goldberg.bib}
\addbibresource{bibliography/IEEE.bib}
\addbibresource{bibliography/Cody.bib}
\newcommand{\mycite}{\parencite}


\usepackage{colordvi}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{snakes}
\usepackage{chemfig}
\usepackage{listings}
% https://tex.stackexchange.com/questions/212069/listings-cannot-load-requested-language
\lstset{defaultdialect=[x86masm]Assembler}

% https://en.wikibooks.org/wiki/LaTeX/Algorithms
% http://mirror.datacenter.by/pub/mirrors/CTAN/macros/latex/contrib/algorithmicx/algorithmicx.pdf
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{amssymb}

\include{commands}

\newcommand{\RCSid}[1]{\fontsize{7pt}{7pt}\selectfont $#1$ \today}

%%BEGIN LANGUAGE lt
\title{Slankaus kablelio skaičiai}
%%END LANGUAGE lt



\author{Saulius Gražulis}

\date{Vilnius, \the\year}

% Define colors as in
% https://venngage.com/blog/color-blind-friendly-palette/ ``Retro''
\definecolor{Bluish}{HTML}{63ACBE}
\definecolor{Magentish}{HTML}{601A4A}
\definecolor{Orangish}{HTML}{EE442F}

\begin{document}

\colorlet{IdentifierColor}{red!40!black}
\colorlet{StringColor}{green!70!black}
\colorlet{KwdColor}{Bluish}
\colorlet{CommentColor}{Orangish}

\colorlet{SignColor}{Bluish}
\colorlet{ExponentColor}{Magentish}
\colorlet{SignificandColor}{Orangish}

\colorlet{SC}{SignColor}
\colorlet{EC}{ExponentColor}
\colorlet{FC}{SignificandColor} % a.k.a. ``Fraction Color''

%------------------------------------------------------------------------------

\begin{frame}
    \titlepage

\input{affiliation_lt}
    
    \begin{center}
      \mbox{}
      \hfill\hfill\hfill
      \includegraphics[height=1.5cm]{images/sp_VU_zenklas.eps}
      \hfill
      \includegraphics[height=1.5cm]{images/2019-05-02_Melynas_MIF-zenklas242x244.png}
      \hfill\hfill\hfill
      \mbox{}
    \end{center}

    \vfill

    %% \tiny
    %% \RCSid{
    %%   $Id: slides.tex 1524 2020-06-04 11:58:32Z saulius $
    %% }
    \begin{flushright}
      \begin{minipage}[c]{0.67\textwidth}
        \tiny\raggedright
        %%BEGIN LANGUAGE lt
        Šį skaidrių rinkinį galima kopijuoti,
        kaip nurodyta Creative Commons
        %%END LANGUAGE lt
        \myhref{http://creativecommons.org/licenses/by-sa/4.0/}{Attribution-ShareAlike
          4.0 International}
licenzijoje
      \end{minipage}
      %%
      \begin{minipage}[c]{1.5cm}
        \myhref{http://creativecommons.org/licenses/by-sa/4.0/}{
          \includegraphics[width=1.5cm]{images/CC-BY-SA.eps}
        }
      \end{minipage}
    \end{flushright}

\end{frame}

%==============================================================================

\begin{frame}
\frametitle{Eksponentinis skaičių užrašymas}

  $$
  602\underbrace{00\dots0}_{21
\textrm{\ kartų}
  } = 6.02\times10^{23}
  $$

  $$
  \pm d_0 . d_1 d_2 \dots d_{p-1} \times \beta^e =  
  \sum_{i=0}^{p-1} d_i \beta^{-i} \times \beta^e, (0 \le d_i < \beta) 
  $$

  \begin{center}
    $
    \underbrace{602 \times 10^{21}}_{
nenormalizuotas
    } =
    \underbrace{6.02 \times 10^{23}}_{
normalizuotas
    } =
    \underbrace{0.602 \times 10^{24}}_{
nenormalizuotas
    }
    $
  \end{center}
  
\end{frame}

%------------------------------------------------------------------------------

%% \begin{frame}
%%   %%LANGUAGE en \frametitle{Fixed point numbers}
%%   %%LANGUAGE lt \frametitle{Fiksuoto kablelio skaičiai}
%%   %%LANGUAGE ru \frametitle{Числа с фиксированной запятой}
%% 
%% \end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Slankaus kablelio skaičiai}

  $$
  \textcolor{SC}{\pm} \textcolor{FC}{d_0 . d_1 d_2 \dots d_{p-1}} \times \beta^{\textcolor{EC}{e}} =  
  \textcolor{SC}{\pm} \sum_{i=0}^{p-1} \textcolor{FC}{d_i \beta^{-i}} \times \beta^{\textcolor{EC}{e}},
  (0 \le d_i < \beta) 
  $$

  $$
  \begin{array}{rl}
    \beta &= 2 \\
  \end{array}
  $$

  $$
  0.1_{10} \approx \textcolor{SC}{+} \textcolor{FC}{1.10011001100110011001101_2} \times 2^{\textcolor{EC}{-4}}
  $$
  
  \begin{itemize}
  \item
    \color{SC}
    %%BEGIN LANGUAGE lt
    (Trupmenos) ženklas
    %%END LANGUAGE lt
  \item
    \color{EC}
    %%BEGIN LANGUAGE lt
    Laipsnio rodiklis
    %%END LANGUAGE lt
  \item
    \color{FC}
    %%BEGIN LANGUAGE lt
    Trupmena (mantisė; angl. ``significand'')
    %%END LANGUAGE lt
  \end{itemize}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{IEEE 754 standartas}

  \begin{itemize}
  \item
    %%BEGIN LANGUAGE lt
    Dvejetainiai ($\beta = 2$, \mycite{IEEE1985a}) ir dešimtainiai ($\beta
    = 10$, \mycite{IEEE2008}) formatai
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Viengubo, dvigubo tikslumo \mycite{IEEE1985a}, pusinio, keturgubo
    pagrindinai bei aštuongubo tikslumo ir ilgesni mainų standartai
    \mycite{IEEE2008}
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Specialios reikšmės: neskaičiai (NaN), begalybės ($\pm\infty$),
    nuliai ($\pm0$)
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Denormalizuoti skaičiai
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Apvalinimo valdymas
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Maskuojamos išimtinės situacijos
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Nustato operacijų tikslumą
    %%END LANGUAGE lt
  \end{itemize}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{IEEE 754 standarto kodavimas}

  \begin{itemize}
  \item
    %%BEGIN LANGUAGE lt
    Mantisė: \textit{absoliutus dydis su ženklu}
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Eksponentė: \textit{skaičius su postūmiu} (postūmis $= 2^{n-1}-1$ $n$ bitų
    eksponentei)
    %%END LANGUAGE lt
  \item
Eksponentės diapazonas: $-(2^{n-1}-2) - +(2^{n-1}-1)$\newline{} (pvz. 8 bitų eksponentei: $-126 - +127$)
  \item
    %%BEGIN LANGUAGE lt
    Trupmena (mantisė): normalizuotiems skaičiams „paslėptas“ bitas
    %%END LANGUAGE lt
  \end{itemize}

  \vspace{-\baselineskip}
  $$
  0.1_{10} \approx \textcolor{gray}{1}.10011001100110011001101_2 \times 2^{-4}
  $$

Pavyzdys: $0.1$ viengubo tikslumo s.k.:
  
  \vspace{0.5\baselineskip}
  p: $23+1$
bitas
  e: $-126 - 127$ (8
bitai
  );
postūmis
  = $2^{8-1}-1 = 128 - 1 = 127$
  {
    \raggedright
    \tt
    $f =$ \textcolor{gray}{1.}\textcolor{FC}{10011001100110011001101} \\
    $e =$ \textcolor{EC}{127 + (-4) = $\tt 123_{10}$ = $\tt 01111011_2$}
  }

  \begin{center}
    \tt
    \textcolor{SC}{0} \textcolor{EC}{01111011} \textcolor{FC}{10011001100110011001101}
  \end{center}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Normalizuoti skaičiai}

  $$
  0.15625_{10} = \underbrace{0.00101_2}_{\text{
nenormalizuotas
  }} = \textcolor{SC}{\pm}
  \textcolor{gray}{1.}\textcolor{FC}{01} \times 2^{\textcolor{EC}{-3}} 
  $$

  $$
  e = 127 + (-3) = 124_{10} = \textcolor{EC}{01111100}_2
  $$

Atvaizdavimas:

  Float 32 (float; single precision):

  \begin{center}
    \texttt{
      \textcolor{SC}{0} \textcolor{EC}{01111100}
      $
      \tt
      \textcolor{FC}{01\underbrace{\tt 00\dots0}_{\text{
21 nulis
      }}}
      $
    }
  \end{center}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Denormalizuoti skaičiai}

  \begin{center}
    $$
    1.0_2 \times 2^{-130_{10}}
    $$
  \end{center}

Viengubo tikslumo slankiam kableliui,

  $$
  e_{\text{min}} = -126_{10} \Rightarrow \text{
Neįmanoma normalizuoti!
  }
  $$

Atkreipkite dėmesį, kad:

  $$
  e_{\text{min}} + \text{
postūmis
  } = 127_{10} + (-126_{10}) = 1 = \tt 0000\_0001_2
  $$
  
  \vspace{0.5\baselineskip}
  %%BEGIN LANGUAGE lt
  Pastumtai eksponentei \texttt{0000\_0000}, interpretacija pasikeičia:
  %%END LANGUAGE lt

  \vspace{-\baselineskip}
  $$
  \tt
  \textcolor{SC}{0}\ \textcolor{EC}{\tt 0000\,0000}\ %
  \textcolor{FC}{
    \tt
    0001\!\!\underbrace{\tt 00\dots0}_{\text{
19 nulių
    }}
  }
  =
  \textcolor{SC}{+} \textcolor{FC}{0.0001_2} \times
  2^{\textcolor{EC}{\mathbf{-126_{10}}}}
  = 
  \textcolor{SC}{+} \textcolor{FC}{0.0625_{10}} \times
  2^{\textcolor{EC}{\mathbf{-126_{10}}}}
  $$
  
  \vspace{0.5\baselineskip}
  %%BEGIN LANGUAGE lt
  eksponentė yra $-126$, \textbf{ne} $-127$ !
  %%END LANGUAGE lt
  \vspace{\baselineskip}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}[containsverbatim]
\frametitle{Kam reikalingi denormalizuoti skaičiai}

  %%BEGIN LANGUAGE lt
  Palaipsninis tikslumo praradimas
  %%END LANGUAGE lt

  \begin{center}
    \includegraphics[width=13cm,trim=1cm 2.5cm 1cm 9.5cm,clip]{images/floating-point/2008_Engelen_1_p6.pdf}
  \end{center}

  \vspace{-0.5\baselineskip}
  \rightline{\mycite{Engelen2008}}

  \begin{lstlisting}[language=C,frame=trBL,basicstyle=\ttfamily]
    if (a != b) { x = a/(a-b); }
  \end{lstlisting}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}[containsverbatim]
\frametitle{Nuliai}

  $$
  \tt
  \textcolor{SC}{0}\ \textcolor{EC}{\tt 0000\,0000}\ %
  \textcolor{FC}{
    \tt
    \underbrace{\tt 00\dots0}_{\text{
23 nuliai
    }}
  }
  = 0
  $$
  
  $$
  \tt
  \textcolor{SC}{1}\ \textcolor{EC}{\tt 0000\,0000}\ %
  \textcolor{FC}{
    \tt
    \underbrace{\tt 00\dots0}_{\text{
23 nuliai
    }}
  }
  = -0
  $$  

  $$
  \frac{1}{0} = \infty
  $$

  $$
  \frac{1}{-0} = -\infty
  $$

  \vspace{\baselineskip}
  \begin{lstlisting}[language=C,frame=trBL,basicstyle=\ttfamily]
    if (a > b) { x = log(a-b); }
  \end{lstlisting}
  \rightline{\mycite{Engelen2008}}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Begalybės}

  %%BEGIN LANGUAGE lt
  Liko nepanaudota eksponentė su visais vienetais, \texttt{1111\_1111}
  %%END LANGUAGE lt

  $$
  \tt
  \textcolor{SC}{0}\ \textcolor{EC}{\tt 1111\,1111}\ %
  \textcolor{FC}{
    \tt
    \underbrace{\tt 00\dots0}_{\text{
23 nuliai
    }}
  }
  = \infty
  $$
  
  $$
  \tt
  \textcolor{SC}{1}\ \textcolor{EC}{\tt 1111\,1111}\ %
  \textcolor{FC}{
    \tt
    \underbrace{\tt 00\dots0}_{\text{
23 nuliai
    }}
  }
  = -\infty
  $$  

  $$
  \frac{1}{0} = +\infty; \quad \frac{1}{+\infty} = +0
  $$

  $$
  \frac{1}{-0} = -\infty; \quad \frac{1}{-\infty} = -0
  $$

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Neskaičiai: NaN}

  $$
  \tt
  \textcolor{SC}{0}\ \textcolor{EC}{\tt 1111\,1111}\ %
  \textcolor{FC}{
    \tt
    \underbrace{\tt \textbf{1}1\dots0}_{\text{
ne visi 23 bitai yra nuliai
    }}
  }
  = \text{qNaN}
  $$
  
  $$
  \tt
  \textcolor{SC}{0}\ \textcolor{EC}{\tt 1111\,1111}\ %
  \textcolor{FC}{
    \tt
    \underbrace{\tt \textbf{0}1\dots0}_{\text{
ne visi 23 bitai yra nuliai
    }}
  }
  = \text{sNaN}
  $$

  \vspace{0.3\baselineskip}
Operacijos, kurios grąžina NaN:

  \begin{center}
    \small
    \begin{tabular}{ll}
      \hline
Operacija
      &
NaN grąžina
      \\
      \hline
      $+$ & $\infty + (-\infty)$ \\
      $\times$ & $0 \times \infty$ \\
      $/$ & $0/0$, $\infty/\infty$ \\
      rem & $0\;\text{rem}\;0$, $\infty\;\text{rem}\;\infty$ \\
      $\sqrt{\mbox{}}$ & $\sqrt{x}\quad \forall x < 0$ \\
      \hline
    \end{tabular}
  \end{center}
  \rightline{\mycite{Goldberg1991}}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{NaN palyginimas}

  \begin{center}
    \begin{itemize}
    \item
      %%BEGIN LANGUAGE lt
      Bet koks palyginimas su NaN grąžina \texttt{False}, todėl kai
      $x<\text{NaN}$ yra neteisingas, dar nereiškia kad $x>=\text{NaN}$
      %%END LANGUAGE lt
    \item
      \texttt{!(x < y)} $\not\Leftrightarrow$ \texttt{x >= y}
    \item
      \texttt{(x == y) == FALSE}
kai
      \texttt{x == NaN}
    \item
      %%BEGIN LANGUAGE lt
      Negalima surikiuoti realių skaičių masyvo su NaN
      %%END LANGUAGE lt
    \end{itemize}
  \end{center}
  \rightline{\mycite{Engelen2008}}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{NaN panaudojimas}

Viengubo tikslumo skaičiams, NaN reikšmės turi
  21
``laisvų'' bitų
  
Dvigubo tikslumo skaičiams, NaN reikšmės turi
  50
``laisvų'' bitų
  
  $$
  \raisebox{0.6pt}{
    \includegraphics[width=5cm,trim=0cm 0cm 7.67cm 0cm,clip]{images/floating-point/IEEE_754_Double_Float_Nan.eps}
  }
  \hspace{-5mm}
  \underbrace{
    \text{
      \includegraphics[width=5cm,trim=7.8cm 0cm 0cm 0cm,clip]{images/floating-point/IEEE_754_Double_Float_Nan.eps}
    }
  }_{\text{
      \parbox{0.4\linewidth}{
        \raggedright
mažiausiai 32 bitai laisvi! Užtenka 32 bitų adresui...
      }
  }}
  $$

  \begin{itemize}
  \item
    %%BEGIN LANGUAGE lt
    Dinaminės kalbos (pvz. JavaScript) naudoja ``boxed NaN'' reikšmes
    %%END LANGUAGE lt
  \item
sNaN naudingi neinicializuotoms reikšmėms pagauti
  \item
qNaN gali atvaizduoti nežinomas reikšmes
  \end{itemize}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Apibendrinimas: IEEE 754 specialios reikšmės}

  \begin{center}
    \begin{tabular}{lll}
      \hline
Eskponentė
      &
Trupmena
      &
Reiškia
      \\
      \hline
      $e = e_{\text{min}} - 1$ & $f = 0$ & $\pm 0$ \\
      $e = e_{\text{min}} - 1$ & $f \ne 0$ & $\pm 0.f \times 2^{e_{\text{min}}}$ \\
      $e_{\text{min}} \le e \le e_{\text{max}}$ & $f = \forall n$ & $\pm 1.f \times 2^{e}$ \\
      $e = e_{\text{max}} + 1 $ & $f = 0$ & $\pm\infty$ \\
      $e = e_{\text{max}} + 1 $ & $f \ne 0$, & NaN \\
      \hline
    \end{tabular}
  \end{center}
  \rightline{\mycite{Goldberg1991}}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Viengubo tikslumo skaičiai}

32-bitų skaičius
  
  \begin{center}
    \includegraphics[width=11cm]{images/floating-point/Float_example.eps}
  \end{center}
  
  \rightline{
    \scriptsize
    Vectorization:
    \myhref{https://commons.wikimedia.org/wiki/User:Stannered}{Stannered},
    \myhref{http://creativecommons.org/licenses/by-sa/3.0/}{CC BY-SA 3.0}
    via \myhref{https://commons.wikimedia.org/wiki/File:Float_example.svg}{Wikimedia Commons}
  }
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Dvigubo tikslumo skaičiai}

64-bitų skaičius
  
  \begin{center}
    \includegraphics[width=11cm]{images/floating-point/IEEE_754_Double_Floating_Point_Format.eps}
  \end{center}

  \rightline{
    \scriptsize
    \mywebref{https://en.wikipedia.org/wiki/File:IEEE\_754\_Double\_Floating\_Point\_Format.svg}
  }
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Intel 80 bitų išplėsto tikslumo skaičiai}

  \begin{center}
    \includegraphics[width=11cm]{images/floating-point/X86_Extended_Floating_Point_Format.eps}
  \end{center}
  
  \rightline{\tiny
    \myhref{https://commons.wikimedia.org/w/index.php?title=User:BillF4}{BillF4},
    \myhref{https://creativecommons.org/licenses/by-sa/3.0}{CC BY-SA
      3.0}, via \myhref{https://commons.wikimedia.org/wiki/File:X86_Extended_Floating_Point_Format.svg}{Wikimedia Commons}
  }

  \begin{itemize}
  \item
Nėra paslėpto bito
  \item
Pakankamas tikslumas suskaičiuoti $x^y$
  \item
Skirti tarpiniams rezultatams
  \end{itemize}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Intel x87 slankaus kablelio registrai}

  \begin{center}
    \includegraphics[page=320,height=7cm,trim=2cm 16cm 3cm 4.3cm,clip]{images/AMD-dokumentacija/AMD64_Architecture_Programmers_Manual_Vol_1.pdf}
  \end{center}

  \mycite{AMD2017}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Slankaus kablelio būsenos registrai}

  \begin{center}
    \includegraphics[page=322,height=7cm,trim=2cm 12.5cm 2cm 4.3cm,clip]{images/AMD-dokumentacija/AMD64_Architecture_Programmers_Manual_Vol_1.pdf}
  \end{center}

  \mycite{AMD2017}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Slankaus kablelio valdymo registrai}

  \begin{center}
    \includegraphics[page=325,height=6cm,trim=2cm 16cm 2cm 4.3cm,clip]{images/AMD-dokumentacija/AMD64_Architecture_Programmers_Manual_Vol_1.pdf}
  \end{center}

  \mycite{AMD2017}

\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Slankaus kablelio savybės}

  \small
  \begin{itemize}
  \item
Garantuotas atskirų operacijų tikslumas 

    \begin{quote}
      Except where stated otherwise, every operation shall be
      performed as if it first produced an intermediate result correct
      to infinite precision and with unbounded range, and then rounded
      that result according to one of the attributes in this clause.
    \end{quote}
    \rightline{\scriptsize\mycite{IEEE2019}, sect. 4.3}
  \item
Kiekvienas išreiškiamas skaičius atvaizduojamas vieninteliu būdu
  \item
FP skaičiai surikiuoti kaip sveiki skaičiai modulio su ženklu atvaizdavime!

    \begin{quote}
      All of the possible single-precision entities are well ordered
      in the natural lexicographic ordering of their machine
      representations interpreted as sign-magnitude binary integers
    \end{quote}
    \rightline{\scriptsize\mycite{Cody1981}}

  \end{itemize}
  
\end{frame}

%% %------------------------------------------------------------------------------
%% 
%% \begin{frame}
%%   %%LANGUAGE en \frametitle{Fused instructions}
%%   %%LANGUAGE lt \frametitle{Sulietos operacijos}
%%   %%LANGUAGE ru \frametitle{Составные операции}
%% 
%% \end{frame}

%------------------------------------------------------------------------------

\lstset{
  keywordstyle=\color{KwdColor},
  commentstyle=\color{CommentColor}\ttfamily,
  identifierstyle=\color{IdentifierColor},
  stringstyle=\color{StringColor},
  basicstyle=\ttfamily\tiny
}

\begin{frame}[containsverbatim]
\frametitle{Pavyzdys: 16-bitų SK kodas}

  \begin{center}
    \lstinputlisting[language=bash,basicstyle=\ttfamily\small]{examples/floating-point/compiled-examples/16-bit-single-precision/command.sh}
  \end{center}
  
  \hfill
  \begin{minipage}[c]{0.4\textwidth}
    \lstinputlisting[language=C,firstline=8,frame=trBL]{examples/floating-point/compiled-examples/16-bit-single-precision/single-precision.c}
  \end{minipage}
  \hspace{2em}
  \begin{minipage}[c]{0.4\textwidth}
    \lstinputlisting[language=assembler,linerange={7-17},frame=trBL,morekeywords={flds,faddp,fdivrp}]{examples/floating-point/compiled-examples/16-bit-single-precision/single-precision.asm}
  \end{minipage}
  \hfill
  \mbox{}
  
\end{frame}

%------------------------------------------------------------------------------

\lstset{
  keywordstyle=\color{KwdColor},
  commentstyle=\color{CommentColor}\ttfamily,
  identifierstyle=\color{IdentifierColor},
  stringstyle=\color{StringColor},
  basicstyle=\ttfamily\tiny
}

\begin{frame}[containsverbatim]
\frametitle{Pavyzdys: 64-bitų SK kodas}

  \begin{center}
    \lstinputlisting[language=bash,basicstyle=\ttfamily\small]{examples/floating-point/compiled-examples/64-bit-single-precision/command.sh}
  \end{center}

  \hfill
  \begin{minipage}[c]{0.4\textwidth}
    \lstinputlisting[language=C,firstline=8,frame=trBL]{examples/floating-point/compiled-examples/64-bit-single-precision/single-precision.c}
  \end{minipage}
  \hspace{2em}
  \begin{minipage}[c]{0.4\textwidth}
    \lstinputlisting[language=assembler,linerange={6-14},frame=trBL,morekeywords={movaps,addss,mulss,divss}]{examples/floating-point/compiled-examples/64-bit-single-precision/single-precision.asm}
  \end{minipage}
  \hfill
  \mbox{}
  
\end{frame}

%------------------------------------------------------------------------------

%% \begin{frame}
%%   %%LANGUAGE en \frametitle{Floating point comparisons}
%%   %%LANGUAGE lt \frametitle{Slankaus kablelio palyginimai}
%%   %%LANGUAGE ru \frametitle{Сравнения чисел с п.з.}
%% 
%% \end{frame}

%------------------------------------------------------------------------------

%% \begin{frame}
%%   %%LANGUAGE en \frametitle{Example: Kahan summation}
%%   %%LANGUAGE lt \frametitle{Pavyzdys: Kahano sumavimo algoritmas}
%%   %%LANGUAGE ru \frametitle{Пример: суммирование Кэхэна}
%% 
%% 
%%   {
%%     \scriptsize
%%     %%BEGIN LANGUAGE en
%%     \rightline{\mywebref{https://en.wikipedia.org/wiki/Kahan\_summation\_algorithm}}
%%     %%END LANGUAGE en
%%     %%BEGIN LANGUAGE lt
%%     \rightline{\mywebref{https://lt.wikipedia.org/wiki/Kahano\_sudėties\_algoritmas}}
%%     %%END LANGUAGE lt
%%     %%BEGIN LANGUAGE ru
%%     \rightline{\mywebref{https://ru.wikipedia.org/wiki/Алгоритм\_Кэхэна}}
%%     %%END LANGUAGE ru
%%   }
%% \end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Alternatyvos}

  \begin{itemize}
  \item

    %%BEGIN LANGUAGE lt
    Racionalių skaičių aritmetika
    %%END LANGUAGE lt

  \item

    %%BEGIN LANGUAGE lt
    Kintamo ilgio slankaus kablelio aritmetika
    %%END LANGUAGE lt

  \item
    %%BEGIN LANGUAGE lt
    J. Gustafsono Unum skaičių sistema
    %%END LANGUAGE lt
    \mycite{Gustafson2015}
  \item
    %%BEGIN LANGUAGE lt
    Logaritminės skaičių sistemos
    %%END LANGUAGE lt
    \mycite{Coleman2008,Ismail2011}
  \end{itemize}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}
\frametitle{Apibendrinimas}

  \begin{itemize}
  \item
    %%BEGIN LANGUAGE lt
    Slankaus kablelio skaičiai yra realių skaičių artiniai
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Įprastose situacijose naudojami normalizuoti skaičiai
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Naudojami specialūs kodai denormalizuotiems skaičiams, begalybei, NaN
    $\pm 0$
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Kiekvienas IEEE 754 slankaus kablelio (s.k.) objektas turi unikalų
    atvaizdavimą, ir kiekvienas dvejetainis kodas vaizduoja s.k. objektą
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Kai kurie s.k. objektai (pvz. NaN) turi savybes, kurios skiriasi
    nuo įprastų realių skaičių savybių
    %%END LANGUAGE lt
  \item
    %%BEGIN LANGUAGE lt
    Aktyviai tyrinėjamos naujos s.k. skaičių alternatyvos
    %%END LANGUAGE lt
  \end{itemize}
  
\end{frame}

%------------------------------------------------------------------------------

\begin{frame}%%[allowframebreaks]
\frametitle{Šaltiniai}

  \setmainfont{Liberation Serif}
  \renewcommand{\bibfont}{\scriptsize}
  \printbibliography

\end{frame}

%------------------------------------------------------------------------------                                                                                                          
\end{document}
% 2021-11-29 10:13:37 EET
