File: halfprecision.tex

package info (click to toggle)
sollya 8.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 17,540 kB
  • sloc: ansic: 124,655; yacc: 7,543; lex: 2,440; makefile: 888; cpp: 77
file content (35 lines) | stat: -rw-r--r-- 1,960 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
\subsection{halfprecision}
\label{labhalfprecision}
\noindent Names: \textbf{halfprecision}, \textbf{HP}\\
\phantom{aaa}rounding to the nearest IEEE 754 half-precision number (binary16).\\[0.2cm]
\noindent Library names:\\
\verb|   sollya_obj_t sollya_lib_halfprecision(sollya_obj_t)|\\
\verb|   sollya_obj_t sollya_lib_halfprecision_obj()|\\
\verb|   int sollya_lib_is_halfprecision_obj(sollya_obj_t)|\\
\verb|   sollya_obj_t sollya_lib_build_function_halfprecision(sollya_obj_t)|\\
\verb|   #define SOLLYA_HP(x) sollya_lib_build_function_halfprecision(x)|\\[0.2cm]
\noindent Description: \begin{itemize}

\item \textbf{halfprecision} is both a function and a constant.

\item As a function, it rounds its argument to the nearest IEEE 754 half-precision (i.e. IEEE754-2008 binary16) number.
   Subnormal numbers are supported as well as standard numbers: it is the real
   rounding described in the standard.

\item As a constant, it symbolizes the half-precision format. It is used in 
   contexts when a precision format is necessary, e.g. in the commands 
   \textbf{round} and \textbf{roundcoefficients}. It is not supported for \textbf{implementpoly}.
   See the corresponding help pages for examples.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> display=binary!;
> HP(0.1);
1.100110011_2 * 2^(-4)
> HP(4.17);
1.00001011_2 * 2^(2)
> HP(1.011_2 * 2^(-23));
1.1_2 * 2^(-23)
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{single} (\ref{labsingle}), \textbf{double} (\ref{labdouble}), \textbf{doubleextended} (\ref{labdoubleextended}), \textbf{doubledouble} (\ref{labdoubledouble}), \textbf{quad} (\ref{labquad}), \textbf{tripledouble} (\ref{labtripledouble}), \textbf{roundcoefficients} (\ref{labroundcoefficients}), \textbf{fpminimax} (\ref{labfpminimax}), \textbf{implementpoly} (\ref{labimplementpoly}), \textbf{round} (\ref{labround}), \textbf{printsingle} (\ref{labprintsingle})