File: max.tex

package info (click to toggle)
sollya 8.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,592 kB
  • sloc: ansic: 124,655; yacc: 7,543; lex: 2,440; makefile: 888; cpp: 77
file content (71 lines) | stat: -rw-r--r-- 3,184 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
\subsection{max}
\label{labmax}
\noindent Name: \textbf{max}\\
\phantom{aaa}determines which of given constant expressions has maximum value\\[0.2cm]
\noindent Library names:\\
\verb|   sollya_obj_t sollya_lib_max(sollya_obj_t, ...)|\\
\verb|   sollya_obj_t sollya_lib_v_max(sollya_obj_t, va_list)|\\[0.2cm]
\noindent Usage: 
\begin{center}
\textbf{max}(\emph{expr1},\emph{expr2},...,\emph{exprn}) : (\textsf{constant}, \textsf{constant}, ..., \textsf{constant}) $\rightarrow$ \textsf{constant}\\
\textbf{max}(\emph{l}) : \textsf{list} $\rightarrow$ \textsf{constant}\\
\end{center}
Parameters: 
\begin{itemize}
\item \emph{expr} are constant expressions.
\item \emph{l} is a list of constant expressions.
\end{itemize}
\noindent Description: \begin{itemize}

\item \textbf{max} determines which of a given set of constant expressions
   \emph{expr} has maximum value. To do so, \textbf{max} tries to increase the
   precision used for evaluation until it can decide the ordering or some
   maximum precision is reached. In the latter case, a warning is printed
   indicating that there might actually be another expression that has a
   greater value.

\item Even though \textbf{max} determines the maximum expression by evaluation, it 
   returns the expression that is maximum as is, i.e. as an expression
   tree that might be evaluated to any accuracy afterwards.

\item \textbf{max} can be given either an arbitrary number of constant
   expressions in argument or a list of constant expressions. The list
   however must not be end-elliptic.

\item Users should be aware that the behavior of \textbf{max} follows the IEEE
   754-2008 standard with respect to NaNs. In particular, \textbf{max}
   evaluates to NaN if and only if all arguments of \textbf{max} are
   NaNs. This means that NaNs may disappear during computations.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> max(1,2,3,exp(5),log(0.25));
148.41315910257660342111558004055227962348766759388
> max(17);
17
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 2: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> l = [|1,2,3,exp(5),log(0.25)|];
> max(l);
148.41315910257660342111558004055227962348766759388
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 3: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> print(max(exp(17),sin(62)));
exp(17)
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 4: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> verbosity = 1!;
> print(max(17 + log2(13)/log2(9),17 + log(13)/log(9)));
Warning: the tool is unable to decide a maximum computation by evaluation even t
hough faithful evaluation of the terms has been possible. The terms will be cons
idered to be equal.
17 + log2(13) / log2(9)
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{min} (\ref{labmin}), \textbf{$==$} (\ref{labequal}), \textbf{!$=$} (\ref{labneq}), \textbf{$>=$} (\ref{labge}), \textbf{$>$} (\ref{labgt}), \textbf{$<$} (\ref{lablt}), \textbf{$<=$} (\ref{lable}), \textbf{in} (\ref{labin}), \textbf{inf} (\ref{labinf}), \textbf{sup} (\ref{labsup})