Changes in / [17b6fc9:1c1395d]


Ignore:
Files:
96 added
96 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/fangren_yu_COOP_S20/Report.tex

    r17b6fc9 r1c1395d  
    1313\usepackage{latexsym}                                   % \Box glyph
    1414\usepackage{mathptmx}                                   % better math font with "times"
    15 \usepackage{appendix}
    1615\usepackage[usenames]{color}
    1716\input{common}                                          % common CFA document macros
    1817\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
    1918\usepackage{breakurl}
    20 \urlstyle{sf}
    21 
    22 % reduce spacing
    23 \setlist[itemize]{topsep=5pt,parsep=0pt}% global
    24 \setlist[enumerate]{topsep=5pt,parsep=0pt}% global
    2519
    2620\usepackage[pagewise]{lineno}
     
    118112\begin{itemize}
    119113\item
    120 type declaration: @struct@, @union@, @typedef@ or type parameter (see \VRef[Appendix]{s:KindsTypeParameters})
     114type declaration: @struct@, @union@, @typedef@ or type parameter (see Appendix A.1)
    121115\item
    122116variable declaration
     
    380374
    381375\subsubsection{Source: \lstinline{AST/SymbolTable.hpp}}
    382 
    383 
    384376\subsubsection{Source: \lstinline{SymTab/Indexer.h}}
    385377
     
    534526Each pair of compatible branch expression types produce a possible interpretation, and the cost is defined as the sum of the expression costs plus the sum of conversion costs to the common type.
    535527
    536 
    537528\subsection{Conversion and Application Cost}
    538 
    539 There were some unclear parts in the previous documentation in the cost system, as described in the Moss thesis~\cite{Moss19}, section 4.1.2.
    540 Some clarification are presented in this section.
     529There were some unclear parts in the previous documentation of cost system, as described in the Moss thesis \cite{Moss19}, section 4.1.2. Some clarification are presented in this section.
    541530
    542531\begin{enumerate}
    543532\item
    544 Conversion to a type denoted by parameter may incur additional cost if the match is not exact.
    545 For example, if a function is declared to accept @(T, T)@ and receives @(int, long)@, @T@ is deducted @long@ and an additional widening conversion cost is added for @int@ to @T@.
    546 
    547 \item
    548 The specialization level of a function is the sum of the least depth of an appearance of a type parameter (counting pointers, references and parameterized types), plus the number of assertions.
    549 A higher specialization level is favoured if argument conversion costs are equal.
    550 
    551 \item
    552 Coercion of pointer types is only allowed in explicit cast expressions;
    553 the only allowed implicit pointer casts are adding qualifiers to the base type and cast to @void*@, and these counts as safe conversions.
    554 Note that implicit cast from @void *@ to other pointer types is no longer valid, as opposed to standard C.
     533Conversion to a type denoted by parameter may incur additional cost if the match is not exact. For example, if a function is declared to accept @(T, T)@ and receives @(int, long)@, @T@ is deducted @long@ and an additional widening conversion cost is added for @int@ to @T@.
     534
     535\item
     536The specialization level of a function is the sum of the least depth of an appearance of type parameter (counting pointers, references and parameterized types), plus the number of assertions. A higher specialization level is favored if conversion cost of arguments are equal.
     537
     538\item
     539Coercion of pointer types is only allowed in explicit cast expressions; the only allowed implicit pointer casts are adding qualifiers to the base type and cast to @void*@, and those counts as safe conversions. Note that implicit cast from @void*@ to other pointer types is no longer valid, as opposed to standard C.
     540
    555541\end{enumerate}
    556542
     
    570556At the call site, implicit parameters are automatically inserted by the compiler.
    571557
    572 Implementation of implicit parameters is discussed in \VRef[Appendix]{s:ImplementationParametricFunctions}.
     558Implementation of implicit parameters is discussed in Appendix A.3.
    573559
    574560\section{Tests}
     
    611597It is suggested to run performance tests with optimization (@g++@ flag @-O3@).
    612598
    613 
    614 \begin{appendices}[toc,titletoc]
    615599\section{Appendix}
    616600
    617 
    618601\subsection{Kinds of Type Parameters}
    619 \label{s:KindsTypeParameters}
    620 
    621 A type parameter in a @forall@ clause has three possible kinds:
    622 \begin{enumerate}[listparindent=0pt]
    623 \item
    624 @dtype@: any data type (built-in or user defined).
    625 
    626 There is also a difference between opaque types (incomplete types, \ie those with only a forward declaration) and concrete types.
    627 Only concrete types can be directly used as a variable type.
    628 
    629 \CFA provides the @otype@ shorthand to require a type parameter be concrete, which also implicitly asserts the existence of its default and copy constructors, assignment, and destructor\footnote{\CFA implements the same automatic resource management (RAII) semantics as \CC.}.
    630 \item
    631 @ftype@: any function type.
    632 
    633 @ftype@ provides two purposes:
    634 \begin{itemize}
    635 \item
    636 Differentiate function pointer from data pointer because (in theory) some systems have different sizes for these pointers.
    637 \item
    638 Disallow a function pointer to match an overloaded data pointer, since variables and functions can have the same names.
    639 \end{itemize}
    640 
    641 \item
    642 @ttype@: tuple (variadic) type.
    643 
    644 @ttype@ parameter may only appear as type of the last parameter in a function, and it provides a type-safe way to implement variadic functions.
    645 Note however, that it has certain restrictions, as described in the implementation section below.
     602The type parameters in a @forall@ clause has three different kinds:
     603\begin{enumerate}
     604\item
     605@dtype@: any data type (built-in or user defined). There is also a difference between opaque types (incomplete types, those with only a forward declaration) and concrete types. Only concrete types can be directly used as a variable type. \CFA provides the @otype@ shorthand to require a type parameter as concrete, which also implicitly asserts the existence of its constructor and destructor\footnote{\CFA implements the same automatic resource management (RAII) semantics as \CC.}.
     606\item
     607@ftype@: any function type. Since @ftype@ does not provide any information about parameter types of a function, it is rarely used. The main purpose of introducing @ftype@ is to disallow a function to match a pointer overload, since variables and functions can have the same names.
     608\item
     609@ttype@: tuple (variadic) type. @ttype@ parameter may only appear as type of the last parameter in a function, and it provides a type-safe way to implement variadic functions. Note however, that it has certain restrictions, as described in the implementation section below.
     610
    646611\end{enumerate}
    647612
    648 
    649613\subsection{GNU C Nested Functions}
    650614
     
    652616
    653617In ISO C, function definitions are not allowed to be nested. GCC allows nested functions with full lexical scoping. The following example is taken from GCC documentation\footnote{\url{https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html}}:
    654 \begin{C++}
    655 void bar( int * array, int offset, int size ) {
    656         int access( int * array, int index ) { return array[index + offset]; }
    657         int i;
    658         /* ... */
    659         for ( i = 0; i < size; i++ )
    660                 /* ... */ access (array, i) /* ... */
     618
     619\begin{C++}
     620bar (int *array, int offset, int size)
     621{
     622  int access (int *array, int index)
     623    { return array[index + offset]; }
     624  int i;
     625  /* ... */
     626  for (i = 0; i < size; i++)
     627    /* ... */ access (array, i) /* ... */
    661628}
    662629\end{C++}
    663 GCC nested functions behave identically to \CC lambda functions with default by-reference capture (stack-allocated, lifetime ends upon exiting the declared block), while also possible to be passed as arguments with standard function pointer types.
    664 
     630
     631GCC nested functions behave identically to \CC lambda functions with default by-reference capture (stack-allocated, lifetime ends upon exiting the block declared in), while also possible to be passed as arguments with standard function pointer types.
    665632
    666633\subsection{Implementation of Parametric Functions}
    667 \label{s:ImplementationParametricFunctions}
    668 
    669 \CFA implements parametric functions using the implicit parameter approach: required assertions are passed to the callee by function pointers;
    670 size of a parametric type must also be known if referenced directly (\ie not as a pointer).
     634\CFA implements parametric functions using the implicit parameter approach: required assertions are passed to the callee by function pointers; size of a parametric type must also be known if referenced directly (i.e. not as a pointer).
    671635
    672636The implementation is similar to the one from Scala\footnote{\url{https://www.scala-lang.org/files/archive/spec/2.13/07-implicits.html}}, with some notable differences in resolution:
     
    677641The parameter (assertion) name must match the actual declarations.
    678642\item
    679 Currently, assertions are all functions.
    680 Note that since \CFA has variable overloading, implicit value parameters might also be supported in the future.
     643Currently, assertions are all functions. Note that since \CFA has variable overloading, implicit value parameters might also be supported in the future.
    681644\end{enumerate}
    682645
    683646For example, the \CFA function declaration
     647
    684648\begin{cfa}
    685 forall( otype T | { int foo( T, int ); } )
     649forall(otype T | {int foo(T, int);})
    686650int bar(T);
    687651\end{cfa}
     652
    688653after implicit parameter expansion, has the actual signature\footnote{\textbf{otype} also requires the type to have constructor and destructor, which are the first two function pointers preceding the one for \textbf{foo}.}
    689 \begin{C++}
    690 int bar( T, size_t, void (*)(T&), void (*)(T&), int (*)(T, int) );
    691 \end{C++}
    692 The implicit parameter approach has an apparent issue: when the satisfying declaration is also parametric, it may require its own implicit parameters too.
    693 That also causes the supplied implicit parameter to have a different \textbf{actual} type than the \textbf{nominal} type, so it cannot be passed directly.
    694 Therefore, a wrapper with matching actual type must be created, and it is here where GCC nested functions are used internally by the compiler.
     654
     655\begin{C++}
     656int bar(T, size_t, void (*)(T&), void (*)(T&), int (*)(T, int));
     657\end{C++}
     658
     659The implicit parameter approach has an apparent issue: when the satisfying declaration is also parametric, it may require its own implicit parameters too. That also causes the supplied implicit parameter to have a different \textbf{actual} type than the \textbf{nominal} type, so it cannot be passed directly. Therefore, a wrapper with matching actual type must be created, and here it is where GCC nested function is used internally by the compiler.
    695660
    696661Consider the following program:
     
    698663int assertion(int);
    699664
    700 forall( otype T | { int assertion(T); } )
     665forall (otype T | {int assertion(T);})
    701666void foo(T);
    702667
    703 forall(otype T | { void foo(T); } )
     668forall (otype T | {void foo(T);})
    704669void bar(T t) {
    705670        foo(t);
    706671}
    707672\end{cfa}
    708 The \CFA compiler translates the program to non-parametric form\footnote{In the final code output, \lstinline@T@ needs to be replaced by an opaque type, and arguments must be accessed by a frame pointer offset table, due to the unknown sizes. The presented code here is simplified for better understanding.}
     673
     674\CFA compiler translates the program to non-parametric form\footnote{In the final code output, T needs to be replaced by an opaque type, and arguments must be accessed by a frame pointer offset table, due to the unknown sizes. The presented code here is simplified for better understanding.}
     675
    709676\begin{C++}
    710677// ctor, dtor and size arguments are omitted
     
    715682}
    716683\end{C++}
     684
    717685However, when @bar(1)@ is called, @foo@ cannot be directly provided as an argument:
     686
    718687\begin{C++}
    719688bar(1, foo); // WRONG: foo has different actual type
    720689\end{C++}
     690
    721691and an additional step is required:
     692
    722693\begin{C++}
    723694{
    724695        void _foo_wrapper(int t) {
    725                 foo( t, assertion );
     696                foo(t, assertion);
    726697        }
    727         bar( 1, _foo_wrapper );
     698        bar(1, _foo_wrapper);
    728699}
    729700\end{C++}
    730 Nested assertions and implicit parameter creation may continue indefinitely.
    731 This issue is a limitation of implicit parameter implementation.
    732 In particular, polymorphic variadic recursion must be structural (\ie the number of arguments decreases in any possible recursive calls), otherwise code generation gets into an infinite loop.
    733 The \CFA compiler sets a limit on assertion depth and reports an error if assertion resolution does not terminate within the limit (as for \lstinline[language=C++]@templates@ in \CC).
    734 \end{appendices}
     701
     702Nested assertions and implicit parameter creation may continue indefinitely. This is a limitation of implicit parameter implementation. In particular, polymorphic variadic recursion must be structural (i.e. number of arguments decreases in any possible recursive calls), otherwise code generation gets into an infinite loop. \CFA compiler sets a limit on assertion depth and reports an error if assertion resolution does not terminate within the limit.
    735703
    736704\bibliographystyle{plain}
  • libcfa/src/limits.cfa

    r17b6fc9 r1c1395d  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 30 22:56:32 2020
    13 // Update Count     : 76
     12// Last Modified On : Thu Mar  1 16:22:51 2018
     13// Update Count     : 74
    1414//
    1515
     
    2323// Integral Constants
    2424
    25 signed char MIN = SCHAR_MIN;
    26 unsigned char MIN = 0;
    27 short int MIN = SHRT_MIN;
    28 unsigned short int MIN = 0;
    29 int MIN = INT_MIN;
    30 unsigned int MIN = 0;
    31 long int MIN = LONG_MIN;
    32 unsigned long int MIN = 0;
    33 long long int MIN = LLONG_MIN;
    34 unsigned long long int MIN = 0;
     25const signed char MIN = SCHAR_MIN;
     26const unsigned char MIN = 0;
     27const short int MIN = SHRT_MIN;
     28const unsigned short int MIN = 0;
     29const int MIN = INT_MIN;
     30const unsigned int MIN = 0;
     31const long int MIN = LONG_MIN;
     32const unsigned long int MIN = 0;
     33const long long int MIN = LLONG_MIN;
     34const unsigned long long int MIN = 0;
    3535
    36 signed char MAX = SCHAR_MAX;
    37 unsigned char MAX = UCHAR_MAX;
    38 short int MAX = SHRT_MAX;
    39 unsigned short int MAX = USHRT_MAX;
    40 int MAX = INT_MAX;
    41 unsigned int MAX = UINT_MAX;
    42 long int MAX = LONG_MAX;
    43 unsigned long int MAX = ULONG_MAX;
    44 long long int MAX = LLONG_MAX;
    45 unsigned long long int MAX = ULLONG_MAX;
     36const signed char MAX = SCHAR_MAX;
     37const unsigned char MAX = UCHAR_MAX;
     38const short int MAX = SHRT_MAX;
     39const unsigned short int MAX = USHRT_MAX;
     40const int MAX = INT_MAX;
     41const unsigned int MAX = UINT_MAX;
     42const long int MAX = LONG_MAX;
     43const unsigned long int MAX = ULONG_MAX;
     44const long long int MAX = LLONG_MAX;
     45const unsigned long long int MAX = ULLONG_MAX;
    4646
    4747// Floating-Point Constants
    4848
    49 float MIN = FLT_MIN;
    50 double MIN = DBL_MIN;
    51 long double MIN = LDBL_MIN;
    52 float _Complex MIN = __FLT_MIN__ + __FLT_MIN__ * I;
    53 double _Complex MIN = DBL_MIN +  DBL_MIN * I;
    54 long double _Complex MIN = LDBL_MIN + LDBL_MIN * I;
     49const float MIN = FLT_MIN;
     50const double MIN = DBL_MIN;
     51const long double MIN = LDBL_MIN;
     52const float _Complex MIN = __FLT_MIN__ + __FLT_MIN__ * I;
     53const double _Complex MIN = DBL_MIN +  DBL_MIN * I;
     54const long double _Complex MIN = LDBL_MIN + LDBL_MIN * I;
    5555
    56 float MAX = FLT_MAX;
    57 double MAX = DBL_MAX;
    58 long double MAX = LDBL_MAX;
    59 float _Complex MAX = FLT_MAX + FLT_MAX * I;
    60 double _Complex MAX = DBL_MAX + DBL_MAX * I;
    61 long double _Complex MAX = LDBL_MAX + LDBL_MAX * I;
     56const float MAX = FLT_MAX;
     57const double MAX = DBL_MAX;
     58const long double MAX = LDBL_MAX;
     59const float _Complex MAX = FLT_MAX + FLT_MAX * I;
     60const double _Complex MAX = DBL_MAX + DBL_MAX * I;
     61const long double _Complex MAX = LDBL_MAX + LDBL_MAX * I;
    6262
    63 float PI = (float)M_PI;                                                                 // pi
    64 float PI_2 = (float)M_PI_2;                                                             // pi / 2
    65 float PI_4 = (float)M_PI_4;                                                             // pi / 4
    66 float _1_PI = (float)M_1_PI;                                                    // 1 / pi
    67 float _2_PI = (float)M_2_PI;                                                    // 2 / pi
    68 float _2_SQRT_PI = (float)M_2_SQRTPI;                                   // 2 / sqrt(pi)
     63const float PI = (float)M_PI;                                                   // pi
     64const float PI_2 = (float)M_PI_2;                                               // pi / 2
     65const float PI_4 = (float)M_PI_4;                                               // pi / 4
     66const float _1_PI = (float)M_1_PI;                                              // 1 / pi
     67const float _2_PI = (float)M_2_PI;                                              // 2 / pi
     68const float _2_SQRT_PI = (float)M_2_SQRTPI;                             // 2 / sqrt(pi)
    6969
    70 double PI = M_PI;                                                                               // pi
    71 double PI_2 = M_PI_2;                                                                   // pi / 2
    72 double PI_4 = M_PI_4;                                                                   // pi / 4
    73 double _1_PI = M_1_PI;                                                                  // 1 / pi
    74 double _2_PI = M_2_PI;                                                                  // 2 / pi
    75 double _2_SQRT_PI = M_2_SQRTPI;                                                 // 2 / sqrt(pi)
     70const double PI = M_PI;                                                                 // pi
     71const double PI_2 = M_PI_2;                                                             // pi / 2
     72const double PI_4 = M_PI_4;                                                             // pi / 4
     73const double _1_PI = M_1_PI;                                                    // 1 / pi
     74const double _2_PI = M_2_PI;                                                    // 2 / pi
     75const double _2_SQRT_PI = M_2_SQRTPI;                                   // 2 / sqrt(pi)
    7676
    77 long double PI = M_PIl;                                                                 // pi
    78 long double PI_2 = M_PI_2l;                                                             // pi / 2
    79 long double PI_4 = M_PI_4l;                                                             // pi / 4
    80 long double _1_PI = M_1_PIl;                                                    // 1 / pi
    81 long double _2_PI = M_2_PIl;                                                    // 2 / pi
    82 long double _2_SQRT_PI = M_2_SQRTPIl;                                   // 2 / sqrt(pi)
     77const long double PI = M_PIl;                                                   // pi
     78const long double PI_2 = M_PI_2l;                                               // pi / 2
     79const long double PI_4 = M_PI_4l;                                               // pi / 4
     80const long double _1_PI = M_1_PIl;                                              // 1 / pi
     81const long double _2_PI = M_2_PIl;                                              // 2 / pi
     82const long double _2_SQRT_PI = M_2_SQRTPIl;                             // 2 / sqrt(pi)
    8383
    84 float _Complex PI = (float)M_PI + 0.0_iF;                               // pi
    85 float _Complex PI_2 = (float)M_PI_2 + 0.0_iF;                   // pi / 2
    86 float _Complex PI_4 = (float)M_PI_4 + 0.0_iF;                   // pi / 4
    87 float _Complex _1_PI = (float)M_1_PI + 0.0_iF;                  // 1 / pi
    88 float _Complex _2_PI = (float)M_2_PI + 0.0_iF;                  // 2 / pi
    89 float _Complex _2_SQRT_PI = (float)M_2_SQRTPI + 0.0_iF; // 2 / sqrt(pi)
     84const float _Complex PI = (float)M_PI + 0.0_iF;                 // pi
     85const float _Complex PI_2 = (float)M_PI_2 + 0.0_iF;             // pi / 2
     86const float _Complex PI_4 = (float)M_PI_4 + 0.0_iF;             // pi / 4
     87const float _Complex _1_PI = (float)M_1_PI + 0.0_iF;    // 1 / pi
     88const float _Complex _2_PI = (float)M_2_PI + 0.0_iF;    // 2 / pi
     89const float _Complex _2_SQRT_PI = (float)M_2_SQRTPI + 0.0_iF; // 2 / sqrt(pi)
    9090
    91 double _Complex PI = M_PI + 0.0_iD;                                             // pi
    92 double _Complex PI_2 = M_PI_2 + 0.0_iD;                                 // pi / 2
    93 double _Complex PI_4 = M_PI_4 + 0.0_iD;                                 // pi / 4
    94 double _Complex _1_PI = M_1_PI + 0.0_iD;                                // 1 / pi
    95 double _Complex _2_PI = M_2_PI + 0.0_iD;                                // 2 / pi
    96 double _Complex _2_SQRT_PI = M_2_SQRTPI + 0.0_iD;               // 2 / sqrt(pi)
     91const double _Complex PI = M_PI + 0.0_iD;                               // pi
     92const double _Complex PI_2 = M_PI_2 + 0.0_iD;                   // pi / 2
     93const double _Complex PI_4 = M_PI_4 + 0.0_iD;                   // pi / 4
     94const double _Complex _1_PI = M_1_PI + 0.0_iD;                  // 1 / pi
     95const double _Complex _2_PI = M_2_PI + 0.0_iD;                  // 2 / pi
     96const double _Complex _2_SQRT_PI = M_2_SQRTPI + 0.0_iD; // 2 / sqrt(pi)
    9797
    98 long double _Complex PI = M_PIl + 0.0_iL;                               // pi
    99 long double _Complex PI_2 = M_PI_2l + 0.0_iL;                   // pi / 2
    100 long double _Complex PI_4 = M_PI_4l + 0.0_iL;                   // pi / 4
    101 long double _Complex _1_PI = M_1_PIl + 0.0_iL;                  // 1 / pi
    102 long double _Complex _2_PI = M_2_PIl + 0.0_iL;                  // 2 / pi
    103 long double _Complex _2_SQRT_PI = M_2_SQRTPIl + 0.0_iL; // 2 / sqrt(pi)
     98const long double _Complex PI = M_PIl + 0.0_iL;                 // pi
     99const long double _Complex PI_2 = M_PI_2l + 0.0_iL;             // pi / 2
     100const long double _Complex PI_4 = M_PI_4l + 0.0_iL;             // pi / 4
     101const long double _Complex _1_PI = M_1_PIl + 0.0_iL;    // 1 / pi
     102const long double _Complex _2_PI = M_2_PIl + 0.0_iL;    // 2 / pi
     103const long double _Complex _2_SQRT_PI = M_2_SQRTPIl + 0.0_iL; // 2 / sqrt(pi)
    104104
    105 float E = (float)M_E;                                                                   // e
    106 float LOG2_E = (float)M_LOG2E;                                                  // log_2(e)
    107 float LOG10_E = (float)M_LOG10E;                                                // log_10(e)
    108 float LN_2 = (float)M_LN2;                                                              // log_e(2)
    109 float LN_10 = (float)M_LN10;                                                    // log_e(10)
    110 float SQRT_2 = (float)M_SQRT2;                                                  // sqrt(2)
    111 float _1_SQRT_2 = (float)M_SQRT1_2;                                             // 1 / sqrt(2)
     105const float E = (float)M_E;                                                             // e
     106const float LOG2_E = (float)M_LOG2E;                                    // log_2(e)
     107const float LOG10_E = (float)M_LOG10E;                                  // log_10(e)
     108const float LN_2 = (float)M_LN2;                                                // log_e(2)
     109const float LN_10 = (float)M_LN10;                                              // log_e(10)
     110const float SQRT_2 = (float)M_SQRT2;                                    // sqrt(2)
     111const float _1_SQRT_2 = (float)M_SQRT1_2;                               // 1 / sqrt(2)
    112112
    113 double E = M_E;                                                                                 // e
    114 double LOG2_E = M_LOG2E;                                                                // log_2(e)
    115 double LOG10_E = M_LOG10E;                                                              // log_10(e)
    116 double LN_2 = M_LN2;                                                                    // log_e(2)
    117 double LN_10 = M_LN10;                                                                  // log_e(10)
    118 double SQRT_2 = M_SQRT2;                                                                // sqrt(2)
    119 double _1_SQRT_2 = M_SQRT1_2;                                                   // 1 / sqrt(2)
     113const double E = M_E;                                                                   // e
     114const double LOG2_E = M_LOG2E;                                                  // log_2(e)
     115const double LOG10_E = M_LOG10E;                                                // log_10(e)
     116const double LN_2 = M_LN2;                                                              // log_e(2)
     117const double LN_10 = M_LN10;                                                    // log_e(10)
     118const double SQRT_2 = M_SQRT2;                                                  // sqrt(2)
     119const double _1_SQRT_2 = M_SQRT1_2;                                             // 1 / sqrt(2)
    120120
    121 long double E = M_El;                                                                   // e
    122 long double LOG2_E = M_LOG2El;                                                  // log_2(e)
    123 long double LOG10_E = M_LOG10El;                                                // log_10(e)
    124 long double LN_2 = M_LN2l;                                                              // log_e(2)
    125 long double LN_10 = M_LN10l;                                                    // log_e(10)
    126 long double SQRT_2 = M_SQRT2l;                                                  // sqrt(2)
    127 long double _1_SQRT_2 = M_SQRT1_2l;                                             // 1 / sqrt(2)
     121const long double E = M_El;                                                             // e
     122const long double LOG2_E = M_LOG2El;                                    // log_2(e)
     123const long double LOG10_E = M_LOG10El;                                  // log_10(e)
     124const long double LN_2 = M_LN2l;                                                // log_e(2)
     125const long double LN_10 = M_LN10l;                                              // log_e(10)
     126const long double SQRT_2 = M_SQRT2l;                                    // sqrt(2)
     127const long double _1_SQRT_2 = M_SQRT1_2l;                               // 1 / sqrt(2)
    128128
    129 float _Complex E = M_E + 0.0_iF;                                                // e
    130 float _Complex LOG2_E = M_LOG2E + 0.0_iF;                               // log_2(e)
    131 float _Complex LOG10_E = M_LOG10E + 0.0_iF;                             // log_10(e)
    132 float _Complex LN_2 = M_LN2 + 0.0_iF;                                   // log_e(2)
    133 float _Complex LN_10 = M_LN10 + 0.0_iF;                                 // log_e(10)
    134 float _Complex SQRT_2 = M_SQRT2 + 0.0_iF;                               // sqrt(2)
    135 float _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iF;                  // 1 / sqrt(2)
     129const float _Complex E = M_E + 0.0_iF;                                  // e
     130const float _Complex LOG2_E = M_LOG2E + 0.0_iF;                 // log_2(e)
     131const float _Complex LOG10_E = M_LOG10E + 0.0_iF;               // log_10(e)
     132const float _Complex LN_2 = M_LN2 + 0.0_iF;                             // log_e(2)
     133const float _Complex LN_10 = M_LN10 + 0.0_iF;                   // log_e(10)
     134const float _Complex SQRT_2 = M_SQRT2 + 0.0_iF;                 // sqrt(2)
     135const float _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iF;    // 1 / sqrt(2)
    136136
    137 double _Complex E = M_E + 0.0_iD;                                               // e
    138 double _Complex LOG2_E = M_LOG2E + 0.0_iD;                              // log_2(e)
    139 double _Complex LOG10_E = M_LOG10E + 0.0_iD;                    // log_10(e)
    140 double _Complex LN_2 = M_LN2 + 0.0_iD;                                  // log_e(2)
    141 double _Complex LN_10 = M_LN10 + 0.0_iD;                                // log_e(10)
    142 double _Complex SQRT_2 = M_SQRT2 + 0.0_iD;                              // sqrt(2)
    143 double _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iD;                 // 1 / sqrt(2)
     137const double _Complex E = M_E + 0.0_iD;                                 // e
     138const double _Complex LOG2_E = M_LOG2E + 0.0_iD;                // log_2(e)
     139const double _Complex LOG10_E = M_LOG10E + 0.0_iD;              // log_10(e)
     140const double _Complex LN_2 = M_LN2 + 0.0_iD;                    // log_e(2)
     141const double _Complex LN_10 = M_LN10 + 0.0_iD;                  // log_e(10)
     142const double _Complex SQRT_2 = M_SQRT2 + 0.0_iD;                // sqrt(2)
     143const double _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iD;   // 1 / sqrt(2)
    144144
    145 long double _Complex E = M_El + 0.0_iL;                                 // e
    146 long double _Complex LOG2_E = M_LOG2El + 0.0_iL;                // log_2(e)
    147 long double _Complex LOG10_E = M_LOG10El + 0.0_iL;              // log_10(e)
    148 long double _Complex LN_2 = M_LN2l + 0.0_iL;                    // log_e(2)
    149 long double _Complex LN_10 = M_LN10l + 0.0_iL;                  // log_e(10)
    150 long double _Complex SQRT_2 = M_SQRT2l + 0.0_iL;                // sqrt(2)
    151 long double _Complex _1_SQRT_2 = M_SQRT1_2l + 0.0_iL;   // 1 / sqrt(2)
     145const long double _Complex E = M_El + 0.0_iL;                   // e
     146const long double _Complex LOG2_E = M_LOG2El + 0.0_iL;  // log_2(e)
     147const long double _Complex LOG10_E = M_LOG10El + 0.0_iL; // log_10(e)
     148const long double _Complex LN_2 = M_LN2l + 0.0_iL;              // log_e(2)
     149const long double _Complex LN_10 = M_LN10l + 0.0_iL;    // log_e(10)
     150const long double _Complex SQRT_2 = M_SQRT2l + 0.0_iL;  // sqrt(2)
     151const long double _Complex _1_SQRT_2 = M_SQRT1_2l + 0.0_iL; // 1 / sqrt(2)
    152152
    153153// Local Variables: //
  • libcfa/src/limits.hfa

    r17b6fc9 r1c1395d  
    1010// Created On       : Wed Apr  6 18:06:52 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Sep 30 22:56:35 2020
    13 // Update Count     : 15
     12// Last Modified On : Thu Mar  1 16:20:54 2018
     13// Update Count     : 13
    1414//
    1515
     
    1818// Integral Constants
    1919
    20 extern signed char MIN;
    21 extern unsigned char MIN;
    22 extern short int MIN;
    23 extern unsigned short int MIN;
    24 extern int MIN;
    25 extern unsigned int MIN;
    26 extern long int MIN;
    27 extern unsigned long int MIN;
    28 extern long long int MIN;
    29 extern unsigned long long int MIN;
     20extern const signed char MIN;
     21extern const unsigned char MIN;
     22extern const short int MIN;
     23extern const unsigned short int MIN;
     24extern const int MIN;
     25extern const unsigned int MIN;
     26extern const long int MIN;
     27extern const unsigned long int MIN;
     28extern const long long int MIN;
     29extern const unsigned long long int MIN;
    3030
    31 extern signed char MAX;
    32 extern unsigned char MAX;
    33 extern short int MAX;
    34 extern unsigned short int MAX;
    35 extern int MAX;
    36 extern unsigned int MAX;
    37 extern long int MAX;
    38 extern unsigned long int MAX;
    39 extern long long int MAX;
    40 extern unsigned long long int MAX;
     31extern const signed char MAX;
     32extern const unsigned char MAX;
     33extern const short int MAX;
     34extern const unsigned short int MAX;
     35extern const int MAX;
     36extern const unsigned int MAX;
     37extern const long int MAX;
     38extern const unsigned long int MAX;
     39extern const long long int MAX;
     40extern const unsigned long long int MAX;
    4141
    4242// Floating-Point Constants
    4343
    44 extern float MIN;
    45 extern double MIN;
    46 extern long double MIN;
    47 extern float _Complex MIN;
    48 extern double _Complex MIN;
    49 extern long double _Complex MIN;
     44extern const float MIN;
     45extern const double MIN;
     46extern const long double MIN;
     47extern const float _Complex MIN;
     48extern const double _Complex MIN;
     49extern const long double _Complex MIN;
    5050
    51 extern float MAX;
    52 extern double MAX;
    53 extern long double MAX;
    54 extern float _Complex MAX;
    55 extern double _Complex MAX;
    56 extern long double _Complex MAX;
     51extern const float MAX;
     52extern const double MAX;
     53extern const long double MAX;
     54extern const float _Complex MAX;
     55extern const double _Complex MAX;
     56extern const long double _Complex MAX;
    5757
    58 extern float PI;                                                                                // pi
    59 extern float PI_2;                                                                              // pi / 2
    60 extern float PI_4;                                                                              // pi / 4
    61 extern float _1_PI;                                                                             // 1 / pi
    62 extern float _2_PI;                                                                             // 2 / pi
    63 extern float _2_SQRT_PI;                                                                // 2 / sqrt(pi)
     58extern const float PI;                                                                  // pi
     59extern const float PI_2;                                                                // pi / 2
     60extern const float PI_4;                                                                // pi / 4
     61extern const float _1_PI;                                                               // 1 / pi
     62extern const float _2_PI;                                                               // 2 / pi
     63extern const float _2_SQRT_PI;                                                  // 2 / sqrt(pi)
    6464
    65 extern double PI;                                                                               // pi
    66 extern double PI_2;                                                                             // pi / 2
    67 extern double PI_4;                                                                             // pi / 4
    68 extern double _1_PI;                                                                    // 1 / pi
    69 extern double _2_PI;                                                                    // 2 / pi
    70 extern double _2_SQRT_PI;                                                               // 2 / sqrt(pi)
     65extern const double PI;                                                                 // pi
     66extern const double PI_2;                                                               // pi / 2
     67extern const double PI_4;                                                               // pi / 4
     68extern const double _1_PI;                                                              // 1 / pi
     69extern const double _2_PI;                                                              // 2 / pi
     70extern const double _2_SQRT_PI;                                                 // 2 / sqrt(pi)
    7171
    72 extern long double PI;                                                                  // pi
    73 extern long double PI_2;                                                                // pi / 2
    74 extern long double PI_4;                                                                // pi / 4
    75 extern long double _1_PI;                                                               // 1 / pi
    76 extern long double _2_PI;                                                               // 2 / pi
    77 extern long double _2_SQRT_PI;                                                  // 2 / sqrt(pi)
     72extern const long double PI;                                                    // pi
     73extern const long double PI_2;                                                  // pi / 2
     74extern const long double PI_4;                                                  // pi / 4
     75extern const long double _1_PI;                                                 // 1 / pi
     76extern const long double _2_PI;                                                 // 2 / pi
     77extern const long double _2_SQRT_PI;                                    // 2 / sqrt(pi)
    7878
    79 extern float _Complex PI;                                                               // pi
    80 extern float _Complex PI_2;                                                             // pi / 2
    81 extern float _Complex PI_4;                                                             // pi / 4
    82 extern float _Complex _1_PI;                                                    // 1 / pi
    83 extern float _Complex _2_PI;                                                    // 2 / pi
    84 extern float _Complex _2_SQRT_PI;                                               // 2 / sqrt(pi)
     79extern const float _Complex PI;                                                 // pi
     80extern const float _Complex PI_2;                                               // pi / 2
     81extern const float _Complex PI_4;                                               // pi / 4
     82extern const float _Complex _1_PI;                                              // 1 / pi
     83extern const float _Complex _2_PI;                                              // 2 / pi
     84extern const float _Complex _2_SQRT_PI;                                 // 2 / sqrt(pi)
    8585
    86 extern double _Complex PI;                                                              // pi
    87 extern double _Complex PI_2;                                                    // pi / 2
    88 extern double _Complex PI_4;                                                    // pi / 4
    89 extern double _Complex _1_PI;                                                   // 1 / pi
    90 extern double _Complex _2_PI;                                                   // 2 / pi
    91 extern double _Complex _2_SQRT_PI;                                              // 2 / sqrt(pi)
     86extern const double _Complex PI;                                                // pi
     87extern const double _Complex PI_2;                                              // pi / 2
     88extern const double _Complex PI_4;                                              // pi / 4
     89extern const double _Complex _1_PI;                                             // 1 / pi
     90extern const double _Complex _2_PI;                                             // 2 / pi
     91extern const double _Complex _2_SQRT_PI;                                // 2 / sqrt(pi)
    9292
    93 extern long double _Complex PI;                                                 // pi
    94 extern long double _Complex PI_2;                                               // pi / 2
    95 extern long double _Complex PI_4;                                               // pi / 4
    96 extern long double _Complex _1_PI;                                              // 1 / pi
    97 extern long double _Complex _2_PI;                                              // 2 / pi
    98 extern long double _Complex _2_SQRT_PI;                                 // 2 / sqrt(pi)
     93extern const long double _Complex PI;                                   // pi
     94extern const long double _Complex PI_2;                                 // pi / 2
     95extern const long double _Complex PI_4;                                 // pi / 4
     96extern const long double _Complex _1_PI;                                // 1 / pi
     97extern const long double _Complex _2_PI;                                // 2 / pi
     98extern const long double _Complex _2_SQRT_PI;                   // 2 / sqrt(pi)
    9999
    100 extern float E;                                                                                 // e
    101 extern float LOG2_E;                                                                    // log_2(e)
    102 extern float LOG10_E;                                                                   // log_10(e)
    103 extern float LN_2;                                                                              // log_e(2)
    104 extern float LN_10;                                                                             // log_e(10)
    105 extern float SQRT_2;                                                                    // sqrt(2)
    106 extern float _1_SQRT_2;                                                                 // 1 / sqrt(2)
     100extern const float E;                                                                   // e
     101extern const float LOG2_E;                                                              // log_2(e)
     102extern const float LOG10_E;                                                             // log_10(e)
     103extern const float LN_2;                                                                // log_e(2)
     104extern const float LN_10;                                                               // log_e(10)
     105extern const float SQRT_2;                                                              // sqrt(2)
     106extern const float _1_SQRT_2;                                                   // 1 / sqrt(2)
    107107
    108 extern double E;                                                                                // e
    109 extern double LOG2_E;                                                                   // log_2(e)
    110 extern double LOG10_E;                                                                  // log_10(e)
    111 extern double LN_2;                                                                             // log_e(2)
    112 extern double LN_10;                                                                    // log_e(10)
    113 extern double SQRT_2;                                                                   // sqrt(2)
    114 extern double _1_SQRT_2;                                                                // 1 / sqrt(2)
     108extern const double E;                                                                  // e
     109extern const double LOG2_E;                                                             // log_2(e)
     110extern const double LOG10_E;                                                    // log_10(e)
     111extern const double LN_2;                                                               // log_e(2)
     112extern const double LN_10;                                                              // log_e(10)
     113extern const double SQRT_2;                                                             // sqrt(2)
     114extern const double _1_SQRT_2;                                                  // 1 / sqrt(2)
    115115
    116 extern long double E;                                                                   // e
    117 extern long double LOG2_E;                                                              // log_2(e)
    118 extern long double LOG10_E;                                                             // log_10(e)
    119 extern long double LN_2;                                                                // log_e(2)
    120 extern long double LN_10;                                                               // log_e(10)
    121 extern long double SQRT_2;                                                              // sqrt(2)
    122 extern long double _1_SQRT_2;                                                   // 1/sqrt(2)
     116extern const long double E;                                                             // e
     117extern const long double LOG2_E;                                                // log_2(e)
     118extern const long double LOG10_E;                                               // log_10(e)
     119extern const long double LN_2;                                                  // log_e(2)
     120extern const long double LN_10;                                                 // log_e(10)
     121extern const long double SQRT_2;                                                // sqrt(2)
     122extern const long double _1_SQRT_2;                                             // 1/sqrt(2)
    123123
    124 extern float _Complex E;                                                                // e
    125 extern float _Complex LOG2_E;                                                   // log_2(e)
    126 extern float _Complex LOG10_E;                                                  // log_10(e)
    127 extern float _Complex LN_2;                                                             // log_e(2)
    128 extern float _Complex LN_10;                                                    // log_e(10)
    129 extern float _Complex SQRT_2;                                                   // sqrt(2)
    130 extern float _Complex _1_SQRT_2;                                                // 1 / sqrt(2)
     124extern const float _Complex E;                                                  // e
     125extern const float _Complex LOG2_E;                                             // log_2(e)
     126extern const float _Complex LOG10_E;                                    // log_10(e)
     127extern const float _Complex LN_2;                                               // log_e(2)
     128extern const float _Complex LN_10;                                              // log_e(10)
     129extern const float _Complex SQRT_2;                                             // sqrt(2)
     130extern const float _Complex _1_SQRT_2;                                  // 1 / sqrt(2)
    131131
    132 extern double _Complex E;                                                               // e
    133 extern double _Complex LOG2_E;                                                  // log_2(e)
    134 extern double _Complex LOG10_E;                                                 // log_10(e)
    135 extern double _Complex LN_2;                                                    // log_e(2)
    136 extern double _Complex LN_10;                                                   // log_e(10)
    137 extern double _Complex SQRT_2;                                                  // sqrt(2)
    138 extern double _Complex _1_SQRT_2;                                               // 1 / sqrt(2)
     132extern const double _Complex E;                                                 // e
     133extern const double _Complex LOG2_E;                                    // log_2(e)
     134extern const double _Complex LOG10_E;                                   // log_10(e)
     135extern const double _Complex LN_2;                                              // log_e(2)
     136extern const double _Complex LN_10;                                             // log_e(10)
     137extern const double _Complex SQRT_2;                                    // sqrt(2)
     138extern const double _Complex _1_SQRT_2;                                 // 1 / sqrt(2)
    139139
    140 extern long double _Complex E;                                                  // e
    141 extern long double _Complex LOG2_E;                                             // log_2(e)
    142 extern long double _Complex LOG10_E;                                    // log_10(e)
    143 extern long double _Complex LN_2;                                               // log_e(2)
    144 extern long double _Complex LN_10;                                              // log_e(10)
    145 extern long double _Complex SQRT_2;                                             // sqrt(2)
    146 extern long double _Complex _1_SQRT_2;                                  // 1 / sqrt(2)
     140extern const long double _Complex E;                                    // e
     141extern const long double _Complex LOG2_E;                               // log_2(e)
     142extern const long double _Complex LOG10_E;                              // log_10(e)
     143extern const long double _Complex LN_2;                                 // log_e(2)
     144extern const long double _Complex LN_10;                                // log_e(10)
     145extern const long double _Complex SQRT_2;                               // sqrt(2)
     146extern const long double _Complex _1_SQRT_2;                    // 1 / sqrt(2)
    147147
    148148// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.