Changes in / [a8e64c4:0a208b8]


Ignore:
Files:
4 added
16 edited

Legend:

Unmodified
Added
Removed
  • Jenkins/FullBuild

    ra8e64c4 r0a208b8  
    161161"""
    162162
    163         def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com, ajbeach@edu.uwaterloo.ca"
     163        def email_to = "cforall@lists.uwaterloo.ca"
    164164
    165165        //send email notification
  • Jenkinsfile

    ra8e64c4 r0a208b8  
    374374"""
    375375
    376         def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com, ajbeach@edu.uwaterloo.ca"
     376        def email_to = "cforall@lists.uwaterloo.ca"
    377377
    378378        //send email notification
  • doc/bibliography/cfa.bib

    ra8e64c4 r0a208b8  
    30353035    year        = 1992,
    30363036    pages       = {T1-53},
     3037}
     3038
     3039@manual{GMP,
     3040    keywords    = {GMP arbitrary-precision library},
     3041    contributer = {pabuhr@plg},
     3042    title       = {{GNU} Multiple Precision Arithmetic Library},
     3043    author      = {GMP},
     3044    organization= {GNU},
     3045    year        = 2016,
     3046    note        = {\href{https://gmplib.org}{https://\-gmplib.org}},
    30373047}
    30383048
  • doc/user/user.tex

    ra8e64c4 r0a208b8  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Sun May 21 23:36:42 2017
    14 %% Update Count     : 1822
     13%% Last Modified On : Wed May 24 22:21:42 2017
     14%% Update Count     : 1994
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    151151
    152152Like \Index*[C++]{\CC}, there may be both an old and new ways to achieve the same effect.
    153 For example, the following programs compare the \CFA and C I/O mechanisms.
     153For example, the following programs compare the \CFA, C, nad \CC I/O mechanisms, where the programs output the same result.
    154154\begin{quote2}
    155155\begin{tabular}{@{}l@{\hspace{1.5em}}l@{\hspace{1.5em}}l@{}}
     
    183183\end{tabular}
    184184\end{quote2}
    185 The programs output the same result.
    186185While the \CFA I/O looks similar to the \Index*[C++]{\CC} output style, there are important differences, such as automatic spacing between variables as in \Index*{Python} (see~\VRef{s:IOLibrary}).
    187186
     
    14261425
    14271426
    1428 \section{Type/Routine Nesting}
     1427\section{Unnamed Structure Fields}
     1428
     1429C requires each field of a structure to have a name, except for a bit field associated with a basic type, \eg:
     1430\begin{cfa}
     1431struct {
     1432        int f1;                                 §\C{// named field}§
     1433        int f2 : 4;                             §\C{// named field with bit field size}§
     1434        int : 3;                                §\C{// unnamed field for basic type with bit field size}§
     1435        int ;                                   §\C{// disallowed, unnamed field}§
     1436        int *;                                  §\C{// disallowed, unnamed field}§
     1437        int (*)(int);                   §\C{// disallowed, unnamed field}§
     1438};
     1439\end{cfa}
     1440This requirement is relaxed by making the field name optional for all field declarations; therefore, all the field declarations in the example are allowed.
     1441As for unnamed bit fields, an unnamed field is used for padding a structure to a particular size.
     1442A list of unnamed fields is also supported, \eg:
     1443\begin{cfa}
     1444struct {
     1445        int , , ;                               §\C{// 3 unnamed fields}§
     1446}
     1447\end{cfa}
     1448
     1449
     1450\section{Nesting}
    14291451
    14301452Nesting of types and routines is useful for controlling name visibility (\newterm{name hiding}).
     
    17961818
    17971819
    1798 \section{Unnamed Structure Fields}
    1799 
    1800 C requires each field of a structure to have a name, except for a bit field associated with a basic type, \eg:
    1801 \begin{cfa}
    1802 struct {
    1803         int f1;                                 §\C{// named field}§
    1804         int f2 : 4;                             §\C{// named field with bit field size}§
    1805         int : 3;                                §\C{// unnamed field for basic type with bit field size}§
    1806         int ;                                   §\C{// disallowed, unnamed field}§
    1807         int *;                                  §\C{// disallowed, unnamed field}§
    1808         int (*)(int);                   §\C{// disallowed, unnamed field}§
    1809 };
    1810 \end{cfa}
    1811 This requirement is relaxed by making the field name optional for all field declarations; therefore, all the field declarations in the example are allowed.
    1812 As for unnamed bit fields, an unnamed field is used for padding a structure to a particular size.
    1813 A list of unnamed fields is also supported, \eg:
    1814 \begin{cfa}
    1815 struct {
    1816         int , , ;                               §\C{// 3 unnamed fields}§
    1817 }
    1818 \end{cfa}
    1819 
    1820 
    18211820\section{Field Tuples}
    18221821
     
    18611860
    18621861While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure.
    1863 Unfortunately, this restriction forces programmers to use ©goto© to achieve the equivalent control-flow for more than one level of nesting.
    1864 To prevent having to switch to the ©goto©, \CFA extends the ©continue©\index{continue@©continue©}\index{continue@©continue©!labelled}\index{labelled!continue@©continue©} and ©break©\index{break@©break©}\index{break@©break©!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85,Java}.
     1862Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting.
     1863To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@©continue©!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@©break©!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85,Java}.
    18651864For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement;
    18661865for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement.
    1867 
    1868 The following example shows the labelled ©continue© specifying which control structure is the target for the next loop iteration:
    1869 \begin{quote2}
    1870 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1871 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1872 \begin{cfa}
    1873 ®L1:® do {
    1874         ®L2:® while ( ... ) {
    1875                 ®L3:® for ( ... ) {
    1876                         ... continue ®L1®; ...  // continue do
    1877                         ... continue ®L2®; ...  // continue while
    1878                         ... continue ®L3®; ...  // continue for
    1879                 } // for
    1880         } // while
    1881 } while ( ... );
    1882 \end{cfa}
    1883 &
    1884 \begin{cfa}
    1885 do {
    1886         while ( ... ) {
    1887                 for ( ... ) {
    1888                         ... goto L1; ...
    1889                         ... goto L2; ...
    1890                         ... goto L3; ...
    1891                 L3: ; }
    1892         L2: ; }
    1893 L1: ; } while ( ... );
    1894 \end{cfa}
    1895 \end{tabular}
    1896 \end{quote2}
    1897 The innermost loop has three restart points, which cause the next loop iteration to begin.
    1898 
    1899 The following example shows the labelled ©break© specifying which control structure is the target for exit:
    1900 \begin{quote2}
    1901 \begin{tabular}{@{}l@{\hspace{3em}}l@{}}
    1902 \multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{C}}        \\
    1903 \begin{cfa}
    1904 ®L1:® {
     1866\VRef[Figure]{f:MultiLevelResumeTermination} shows the labelled ©continue© and ©break©, specifying which control structure is the target for exit, and the corresponding C program using only ©goto©.
     1867The innermost loop has 7 exit points, which cause resumption or termination of one or more of the 7 \Index{nested control-structure}s.
     1868
     1869\begin{figure}
     1870\begin{tabular}{@{\hspace{\parindentlnth}}l@{\hspace{1.5em}}l@{}}
     1871\multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{\CFA}}      & \multicolumn{1}{c}{\textbf{C}}        \\
     1872\begin{cfa}
     1873®LC:® {
    19051874        ... §declarations§ ...
    1906         ®L2:® switch ( ... ) {
     1875        ®LS:® switch ( ... ) {
    19071876          case 3:
    1908             ®L3:® if ( ... ) {
    1909                         ®L4:® for ( ... ) {
    1910                                 ... break ®L1®; ...     // exit compound statement
    1911                                 ... break ®L2®; ...     // exit switch
    1912                                 ... break ®L3®; ...     // exit if
    1913                                 ... break ®L4®; ...     // exit loop
     1877                ®LIF:® if ( ... ) {
     1878                        ®LF:® for ( ... ) {
     1879                                ®LW:® while ( ... ) {
     1880                                        ... break ®LC®; ...                     // terminate compound
     1881                                        ... break ®LS®; ...                     // terminate switch
     1882                                        ... break ®LIF®; ...                    // terminate if
     1883                                        ... continue ®LF;® ...   // resume loop
     1884                                        ... break ®LF®; ...                     // terminate loop
     1885                                        ... continue ®LW®; ...   // resume loop
     1886                                        ... break ®LW®; ...               // terminate loop
     1887                                } // while
    19141888                        } // for
    19151889                } else {
    1916                         ... break ®L3®; ...             // exit if
     1890                        ... break ®LIF®; ...                                     // terminate if
    19171891                } // if
    19181892        } // switch
     
    19251899        switch ( ... ) {
    19261900          case 3:
    1927             if ( ... ) {
     1901                if ( ... ) {
    19281902                        for ( ... ) {
    1929                                 ... goto L1; ...
    1930                                 ... goto L2; ...
    1931                                 ... goto L3; ...
    1932                                 ... goto L4; ...
    1933                         } L4: ;
     1903                                for ( ... ) {
     1904                                        ... goto ®LC®; ...
     1905                                        ... goto ®LS®; ...
     1906                                        ... goto ®LIF®; ...
     1907                                        ... goto ®LFC®; ...
     1908                                        ... goto ®LFB®; ...
     1909                                        ... goto ®LWC®; ...
     1910                                        ... goto ®LWB®; ...
     1911                                  ®LWC®: ; } ®LWB:® ;
     1912                          ®LFC:® ; } ®LFB:® ;
    19341913                } else {
    1935                         ... goto L3; ...
    1936                 } L3: ;
    1937         } L2: ;
    1938 } L1: ;
     1914                        ... goto ®LIF®; ...
     1915                } ®L3:® ;
     1916        } ®LS:® ;
     1917} ®LC:® ;
    19391918\end{cfa}
    19401919\end{tabular}
    1941 \end{quote2}
    1942 The innermost loop has four exit points, which cause termination of one or more of the four \Index{nested control structure}s.
    1943 
    1944 Both ©continue© and ©break© with target labels are simply a ©goto©\index{goto@©goto©!restricted} restricted in the following ways:
     1920\caption{Multi-level Resume/Termination}
     1921\label{f:MultiLevelResumeTermination}
     1922\end{figure}
     1923
     1924Both labelled ©continue© and ©break© are a ©goto©\index{goto@©goto©!restricted} restricted in the following ways:
    19451925\begin{itemize}
    19461926\item
    1947 They cannot be used to create a loop.
    1948 This means that only the looping construct can be used to create a loop.
    1949 This restriction is important since all situations that can result in repeated execution of statements in a program are clearly delineated.
    1950 \item
    1951 Since they always transfer out of containing control structures, they cannot be used to branch into a control structure.
     1927They cannot create a loop, which means only the looping constructs cause looping.
     1928This restriction means all situations resulting in repeated execution are clearly delineated.
     1929\item
     1930They cannot branch into a control structure.
     1931This restriction prevents missing initialization at the start of a control structure resulting in undefined behaviour.
    19521932\end{itemize}
    1953 The advantage of the labelled ©continue©/©break© is allowing static multi-level exits without having to use the ©goto© statement and tying control flow to the target control structure rather than an arbitrary point in a program.
     1933The advantage of the labelled ©continue©/©break© is allowing static multi-level exits without having to use the ©goto© statement, and tying control flow to the target control structure rather than an arbitrary point in a program.
    19541934Furthermore, the location of the label at the \emph{beginning} of the target control structure informs the reader that complex control-flow is occurring in the body of the control structure.
    19551935With ©goto©, the label is at the end of the control structure, which fails to convey this important clue early enough to the reader.
     
    22682248\index{input/output library}
    22692249
    2270 The goal for the \CFA I/O is to make I/O as simple as possible in the common cases, while fully supporting polymorphism and user defined types in a consistent way.
     2250The goal of \CFA I/O is to simplify the common cases\index{I/O!common case}, while fully supporting polymorphism and user defined types in a consistent way.
    22712251The common case is printing out a sequence of variables separated by whitespace.
    22722252\begin{quote2}
     
    22742254\multicolumn{1}{c@{\hspace{3em}}}{\textbf{\CFA}}        & \multicolumn{1}{c}{\textbf{\CC}}      \\
    22752255\begin{cfa}
    2276 int x = 0, y = 1, z = 2;
     2256int x = 1, y = 2, z = 3;
    22772257sout | x ®|® y ®|® z | endl;
    22782258\end{cfa}
     
    22812261
    22822262cout << x ®<< " "® << y ®<< " "® << z << endl;
     2263\end{cfa}
     2264\\
     2265\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     22661 2 3
     2267\end{cfa}
     2268&
     2269\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     22701 2 3
    22832271\end{cfa}
    22842272\end{tabular}
    22852273\end{quote2}
    22862274The \CFA form has half as many characters as the \CC form, and is similar to \Index*{Python} I/O with respect to implicit separators.
    2287 
    2288 The logical-or operator is used because it is the lowest-priority overloadable operator, other than assignment.
     2275A tuple prints all the tuple's values, each separated by ©", "©.
     2276\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2277[int, int] t1 = [1, 2], t2 = [3, 4];
     2278sout | t1 | t2 | endl;                                  §\C{// print tuples}§
     2279\end{cfa}
     2280\begin{cfa}[mathescape=off,showspaces=true,belowskip=0pt]
     22811, 2, 3, 4
     2282\end{cfa}
     2283\CFA uses the logical-or operator for I/O because it is the lowest-priority overloadable operator, other than assignment.
    22892284Therefore, fewer output expressions require parenthesis.
    22902285\begin{quote2}
     
    22992294&
    23002295\begin{cfa}
    2301 cout << x * 3 << y + 1 << (z << 2) << (x == y) << (x | y) << (x || y) << (x > z ? 1 : 2) << endl;
     2296cout << x * 3 << y + 1 << ®(®z << 2®)® << ®(®x == y®)® << (x | y) << (x || y) << (x > z ? 1 : 2) << endl;
     2297\end{cfa}
     2298\\
     2299&
     2300\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
     23013 3 12 0 3 1 2
    23022302\end{cfa}
    23032303\end{tabular}
     
    23052305Finally, the logical-or operator has a link with the Shell pipe-operator for moving data, where data flows in the correct direction for input but the opposite direction for output.
    23062306
     2307
    23072308The implicit separator\index{I/O separator} character (space/blank) is a separator not a terminator.
    23082309The rules for implicitly adding the separator are:
     
    231623171 2 3
    23172318\end{cfa}
     2319
    23182320\item
    23192321A separator does not appear before or after a character literal or variable.
     
    23222324123
    23232325\end{cfa}
    2324 \item
    2325 A separator does not appear before or after a null (empty) C string
     2326
     2327\item
     2328A separator does not appear before or after a null (empty) C string.
    23262329\begin{cfa}
    23272330sout | 1 | "" | 2 | "" | 3 | endl;
     
    23292332\end{cfa}
    23302333which is a local mechanism to disable insertion of the separator character.
    2331 \item
    2332 A separator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off]@([{=$£¥¡¿«@
     2334
     2335\item
     2336A separator does not appear before a C string starting with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[mathescape=off,basicstyle=\tt]@([{=$£¥¡¿«@
    23332337%$
    23342338\begin{cfa}[mathescape=off]
     
    23372341\end{cfa}
    23382342%$
    2339 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    2340 x (1 x [2 x {3 x =4 x $5 x £6 x ¥7 x ¡8 x ¿9 x «10
     2343\begin{cfa}[mathescape=off,basicstyle=\tt,showspaces=true,aboveskip=0pt,belowskip=0pt]
     2344x ®(®1 x ®[®2 x ®{®3 x ®=®4 x ®$®5 x ®£®6 x ®¥®7 x ®¡®8 x ®¿®9 x ®«®10
    23412345\end{cfa}
    23422346%$
     2347where \lstinline[basicstyle=\tt]@¡¿@ are inverted opening exclamation and question marks, and \lstinline[basicstyle=\tt]@«@ is an opening citation mark.
     2348
    23432349\item
    23442350{\lstset{language=CFA,deletedelim=**[is][]{¢}{¢}}
    2345 A seperator does not appear after a C string ending with the (extended) \Index{ASCII}\index{ASCII!extended} characters: ©,.;!?)]}%¢»©
     2351A seperator does not appear after a C string ending with the (extended) \Index{ASCII}\index{ASCII!extended} characters: \lstinline[basicstyle=\tt]@,.;!?)]}%¢»@
    23462352\begin{cfa}[belowskip=0pt]
    23472353sout | 1 | ", x" | 2 | ". x" | 3 | "; x" | 4 | "! x" | 5 | "? x" | 6 | "% x"
    23482354                | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" | endl;
    23492355\end{cfa}
    2350 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    2351 1, x 2. x 3; x 4! x 5? x 6% x 7§\textcent§ x 8» x 9) x 10] x 11} x
     2356\begin{cfa}[basicstyle=\tt,showspaces=true,aboveskip=0pt,belowskip=0pt]
     23571®,® x 2®.® x 3®;® x 4®!® x 5®?® x 6®%® x 7§\color{red}\textcent§ x 8®»® x 9®)® x 10®]® x 11®}® x
    23522358\end{cfa}}%
    2353 \item
    2354 A seperator does not appear before or after a C string begining/ending with the \Index{ASCII} quote or whitespace characters: \lstinline[showspaces=true]@`'": \t\v\f\r\n@
     2359where \lstinline[basicstyle=\tt]@»@ is a closing citation mark.
     2360
     2361\item
     2362A seperator does not appear before or after a C string begining/ending with the \Index{ASCII} quote or whitespace characters: \lstinline[basicstyle=\tt,showspaces=true]@`'": \t\v\f\r\n@
    23552363\begin{cfa}[belowskip=0pt]
    23562364sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl;
    23572365\end{cfa}
    2358 \begin{cfa}[mathescape=off,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt]
    2359 x`1`x'2'x"3"x:4:x 5 x   6       x
     2366\begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt]
     2367x®`®1®`®x§\color{red}\texttt{'}§2§\color{red}\texttt{'}§x§\color{red}\texttt{"}§3§\color{red}\texttt{"}§x®:®4®:®x® ®5® ®x®      ®6®     ®x
     2368\end{cfa}
     2369
     2370\item
     2371If a space is desired before or after one of the special string start/end characters, simply insert a space.
     2372\begin{cfa}[belowskip=0pt]
     2373sout | "x (§\color{red}\texttt{\textvisiblespace}§" | 1 | "§\color{red}\texttt{\textvisiblespace}§) x" | 2 | "§\color{red}\texttt{\textvisiblespace}§, x" | 3 | "§\color{red}\texttt{\textvisiblespace}§:x:§\color{red}\texttt{\textvisiblespace}§" | 4 | endl;
     2374\end{cfa}
     2375\begin{cfa}[basicstyle=\tt,showspaces=true,showtabs=true,aboveskip=0pt,belowskip=0pt]
     2376x (® ®1® ®) x 2® ®, x 3® ®:x:® ®4
    23602377\end{cfa}
    23612378\end{enumerate}
    23622379
    2363 The following \CC-style \Index{manipulator}s allow control over implicit seperation.
     2380The following routines and \CC-style \Index{manipulator}s control implicit seperation.
     2381\begin{enumerate}
     2382\item
     2383Routines \Indexc{sepSet}\index{manipulator!sepSet@©sepSet©} and \Indexc{sepGet}\index{manipulator!sepGet@©sepGet©} set and get the separator string.
     2384The separator string can be at most 16 characters including the ©'\0'© string terminator (15 printable characters).
     2385\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2386sepSet( sout, ", $" );                                          §\C{// set separator from " " to ", \$"}§
     2387sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl;
     2388\end{cfa}
     2389%$
     2390\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     23911, $2, $3 ®", $"®
     2392\end{cfa}
     2393%$
     2394\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2395sepSet( sout, " " );                                            §\C{// reset separator to " "}§
     2396sout | 1 | 2 | 3 | " \"" | ®sepGet( sout )® | "\"" | endl;
     2397\end{cfa}
     2398\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     23991 2 3 ®" "®
     2400\end{cfa}
     2401
     2402\item
    23642403Manipulators \Indexc{sepOn}\index{manipulator!sepOn@©sepOn©} and \Indexc{sepOff}\index{manipulator!sepOff@©sepOff©} \emph{locally} toggle printing the separator, \ie the seperator is adjusted only with respect to the next printed item.
    23652404\begin{cfa}[mathescape=off,belowskip=0pt]
     
    2375241412 3
    23762415\end{cfa}
     2416
     2417\item
    23772418Manipulators \Indexc{sepDisable}\index{manipulator!sepDisable@©sepDisable©} and \Indexc{sepEnable}\index{manipulator!sepEnable@©sepEnable©} \emph{globally} toggle printing the separator, \ie the seperator is adjusted with respect to all subsequent printed items, unless locally adjusted.
    23782419\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     
    239424351 2 3
    23952436\end{cfa}
    2396 Printing a tuple outputs all the tuple's values separated by ©", "©:
     2437
     2438\item
     2439Routine \Indexc{sepSetTuple}\index{manipulator!sepSetTuple@©sepSetTuple©} and \Indexc{sepGetTuple}\index{manipulator!sepGetTuple@©sepGetTuple©} get and set the tuple separator-string.
     2440The tuple separator-string can be at most 16 characters including the ©'\0'© string terminator (15 printable characters).
    23972441\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    2398 sout | [2, 3] | [4, 5] | endl;                          §\C{// print tuple}§
     2442sepSetTuple( sout, " " );                                       §\C{// set tuple separator from ", " to " "}§
     2443sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl;
     2444\end{cfa}
     2445\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     24461 2 3 4 ®" "®
     2447\end{cfa}
     2448\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2449sepSetTuple( sout, ", " );                                      §\C{// reset tuple separator to ", "}§
     2450sout | t1 | t2 | " \"" | ®sepGetTuple( sout )® | "\"" | endl;
     2451\end{cfa}
     2452\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
     24531, 2, 3, 4 ®", "®
     2454\end{cfa}
     2455
     2456\item
     2457The tuple separator can also be turned on and off.
     2458\begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
     2459sout | sepOn | t1 | sepOff | t2 | endl;         §\C{// locally turn on/off implicit separation}§
    23992460\end{cfa}
    24002461\begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    2401 2, 3, 4, 5
    2402 \end{cfa}
    2403 The tuple separator can also be turned on and off:
    2404 \begin{cfa}[mathescape=off,aboveskip=0pt,belowskip=0pt]
    2405 sout | sepOn | [2, 3] | sepOff | [4, 5] | endl; §\C{// locally turn on/off implicit separation}§
    2406 \end{cfa}
    2407 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt,belowskip=0pt]
    2408 , 2, 34, 5
     2462, 1, 23, 4
    24092463\end{cfa}
    24102464Notice a tuple seperator starts the line because the next item is a tuple.
    2411 Finally, the stream routines \Indexc{sepGet}\index{manipulator!sepGet@©sepGet©} and \Indexc{sepSet}\index{manipulator!sepSet@©sepSet©} get and set the basic separator-string.
    2412 \begin{cfa}[mathescape=off,aboveskip=0pt,aboveskip=0pt,belowskip=0pt]
    2413 sepSet( sout, ", $" );                                          §\C{// set separator from " " to ", \$"}§
    2414 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    2415 \end{cfa}
    2416 %$
    2417 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
    2418 1, $2, $3 ", $"
    2419 \end{cfa}
    2420 %$
    2421 \begin{cfa}[mathescape=off,aboveskip=0pt,aboveskip=0pt,belowskip=0pt]
    2422 sepSet( sout, " " );                                            §\C{// reset separator to " "}§
    2423 sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    2424 \end{cfa}
    2425 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
    2426 1 2 3 " "
    2427 \end{cfa}
    2428 and the stream routines \Indexc{sepGetTuple}\index{manipulator!sepGetTuple@©sepGetTuple©} and \Indexc{sepSetTuple}\index{manipulator!sepSetTuple@©sepSetTuple©} get and set the tuple separator-string.
    2429 \begin{cfa}[mathescape=off,aboveskip=0pt,aboveskip=0pt,belowskip=0pt]
    2430 sepSetTuple( sout, " " );                                       §\C{// set tuple separator from ", " to " "}§
    2431 sout | [2, 3] | [4, 5] | " \"" | sepGetTuple( sout ) | "\"" | endl;
    2432 \end{cfa}
    2433 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
    2434 2 3 4 5 " "
    2435 \end{cfa}
    2436 \begin{cfa}[mathescape=off,aboveskip=0pt,aboveskip=0pt,belowskip=0pt]
    2437 sepSetTuple( sout, ", " );                                      §\C{// reset tuple separator to ", "}§
    2438 sout | [2, 3] | [4, 5] | " \"" | sepGetTuple( sout ) | "\"" | endl;
    2439 \end{cfa}
    2440 \begin{cfa}[mathescape=off,showspaces=true,aboveskip=0pt]
    2441 2, 3, 4, 5 ", "
    2442 \end{cfa}
     2465\end{enumerate}
    24432466
    24442467\begin{comment}
     
    24462469
    24472470int main( void ) {
    2448         int x = 0, y = 1, z = 2;
    2449         sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl | endl;
     2471        int x = 1, y = 2, z = 3;
     2472        sout | x | y | z | endl;
     2473        [int, int] t1 = [1, 2], t2 = [3, 4];
     2474        sout | t1 | t2 | endl;                                          // print tuple
     2475        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2) | endl;
    24502476        sout | 1 | 2 | 3 | endl;
    24512477        sout | '1' | '2' | '3' | endl;
     
    24562482                | 7 | "¢ x" | 8 | "» x" | 9 | ") x" | 10 | "] x" | 11 | "} x" | endl;
    24572483        sout | "x`" | 1 | "`x'" | 2 | "'x\"" | 3 | "\"x:" | 4 | ":x " | 5 | " x\t" | 6 | "\tx" | endl;
    2458 
    2459         sout | sepOn | 1 | 2 | 3 | sepOn | endl;        // separator at start of line
    2460         sout | 1 | sepOff | 2 | 3 | endl;                       // locally turn off implicit separator
    2461         sout | sepDisable | 1 | 2 | 3 | endl;           // globally turn off implicit separation
    2462         sout | 1 | sepOn | 2 | 3 | endl;                        // locally turn on implicit separator
    2463         sout | sepEnable | 1 | 2 | 3 | endl;            // globally turn on implicit separation
    2464 
    2465         sout | [2, 3] | [4, 5] | endl;                          // print tuple
    2466         sout | sepOn | [2, 3] | sepOff | [4, 5] | endl; // locally turn on/off implicit separation
     2484        sout | "x ( " | 1 | " ) x" | 2 | " , x" | 3 | " :x: " | 4 | endl;
    24672485
    24682486        sepSet( sout, ", $" );                                          // set separator from " " to ", $"
     
    24712489        sout | 1 | 2 | 3 | " \"" | sepGet( sout ) | "\"" | endl;
    24722490
     2491        sout | sepOn | 1 | 2 | 3 | sepOn | endl;        // separator at start of line
     2492        sout | 1 | sepOff | 2 | 3 | endl;                       // locally turn off implicit separator
     2493
     2494        sout | sepDisable | 1 | 2 | 3 | endl;           // globally turn off implicit separation
     2495        sout | 1 | sepOn | 2 | 3 | endl;                        // locally turn on implicit separator
     2496        sout | sepEnable | 1 | 2 | 3 | endl;            // globally turn on implicit separation
     2497
    24732498        sepSetTuple( sout, " " );                                       // set tuple separator from ", " to " "
    2474         sout | [2, 3] | [4, 5] | " \"" | sepGetTuple( sout ) | "\"" | endl;
     2499        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
    24752500        sepSetTuple( sout, ", " );                                      // reset tuple separator to ", "
    2476         sout | [2, 3] | [4, 5] | " \"" | sepGetTuple( sout ) | "\"" | endl;
     2501        sout | t1 | t2 | " \"" | sepGetTuple( sout ) | "\"" | endl;
     2502
     2503        sout | t1 | t2 | endl;                                          // print tuple
     2504        sout | sepOn | t1 | sepOff | t2 | endl;         // locally turn on/off implicit separation
    24772505}
    24782506
    24792507// Local Variables: //
    24802508// tab-width: 4 //
     2509// fill-column: 100 //
    24812510// End: //
    24822511\end{comment}
     
    29723001generic (type T | bool ?<?(T, T) )
    29733002
    2974 T min(T a, T b) {
     3003T min( T a, T b ) {
    29753004        return a < b ? a : b;
    29763005}
     
    30113040
    30123041generic (type T | Orderable(T))
    3013 T min(T a, T b) {
     3042T min( T a, T b ) {
    30143043        return a < b ? a : b;
    30153044}
     
    50815110C11 prescribes the following standard header-files~\cite[\S~7.1.2]{C11} and \CFA adds to this list:
    50825111\begin{quote2}
    5083 \begin{tabular}{lll|l}
    5084 \multicolumn{3}{c|}{C11} & \multicolumn{1}{c}{\CFA}             \\
     5112\begin{tabular}{llll|l}
     5113\multicolumn{4}{c|}{C11} & \multicolumn{1}{c}{\CFA}             \\
    50855114\hline
    5086 assert.h        & math.h                & stdlib.h              & unistd.h      \\
    5087 complex.h       & setjmp.h              & stdnoreturn.h & gmp.h         \\
    5088 ctype.h         & signal.h              & string.h              \\
    5089 errno.h         & stdalign.h    & tgmath.h              \\
    5090 fenv.h          & stdarg.h              & threads.h             \\
    5091 float.h         & stdatomic.h   & time.h                \\
    5092 inttypes.h      & stdbool.h             & uchar.h               \\
    5093 iso646.h        & stddef.h              & wchar.h               \\
    5094 limits.h        & stdint.h              & wctype.h              \\
    5095 locale.h        & stdio.h               &                               \\
     5115\begin{tabular}{@{}l@{}}
     5116assert.h        \\
     5117complex.h       \\
     5118ctype.h         \\
     5119errno.h         \\
     5120fenv.h          \\
     5121float.h         \\
     5122inttypes.h      \\
     5123iso646.h        \\
     5124\end{tabular}
     5125&
     5126\begin{tabular}{@{}l@{}}
     5127limits.h        \\
     5128locale.h        \\
     5129math.h          \\
     5130setjmp.h        \\
     5131signal.h        \\
     5132stdalign.h      \\
     5133stdarg.h        \\
     5134stdatomic.h     \\
     5135\end{tabular}
     5136&
     5137\begin{tabular}{@{}l@{}}
     5138stdbool.h       \\
     5139stddef.h        \\
     5140stdint.h        \\
     5141stdio.h         \\
     5142stdlib.h        \\
     5143stdnoreturn.h \\
     5144string.h        \\
     5145tgmath.h        \\
     5146\end{tabular}
     5147&
     5148\begin{tabular}{@{}l@{}}
     5149threads.h       \\
     5150time.h          \\
     5151uchar.h         \\
     5152wchar.h         \\
     5153wctype.h        \\
     5154                        \\
     5155                        \\
     5156                        \\
     5157\end{tabular}
     5158&
     5159\begin{tabular}{@{}l@{}}
     5160unistd.h        \\
     5161gmp.h           \\
     5162                        \\
     5163                        \\
     5164                        \\
     5165                        \\
     5166                        \\
     5167                        \\
     5168\end{tabular}
    50965169\end{tabular}
    50975170\end{quote2}
     
    51045177\label{s:StandardLibrary}
    51055178
    5106 The \CFA standard-library wraps many existing explicitly-polymorphic C general-routines into implicitly-polymorphic versions.
     5179The \CFA standard-library wraps explicitly-polymorphic C general-routines into implicitly-polymorphic versions.
    51075180
    51085181
     
    51225195forall( dtype T | sized(T) ) T * memalign( size_t alignment );          // deprecated
    51235196forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment );
    5124 
    5125 forall( otype T ) T * memset( T * ptr, unsigned char fill ); // use default value '\0' for fill
    5126 forall( otype T ) T * memset( T * ptr );                                // remove when default value available
    51275197
    51285198forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
     
    51685238\leavevmode
    51695239\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    5170 forall( otype T | { int ?<?( T, T ); } )
    5171 T * bsearch( const T key, const T * arr, size_t dimension );§\indexc{bsearch}§
     5240forall( otype T | { int ?<?( T, T ); } )        // location
     5241T * bsearch( T key, const T * arr, size_t dimension );§\indexc{bsearch}§
     5242
     5243forall( otype T | { int ?<?( T, T ); } )        // position
     5244unsigned int bsearch( T key, const T * arr, size_t dimension );
    51725245
    51735246forall( otype T | { int ?<?( T, T ); } )
     
    51805253\leavevmode
    51815254\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    5182 char abs( char );§\indexc{abs}§
     5255unsigned char abs( signed char );§\indexc{abs}§
    51835256int abs( int );
    5184 long int abs( long int );
    5185 long long int abs( long long int );
     5257unsigned long int abs( long int );
     5258unsigned long long int abs( long long int );
    51865259float abs( float );
    51875260double abs( double );
     
    51905263double abs( double _Complex );
    51915264long double abs( long double _Complex );
     5265forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
     5266T abs( T );
    51925267\end{cfa}
    51935268
     
    52165291\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    52175292forall( otype T | { int ?<?( T, T ); } )
    5218 T min( const T t1, const T t2 );§\indexc{min}§
     5293T min( T t1, T t2 );§\indexc{min}§
    52195294
    52205295forall( otype T | { int ?>?( T, T ); } )
    5221 T max( const T t1, const T t2 );§\indexc{max}§
     5296T max( T t1, T t2 );§\indexc{max}§
    52225297
    52235298forall( otype T | { T min( T, T ); T max( T, T ); } )
     
    52325307\label{s:Math Library}
    52335308
    5234 The \CFA math-library wraps many existing explicitly-polymorphic C math-routines into implicitly-polymorphic versions.
     5309The \CFA math-library wraps explicitly-polymorphic C math-routines into implicitly-polymorphic versions.
    52355310
    52365311
     
    52395314\leavevmode
    52405315\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    5241 float fabs( float );§\indexc{fabs}§
    5242 double fabs( double );
    5243 long double fabs( long double );
    5244 float cabs( float _Complex );
    5245 double cabs( double _Complex );
    5246 long double cabs( long double _Complex );
    5247 
    52485316float ?%?( float, float );§\indexc{fmod}§
    52495317float fmod( float, float );
     
    56005668
    56015669
     5670\section{Multi-precision Integers}
     5671\label{s:MultiPrecisionIntegers}
     5672
     5673\CFA has an interface to the \Index{GMP} \Index{multi-precision} signed-integers~\cite{GMP}, similar to the \CC interface provided by GMP.
     5674The \CFA interface wraps GMP routines into operator routines to make programming with multi-precision integers identical to using fixed-sized integers.
     5675The \CFA type name for multi-precision signed-integers is \Indexc{Int}.
     5676
     5677\begin{cfa}
     5678void ?{}( Int * this );                                 §\C{// constructor}§
     5679void ?{}( Int * this, Int init );
     5680void ?{}( Int * this, zero_t );
     5681void ?{}( Int * this, one_t );
     5682void ?{}( Int * this, signed long int init );
     5683void ?{}( Int * this, unsigned long int init );
     5684void ?{}( Int * this, const char * val );
     5685void ^?{}( Int * this );
     5686
     5687Int ?=?( Int * lhs, Int rhs );                  §\C{// assignment}§
     5688Int ?=?( Int * lhs, long int rhs );
     5689Int ?=?( Int * lhs, unsigned long int rhs );
     5690Int ?=?( Int * lhs, const char * rhs );
     5691
     5692char ?=?( char * lhs, Int rhs );
     5693short int ?=?( short int * lhs, Int rhs );
     5694int ?=?( int * lhs, Int rhs );
     5695long int ?=?( long int * lhs, Int rhs );
     5696unsigned char ?=?( unsigned char * lhs, Int rhs );
     5697unsigned short int ?=?( unsigned short int * lhs, Int rhs );
     5698unsigned int ?=?( unsigned int * lhs, Int rhs );
     5699unsigned long int ?=?( unsigned long int * lhs, Int rhs );
     5700
     5701long int narrow( Int val );
     5702unsigned long int narrow( Int val );
     5703
     5704int ?==?( Int oper1, Int oper2 );               §\C{// comparison}§
     5705int ?==?( Int oper1, long int oper2 );
     5706int ?==?( long int oper2, Int oper1 );
     5707int ?==?( Int oper1, unsigned long int oper2 );
     5708int ?==?( unsigned long int oper2, Int oper1 );
     5709
     5710int ?!=?( Int oper1, Int oper2 );
     5711int ?!=?( Int oper1, long int oper2 );
     5712int ?!=?( long int oper1, Int oper2 );
     5713int ?!=?( Int oper1, unsigned long int oper2 );
     5714int ?!=?( unsigned long int oper1, Int oper2 );
     5715
     5716int ?<?( Int oper1, Int oper2 );
     5717int ?<?( Int oper1, long int oper2 );
     5718int ?<?( long int oper2, Int oper1 );
     5719int ?<?( Int oper1, unsigned long int oper2 );
     5720int ?<?( unsigned long int oper2, Int oper1 );
     5721
     5722int ?<=?( Int oper1, Int oper2 );
     5723int ?<=?( Int oper1, long int oper2 );
     5724int ?<=?( long int oper2, Int oper1 );
     5725int ?<=?( Int oper1, unsigned long int oper2 );
     5726int ?<=?( unsigned long int oper2, Int oper1 );
     5727
     5728int ?>?( Int oper1, Int oper2 );
     5729int ?>?( Int oper1, long int oper2 );
     5730int ?>?( long int oper1, Int oper2 );
     5731int ?>?( Int oper1, unsigned long int oper2 );
     5732int ?>?( unsigned long int oper1, Int oper2 );
     5733
     5734int ?>=?( Int oper1, Int oper2 );
     5735int ?>=?( Int oper1, long int oper2 );
     5736int ?>=?( long int oper1, Int oper2 );
     5737int ?>=?( Int oper1, unsigned long int oper2 );
     5738int ?>=?( unsigned long int oper1, Int oper2 );
     5739
     5740Int +?( Int oper );                                             §\C{// arithmetic}§
     5741Int -?( Int oper );
     5742Int ~?( Int oper );
     5743
     5744Int ?&?( Int oper1, Int oper2 );
     5745Int ?&?( Int oper1, long int oper2 );
     5746Int ?&?( long int oper1, Int oper2 );
     5747Int ?&?( Int oper1, unsigned long int oper2 );
     5748Int ?&?( unsigned long int oper1, Int oper2 );
     5749Int ?&=?( Int * lhs, Int rhs );
     5750
     5751Int ?|?( Int oper1, Int oper2 );
     5752Int ?|?( Int oper1, long int oper2 );
     5753Int ?|?( long int oper1, Int oper2 );
     5754Int ?|?( Int oper1, unsigned long int oper2 );
     5755Int ?|?( unsigned long int oper1, Int oper2 );
     5756Int ?|=?( Int * lhs, Int rhs );
     5757
     5758Int ?^?( Int oper1, Int oper2 );
     5759Int ?^?( Int oper1, long int oper2 );
     5760Int ?^?( long int oper1, Int oper2 );
     5761Int ?^?( Int oper1, unsigned long int oper2 );
     5762Int ?^?( unsigned long int oper1, Int oper2 );
     5763Int ?^=?( Int * lhs, Int rhs );
     5764
     5765Int ?+?( Int addend1, Int addend2 );
     5766Int ?+?( Int addend1, long int addend2 );
     5767Int ?+?( long int addend2, Int addend1 );
     5768Int ?+?( Int addend1, unsigned long int addend2 );
     5769Int ?+?( unsigned long int addend2, Int addend1 );
     5770Int ?+=?( Int * lhs, Int rhs );
     5771Int ?+=?( Int * lhs, long int rhs );
     5772Int ?+=?( Int * lhs, unsigned long int rhs );
     5773Int ++?( Int * lhs );
     5774Int ?++( Int * lhs );
     5775
     5776Int ?-?( Int minuend, Int subtrahend );
     5777Int ?-?( Int minuend, long int subtrahend );
     5778Int ?-?( long int minuend, Int subtrahend );
     5779Int ?-?( Int minuend, unsigned long int subtrahend );
     5780Int ?-?( unsigned long int minuend, Int subtrahend );
     5781Int ?-=?( Int * lhs, Int rhs );
     5782Int ?-=?( Int * lhs, long int rhs );
     5783Int ?-=?( Int * lhs, unsigned long int rhs );
     5784Int --?( Int * lhs );
     5785Int ?--( Int * lhs );
     5786
     5787Int ?*?( Int multiplicator, Int multiplicand );
     5788Int ?*?( Int multiplicator, long int multiplicand );
     5789Int ?*?( long int multiplicand, Int multiplicator );
     5790Int ?*?( Int multiplicator, unsigned long int multiplicand );
     5791Int ?*?( unsigned long int multiplicand, Int multiplicator );
     5792Int ?*=?( Int * lhs, Int rhs );
     5793Int ?*=?( Int * lhs, long int rhs );
     5794Int ?*=?( Int * lhs, unsigned long int rhs );
     5795
     5796Int ?/?( Int dividend, Int divisor );
     5797Int ?/?( Int dividend, unsigned long int divisor );
     5798Int ?/?( unsigned long int dividend, Int divisor );
     5799Int ?/?( Int dividend, long int divisor );
     5800Int ?/?( long int dividend, Int divisor );
     5801Int ?/=?( Int * lhs, Int rhs );
     5802Int ?/=?( Int * lhs, long int rhs );
     5803Int ?/=?( Int * lhs, unsigned long int rhs );
     5804
     5805[ Int, Int ] div( Int dividend, Int divisor );
     5806[ Int, Int ] div( Int dividend, unsigned long int divisor );
     5807
     5808Int ?%?( Int dividend, Int divisor );
     5809Int ?%?( Int dividend, unsigned long int divisor );
     5810Int ?%?( unsigned long int dividend, Int divisor );
     5811Int ?%?( Int dividend, long int divisor );
     5812Int ?%?( long int dividend, Int divisor );
     5813Int ?%=?( Int * lhs, Int rhs );
     5814Int ?%=?( Int * lhs, long int rhs );
     5815Int ?%=?( Int * lhs, unsigned long int rhs );
     5816
     5817Int ?<<?( Int shiften, mp_bitcnt_t shift );
     5818Int ?<<=?( Int * lhs, mp_bitcnt_t shift );
     5819Int ?>>?( Int shiften, mp_bitcnt_t shift );
     5820Int ?>>=?( Int * lhs, mp_bitcnt_t shift );
     5821
     5822Int abs( Int oper );                                    §\C{// number functions}§
     5823Int fact( unsigned long int N );
     5824Int gcd( Int oper1, Int oper2 );
     5825Int pow( Int base, unsigned long int exponent );
     5826Int pow( unsigned long int base, unsigned long int exponent );
     5827void srandom( gmp_randstate_t state );
     5828Int random( gmp_randstate_t state, mp_bitcnt_t n );
     5829Int random( gmp_randstate_t state, Int n );
     5830Int random( gmp_randstate_t state, mp_size_t max_size );
     5831int sgn( Int oper );
     5832Int sqrt( Int oper );
     5833
     5834forall( dtype istype | istream( istype ) ) istype * ?|?( istype * is, Int * mp );  §\C{// I/O}§
     5835forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype * os, Int mp );
     5836\end{cfa}
     5837
     5838The following factorial programs contrast using GMP with the \CFA and C interfaces, where the output from these programs appears in \VRef[Figure]{f:MultiPrecisionFactorials}.
     5839(Compile with flag \Indexc{-lgmp} to link with the GMP library.)
     5840\begin{quote2}
     5841\begin{tabular}{@{}l@{\hspace{\parindentlnth}}|@{\hspace{\parindentlnth}}l@{}}
     5842\multicolumn{1}{c|@{\hspace{\parindentlnth}}}{\textbf{\CFA}}    & \multicolumn{1}{@{\hspace{\parindentlnth}}c}{\textbf{C}}      \\
     5843\hline
     5844\begin{cfa}
     5845#include <gmp>
     5846int main( void ) {
     5847        sout | "Factorial Numbers" | endl;
     5848        Int fact;
     5849        fact = 1;
     5850        sout | 0 | fact | endl;
     5851        for ( unsigned int i = 1; i <= 40; i += 1 ) {
     5852                fact *= i;
     5853                sout | i | fact | endl;
     5854        }
     5855}
     5856\end{cfa}
     5857&
     5858\begin{cfa}
     5859#include <gmp.h>
     5860int main( void ) {
     5861        ®gmp_printf®( "Factorial Numbers\n" );
     5862        ®mpz_t® fact;
     5863        ®mpz_init_set_ui®( fact, 1 );
     5864        ®gmp_printf®( "%d %Zd\n", 0, fact );
     5865        for ( unsigned int i = 1; i <= 40; i += 1 ) {
     5866                ®mpz_mul_ui®( fact, fact, i );
     5867                ®gmp_printf®( "%d %Zd\n", i, fact );
     5868        }
     5869}
     5870\end{cfa}
     5871\end{tabular}
     5872\end{quote2}
     5873
     5874\begin{figure}
     5875\begin{cfa}
     5876Factorial Numbers
     58770 1
     58781 1
     58792 2
     58803 6
     58814 24
     58825 120
     58836 720
     58847 5040
     58858 40320
     58869 362880
     588710 3628800
     588811 39916800
     588912 479001600
     589013 6227020800
     589114 87178291200
     589215 1307674368000
     589316 20922789888000
     589417 355687428096000
     589518 6402373705728000
     589619 121645100408832000
     589720 2432902008176640000
     589821 51090942171709440000
     589922 1124000727777607680000
     590023 25852016738884976640000
     590124 620448401733239439360000
     590225 15511210043330985984000000
     590326 403291461126605635584000000
     590427 10888869450418352160768000000
     590528 304888344611713860501504000000
     590629 8841761993739701954543616000000
     590730 265252859812191058636308480000000
     590831 8222838654177922817725562880000000
     590932 263130836933693530167218012160000000
     591033 8683317618811886495518194401280000000
     591134 295232799039604140847618609643520000000
     591235 10333147966386144929666651337523200000000
     591336 371993326789901217467999448150835200000000
     591437 13763753091226345046315979581580902400000000
     591538 523022617466601111760007224100074291200000000
     591639 20397882081197443358640281739902897356800000000
     591740 815915283247897734345611269596115894272000000000
     5918\end{cfa}
     5919\caption{Multi-precision Factorials}
     5920\label{f:MultiPrecisionFactorials}
     5921\end{figure}
     5922
     5923
    56025924\section{Rational Numbers}
    56035925\label{s:RationalNumbers}
     
    56125934}; // Rational
    56135935
    5614 // constants
    5615 extern struct Rational 0;
    5616 extern struct Rational 1;
    5617 
    5618 // constructors
    5619 Rational rational();
     5936Rational rational();                                    §\C{// constructors}§
    56205937Rational rational( long int n );
    56215938Rational rational( long int n, long int d );
    5622 
    5623 // getter/setter for numerator/denominator
    5624 long int numerator( Rational r );
     5939void ?{}( Rational * r, zero_t );
     5940void ?{}( Rational * r, one_t );
     5941
     5942long int numerator( Rational r );               §\C{// numerator/denominator getter/setter}§
    56255943long int numerator( Rational r, long int n );
    56265944long int denominator( Rational r );
    56275945long int denominator( Rational r, long int d );
    56285946
    5629 // comparison
    5630 int ?==?( Rational l, Rational r );
     5947int ?==?( Rational l, Rational r );             §\C{// comparison}§
    56315948int ?!=?( Rational l, Rational r );
    56325949int ?<?( Rational l, Rational r );
     
    56355952int ?>=?( Rational l, Rational r );
    56365953
    5637 // arithmetic
    5638 Rational -?( Rational r );
     5954Rational -?( Rational r );                              §\C{// arithmetic}§
    56395955Rational ?+?( Rational l, Rational r );
    56405956Rational ?-?( Rational l, Rational r );
     
    56425958Rational ?/?( Rational l, Rational r );
    56435959
    5644 // conversion
    5645 double widen( Rational r );
     5960double widen( Rational r );                             §\C{// conversion}§
    56465961Rational narrow( double f, long int md );
    56475962
    5648 // I/O
    5649 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, Rational * );
     5963forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, Rational * ); // I/O
    56505964forall( dtype ostype | ostream( ostype ) ) ostype * ?|?( ostype *, Rational );
    56515965\end{cfa}
  • src/Parser/lex.ll

    ra8e64c4 r0a208b8  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu May 18 09:03:49 2017
    13  * Update Count     : 513
     12 * Last Modified On : Mon May 22 07:46:30 2017
     13 * Update Count     : 525
    1414 */
    1515
     
    377377"?"{op_binary_over}"?"  { IDENTIFIER_RETURN(); }                // binary
    378378        /*
    379           This rule handles ambiguous cases with operator identifiers, e.g., "int *?*?()", where the string "*?*?"
    380           can be lexed as "*"/"?*?" or "*?"/"*?". Since it is common practise to put a unary operator juxtaposed
    381           to an identifier, e.g., "*i", users will be annoyed if they cannot do this with respect to operator
    382           identifiers. Even with this special hack, there are 5 general cases that cannot be handled. The first
    383           case is for the function-call identifier "?()":
    384 
    385           int * ?()();  // declaration: space required after '*'
    386           * ?()();      // expression: space required after '*'
    387 
    388           Without the space, the string "*?()" is ambiguous without N character look ahead; it requires scanning
    389           ahead to determine if there is a '(', which is the start of an argument/parameter list.
    390 
    391           The 4 remaining cases occur in expressions:
    392 
    393           i++?i:0;              // space required before '?'
    394           i--?i:0;              // space required before '?'
    395           i?++i:0;              // space required after '?'
    396           i?--i:0;              // space required after '?'
    397 
    398           In the first two cases, the string "i++?" is ambiguous, where this string can be lexed as "i"/"++?" or
    399           "i++"/"?"; it requires scanning ahead to determine if there is a '(', which is the start of an argument
    400           list.  In the second two cases, the string "?++x" is ambiguous, where this string can be lexed as
    401           "?++"/"x" or "?"/"++x"; it requires scanning ahead to determine if there is a '(', which is the start of
    402           an argument list.
     379          This rule handles ambiguous cases with operator identifiers, e.g., "int *?*?()", where the string "*?*?"  can be
     380          lexed as "*?"/"*?" or "*"/"?*?". Since it is common practise to put a unary operator juxtaposed to an identifier,
     381          e.g., "*i", users will be annoyed if they cannot do this with respect to operator identifiers. Therefore, there is
     382          a lexical look-ahead for the second case, with backtracking to return the leading unary operator and then
     383          reparsing the trailing operator identifier.  Otherwise a space is needed between the unary operator and operator
     384          identifier to disambiguate this common case.
     385
     386          A similar issue occurs with the dereference, *?(...), and routine-call, ?()(...) identifiers.  The ambiguity
     387          occurs when the deference operator has no parameters, *?() and *?()(...), requiring arbitrary whitespace
     388          look-ahead for the routine-call parameter-list to disambiguate.  However, the dereference operator must have a
     389          parameter/argument to dereference *?(...).  Hence, always interpreting the string *?() as * ?() does not preclude
     390          any meaningful program.
     391
     392          The remaining cases are with the increment/decrement operators and conditional expression:
     393
     394          i++? ...(...);
     395          i?++ ...(...);
     396
     397          requiring arbitrary whitespace look-ahead for the operator parameter-list, even though that interpretation is an
     398      incorrect expression (juxtaposed identifiers).  Therefore, it is necessary to disambiguate these cases with a
     399      space:
     400
     401          i++ ? i : 0;
     402          i? ++i : 0;
    403403        */
    404 {op_unary}"?"({op_unary_pre_post}|"[?]"|{op_binary_over}"?") {
     404{op_unary}"?"({op_unary_pre_post}|"()"|"[?]"|{op_binary_over}"?") {
    405405        // 1 or 2 character unary operator ?
    406406        int i = yytext[1] == '?' ? 1 : 2;
  • src/libcfa/math

    ra8e64c4 r0a208b8  
    1010// Created On       : Mon Apr 18 23:37:04 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 12:45:02 2016
    13 // Update Count     : 59
     12// Last Modified On : Wed May 24 17:40:39 2017
     13// Update Count     : 60
    1414//
    1515
     
    2020#include <math.h>                                                                               // fpclassify, isfinite, isnormal, isnan, isinf
    2121} // extern "C"
    22 
    23 float fabs( float );
    24 // extern "C" { double fabs( double ); }
    25 long double fabs( long double );
    26 float cabs( float _Complex );
    27 // extern "C" { double cabs( double _Complex ); }
    28 long double cabs( long double _Complex );
    2922
    3023float ?%?( float, float );
  • src/libcfa/math.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Tue Apr 19 22:23:08 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 08:52:31 2016
    13 // Update Count     : 75
     12// Last Modified On : Tue May 23 22:52:13 2017
     13// Update Count     : 76
    1414//
    1515
     
    1919#include <complex.h>
    2020} // extern "C"
    21 
    22 float fabs( float x ) { return fabsf( x ); }
    23 long double fabs( long double x ) { return fabsl( x ); }
    24 float cabs( float _Complex x ) { return cabsf( x ); }
    25 long double cabs( long double _Complex x ) { return cabsl( x ); }
    2621
    2722float ?%?( float x, float y ) { return fmodf( x, y ); }
  • src/libcfa/stdlib

    ra8e64c4 r0a208b8  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  9 08:42:44 2017
    13 // Update Count     : 107
     12// Last Modified On : Wed May 24 18:06:27 2017
     13// Update Count     : 115
    1414//
    1515
     
    2828//---------------------------------------
    2929
    30 extern "C" { void * malloc( size_t ); }                                 // use default C routine for void *
    3130forall( dtype T | sized(T) ) T * malloc( void );
    3231forall( dtype T | sized(T) ) T * malloc( char fill );
     
    4241forall( dtype T | sized(T) ) T * memalign( size_t alignment );          // deprecated
    4342forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t alignment );
    44 
    45 extern "C" {
    46 void * memset( void * ptr, int fill, size_t size );
    47 void free( void * ptr );
    48 } // extern "C"
    4943
    5044forall( dtype T, ttype Params | sized(T) | { void ?{}(T *, Params); } ) T * new( Params p );
     
    109103double abs( double _Complex );
    110104long double abs( long double _Complex );
    111 forall ( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
     105forall( otype T | { void ?{}( T *, zero_t ); int ?<?( T, T ); T -?( T ); } )
    112106T abs( T );
    113107
     
    115109
    116110void rand48seed( long int s );
    117 char rand48();
    118 int rand48();
    119 unsigned int rand48();
    120 long int rand48();
    121 unsigned long int rand48();
    122 float rand48();
    123 double rand48();
    124 float _Complex rand48();
    125 double _Complex rand48();
    126 long double _Complex rand48();
     111char rand48( void );
     112int rand48( void );
     113unsigned int rand48( void );
     114long int rand48( void );
     115unsigned long int rand48( void );
     116float rand48( void );
     117double rand48( void );
     118float _Complex rand48( void );
     119double _Complex rand48( void );
     120long double _Complex rand48( void );
    127121
    128122//---------------------------------------
  • src/libcfa/stdlib.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May  9 08:43:00 2017
    13 // Update Count     : 191
     12// Last Modified On : Wed May 24 18:13:15 2017
     13// Update Count     : 198
    1414//
    1515
     
    279279
    280280void rand48seed( long int s ) { srand48( s ); }
    281 char rand48() { return mrand48(); }
    282 int rand48() { return mrand48(); }
    283 unsigned int rand48() { return lrand48(); }
    284 long int rand48() { return mrand48(); }
    285 unsigned long int rand48() { return lrand48(); }
    286 float rand48() { return (float)drand48(); }                             // otherwise float uses lrand48
    287 double rand48() { return drand48(); }
    288 float _Complex rand48() { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
    289 double _Complex rand48() { return drand48() + (double _Complex)(drand48() * _Complex_I); }
    290 long double _Complex rand48() { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
     281char rand48( void ) { return mrand48(); }
     282int rand48( void ) { return mrand48(); }
     283unsigned int rand48( void ) { return lrand48(); }
     284long int rand48( void ) { return mrand48(); }
     285unsigned long int rand48( void ) { return lrand48(); }
     286float rand48( void ) { return (float)drand48(); }               // otherwise float uses lrand48
     287double rand48( void ) { return drand48(); }
     288float _Complex rand48( void ) { return (float)drand48() + (float _Complex)(drand48() * _Complex_I); }
     289double _Complex rand48( void ) { return drand48() + (double _Complex)(drand48() * _Complex_I); }
     290long double _Complex rand48( void) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
    291291
    292292//---------------------------------------
  • src/tests/.expect/64/math.txt

    ra8e64c4 r0a208b8  
    1 fabs: 1 1 1 1.41421 1.41421356237309505 1.41421356237309505
    2 fmod: 1 1 1 1 1 1
    3 remainder: -1 -1 -1
    4 remquo: 7 0.0999999 7 0.1 7 0.0999999999999999999
    5 div: 7 0.0999999 7 0.1 7 0.0999999999999999999
    6 fma: -2 -2 -2
    7 fdim: 2 2 2
    8 nan: nan nan nan
    9 exp: 2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
    10 exp2: 2 2 2
    11 expm1: 1.71828 1.71828182845905 1.71828182845904524
    12 log: 0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
    13 log2: 3 3 3
    14 log10: 2 2 2
    15 log1p: 0.693147 0.693147180559945 0.693147180559945309
    16 ilogb: 0 0 0
    17 logb: 3 3 3
    18 sqrt: 1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
    19 cbrt: 3 3 3
    20 hypot: 1.41421 1.4142135623731 1.41421356237309505
    21 pow: 1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
    22 sin: 0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
    23 cos: 0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
    24 tan: 1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
    25 asin: 1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
    26 acos: 0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
    27 atan: 0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
    28 atan2: 0.785398 0.785398163397448 0.78539816339744831 atan: 0.785398 0.785398163397448 0.78539816339744831 sinh: 1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i
    29 cosh: 1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
    30 tanh: 0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
    31 acosh: 0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
    32 asinh: 0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
    33 atanh: inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
    34 erf: 0.842701 0.842700792949715 0.842700792949714869
    35 erfc: 0.157299 0.157299207050285 0.157299207050285131
    36 lgamma: 1.79176 1.79175946922805 1.791759469228055
    37 lgamma: 1.79176 1 1.79175946922805 1 1.791759469228055 1
    38 tgamma: 6 6 6
    39 floor: 1 1 1
    40 ceil: 2 2 2
    41 trunc: 3 3 3
    42 rint: 2 2 2
    43 rint: 2 2 2
    44 rint: 2 2 2
    45 lrint: 2 2 2
    46 llrint: 2 2 2
    47 nearbyint: 4 4 4
    48 round: 2 2 2
    49 round: 2 2 2
    50 round: 2 2 2
    51 lround: 2 2 2
    52 llround: 2 2 2
    53 copysign: -1 -1 -1
    54 frexp: 0.5 3 0.5 3 0.5 3
    55 ldexp: 8 8 8
    56 modf: 2 0.3 2 0.3 2 0.3 nextafter: 2 2 2
    57 nexttoward: 2 2 2
    58 scalbn: 16 16 16
    59 scalbln: 16 16 16
     1fmod:1 1 1 1 1 1
     2remainder:-1 -1 -1
     3remquo:7 0.0999999 7 0.1 7 0.0999999999999999999
     4div:7 0.0999999 7 0.1 7 0.0999999999999999999
     5fma:-2 -2 -2
     6fdim:2 2 2
     7nan:nan nan nan
     8exp:2.71828 2.71828182845905 2.71828182845904524 1.46869+2.28736i 1.46869393991589+2.28735528717884i 1.46869393991588516+2.28735528717884239i
     9exp2:2 2 2
     10expm1:1.71828 1.71828182845905 1.71828182845904524
     11log:0 0 0 0.346574+0.785398i 0.346573590279973+0.785398163397448i 0.346573590279972655+0.78539816339744831i
     12log2:3 3 3
     13log10:2 2 2
     14log1p:0.693147 0.693147180559945 0.693147180559945309
     15ilogb:0 0 0
     16logb:3 3 3
     17sqrt:1 1 1 1.09868+0.45509i 1.09868411346781+0.455089860562227i 1.09868411346780997+0.455089860562227341i
     18cbrt:3 3 3
     19hypot:1.41421 1.4142135623731 1.41421356237309505
     20pow:1 1 1 0.273957+0.583701i 0.273957253830121+0.583700758758615i 0.273957253830121071+0.583700758758614628i
     21sin:0.841471 0.841470984807897 0.841470984807896507 1.29846+0.634964i 1.29845758141598+0.634963914784736i 1.29845758141597729+0.634963914784736108i
     22cos:0.540302 0.54030230586814 0.540302305868139717 0.83373-0.988898i 0.833730025131149-0.988897705762865i 0.833730025131149049-0.988897705762865096i
     23tan:1.55741 1.5574077246549 1.55740772465490223 0.271753+1.08392i 0.271752585319512+1.08392332733869i 0.271752585319511717+1.08392332733869454i
     24asin:1.5708 1.5707963267949 1.57079632679489662 0.666239+1.06128i 0.666239432492515+1.06127506190504i 0.666239432492515255+1.06127506190503565i
     25acos:0 0 0 0.904557-1.06128i 0.904556894302381-1.06127506190504i 0.904556894302381364-1.06127506190503565i
     26atan:0.785398 0.785398163397448 0.78539816339744831 1.01722+0.402359i 1.01722196789785+0.402359478108525i 1.01722196789785137+0.402359478108525094i
     27atan2:0.785398 0.785398163397448 0.78539816339744831 atan:0.785398 0.785398163397448 0.78539816339744831 sinh:1.1752 1.1752011936438 1.17520119364380146 0.634964+1.29846i 0.634963914784736+1.29845758141598i 0.634963914784736108+1.29845758141597729i
     28cosh:1.54308 1.54308063481524 1.54308063481524378 0.83373+0.988898i 0.833730025131149+0.988897705762865i 0.833730025131149049+0.988897705762865096i
     29tanh:0.761594 0.761594155955765 0.761594155955764888 1.08392+0.271753i 1.08392332733869+0.271752585319512i 1.08392332733869454+0.271752585319511717i
     30acosh:0 0 0 1.06128+0.904557i 1.06127506190504+0.904556894302381i 1.06127506190503565+0.904556894302381364i
     31asinh:0.881374 0.881373587019543 0.881373587019543025 1.06128+0.666239i 1.06127506190504+0.666239432492515i 1.06127506190503565+0.666239432492515255i
     32atanh:inf inf inf 0.402359+1.01722i 0.402359478108525+1.01722196789785i 0.402359478108525094+1.01722196789785137i
     33erf:0.842701 0.842700792949715 0.842700792949714869
     34erfc:0.157299 0.157299207050285 0.157299207050285131
     35lgamma:1.79176 1.79175946922805 1.791759469228055
     36lgamma:1.79176 1 1.79175946922805 1 1.791759469228055 1
     37tgamma:6 6 6
     38floor:1 1 1
     39ceil:2 2 2
     40trunc:3 3 3
     41rint:2 2 2
     42rint:2 2 2
     43rint:2 2 2
     44lrint:2 2 2
     45llrint:2 2 2
     46nearbyint:4 4 4
     47round:2 2 2
     48round:2 2 2
     49round:2 2 2
     50lround:2 2 2
     51llround:2 2 2
     52copysign:-1 -1 -1
     53frexp:0.5 3 0.5 3 0.5 3
     54ldexp:8 8 8
     55modf:2 0.3 2 0.3 2 0.3 nextafter:2 2 2
     56nexttoward:2 2 2
     57scalbn:16 16 16
     58scalbln:16 16 16
  • src/tests/KRfunctions.c

    ra8e64c4 r0a208b8  
    1 //                               -*- Mode: C -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     
    1110// Created On       : Thu Feb 16 15:23:17 2017
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu Feb 16 15:25:52 2017
    14 // Update Count     : 2
     12// Last Modified On : Wed May 24 22:05:00 2017
     13// Update Count     : 3
    1514//
    1615
  • src/tests/complex.c

    ra8e64c4 r0a208b8  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// complex.c --
     8//
     9// Author           : Peter A. Buhr
     10// Created On       : Wed May 24 22:07:31 2017
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed May 24 22:08:01 2017
     13// Update Count     : 1
     14//
     15
    116#include <stdio.h>
    217#include <complex.h>
     
    2035#endif // __CFA
    2136}
     37
     38// Local Variables: //
     39// tab-width: 4 //
     40// compile-command: "cfa complex.c" //
     41// End: //
  • src/tests/gmp.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Tue Apr 19 08:55:51 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 22 09:05:09 2017
    13 // Update Count     : 538
     12// Last Modified On : Wed May 24 22:05:38 2017
     13// Update Count     : 540
    1414//
    1515
     
    8888        sout | (int)0 | fact | endl;
    8989        for ( unsigned int i = 1; i <= 40; i += 1 ) {
    90                 fact = fact * i;                                                                // general case
     90                fact *= i;                                                                              // general case
    9191                sout | i | fact | endl;
    9292        } // for
     
    9494
    9595// Local Variables: //
    96 // mode: c //
    9796// tab-width: 4 //
     97// compile-command: "cfa gmp.c -l gmp" //
    9898// End: //
  • src/tests/math.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Fri Apr 22 14:59:21 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 24 13:24:20 2016
    13 // Update Count     : 70
     12// Last Modified On : Wed May 24 13:04:33 2017
     13// Update Count     : 71
    1414//
    1515
     
    2222        long double l;
    2323
    24         sout | "fabs:" | fabs( -1.0F ) | fabs( -1.0D ) | fabs( -1.0L ) | cabs( -1.0F+1.0FI ) | cabs( -1.0D+1.0DI ) | cabs( -1.0DL+1.0LI ) | endl;
    2524        sout | "fmod:" | 5.0F % -2.0F | fmod( 5.0F, -2.0F ) | 5.0D % -2.0D | fmod( 5.0D, -2.0D ) | 5.0L % -2.0L | fmod( 5.0L, -2.0L ) | endl;
    2625        sout | "remainder:" | remainder( 2.0F, 3.0F ) | remainder( 2.0D, 3.0D ) | remainder( 2.0L, 3.0L ) | endl;
  • src/tests/numericConstants.c

    ra8e64c4 r0a208b8  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// numericConstants.c --
     8//
     9// Author           : Peter A. Buhr
     10// Created On       : Wed May 24 22:10:36 2017
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed May 24 22:11:36 2017
     13// Update Count     : 2
     14//
     15
    116int main() {
    217        1;                                                      // decimal
     
    4863        0x_ff.ffp0;                                     // hex real
    4964        0x_1.ffff_ffff_p_128_l;
    50 }
     65} // main
     66
     67// Local Variables: //
     68// tab-width: 4 //
     69// compile-command: "cfa minmax.c" //
     70// End: //
  • src/tests/rational.c

    ra8e64c4 r0a208b8  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 15 21:32:22 2017
    13 // Update Count     : 64
     12// Last Modified On : Wed May 17 15:46:35 2017
     13// Update Count     : 65
    1414//
    1515
Note: See TracChangeset for help on using the changeset viewer.