[53ba273] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 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 | // limits.c -- |
---|
| 8 | // |
---|
| 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Wed Apr 6 18:06:52 2016 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[2701c91] | 12 | // Last Modified On : Thu Mar 1 16:22:51 2018 |
---|
| 13 | // Update Count : 74 |
---|
[53ba273] | 14 | // |
---|
| 15 | |
---|
[2701c91] | 16 | #include <limits.h> |
---|
| 17 | #include <float.h> |
---|
| 18 | #define __USE_GNU // get M_* constants |
---|
| 19 | #include <math.h> |
---|
| 20 | #include <complex.h> |
---|
[3d9b5da] | 21 | #include "limits" |
---|
[53ba273] | 22 | |
---|
| 23 | // Integral Constants |
---|
| 24 | |
---|
[2701c91] | 25 | const signed char MIN = SCHAR_MIN; |
---|
| 26 | const unsigned char MIN = 0; |
---|
| 27 | const short int MIN = SHRT_MIN; |
---|
| 28 | const unsigned short int MIN = 0; |
---|
| 29 | const int MIN = INT_MIN; |
---|
| 30 | const unsigned int MIN = 0; |
---|
| 31 | const long int MIN = LONG_MIN; |
---|
| 32 | const unsigned long int MIN = 0; |
---|
| 33 | const long long int MIN = LLONG_MIN; |
---|
| 34 | const unsigned long long int MIN = 0; |
---|
| 35 | |
---|
| 36 | const signed char MAX = SCHAR_MAX; |
---|
| 37 | const unsigned char MAX = UCHAR_MAX; |
---|
| 38 | const short int MAX = SHRT_MAX; |
---|
| 39 | const unsigned short int MAX = USHRT_MAX; |
---|
| 40 | const int MAX = INT_MAX; |
---|
| 41 | const unsigned int MAX = UINT_MAX; |
---|
| 42 | const long int MAX = LONG_MAX; |
---|
| 43 | const unsigned long int MAX = ULONG_MAX; |
---|
| 44 | const long long int MAX = LLONG_MAX; |
---|
| 45 | const unsigned long long int MAX = ULLONG_MAX; |
---|
[53ba273] | 46 | |
---|
| 47 | // Floating-Point Constants |
---|
| 48 | |
---|
[2701c91] | 49 | const float MIN = FLT_MIN; |
---|
| 50 | const double MIN = DBL_MIN; |
---|
| 51 | const long double MIN = LDBL_MIN; |
---|
| 52 | const float _Complex MIN = __FLT_MIN__ + __FLT_MIN__ * I; |
---|
| 53 | const double _Complex MIN = DBL_MIN + DBL_MIN * I; |
---|
| 54 | const long double _Complex MIN = LDBL_MIN + LDBL_MIN * I; |
---|
| 55 | |
---|
| 56 | const float MAX = FLT_MAX; |
---|
| 57 | const double MAX = DBL_MAX; |
---|
| 58 | const long double MAX = LDBL_MAX; |
---|
| 59 | const float _Complex MAX = FLT_MAX + FLT_MAX * I; |
---|
| 60 | const double _Complex MAX = DBL_MAX + DBL_MAX * I; |
---|
| 61 | const long double _Complex MAX = LDBL_MAX + LDBL_MAX * I; |
---|
| 62 | |
---|
| 63 | const float PI = (float)M_PI; // pi |
---|
| 64 | const float PI_2 = (float)M_PI_2; // pi / 2 |
---|
| 65 | const float PI_4 = (float)M_PI_4; // pi / 4 |
---|
| 66 | const float _1_PI = (float)M_1_PI; // 1 / pi |
---|
| 67 | const float _2_PI = (float)M_2_PI; // 2 / pi |
---|
| 68 | const float _2_SQRT_PI = (float)M_2_SQRTPI; // 2 / sqrt(pi) |
---|
| 69 | |
---|
| 70 | const double PI = M_PI; // pi |
---|
| 71 | const double PI_2 = M_PI_2; // pi / 2 |
---|
| 72 | const double PI_4 = M_PI_4; // pi / 4 |
---|
| 73 | const double _1_PI = M_1_PI; // 1 / pi |
---|
| 74 | const double _2_PI = M_2_PI; // 2 / pi |
---|
| 75 | const double _2_SQRT_PI = M_2_SQRTPI; // 2 / sqrt(pi) |
---|
| 76 | |
---|
| 77 | const long double PI = M_PIl; // pi |
---|
| 78 | const long double PI_2 = M_PI_2l; // pi / 2 |
---|
| 79 | const long double PI_4 = M_PI_4l; // pi / 4 |
---|
| 80 | const long double _1_PI = M_1_PIl; // 1 / pi |
---|
| 81 | const long double _2_PI = M_2_PIl; // 2 / pi |
---|
| 82 | const long double _2_SQRT_PI = M_2_SQRTPIl; // 2 / sqrt(pi) |
---|
| 83 | |
---|
| 84 | const float _Complex PI = (float)M_PI + 0.0_iF; // pi |
---|
| 85 | const float _Complex PI_2 = (float)M_PI_2 + 0.0_iF; // pi / 2 |
---|
| 86 | const float _Complex PI_4 = (float)M_PI_4 + 0.0_iF; // pi / 4 |
---|
| 87 | const float _Complex _1_PI = (float)M_1_PI + 0.0_iF; // 1 / pi |
---|
| 88 | const float _Complex _2_PI = (float)M_2_PI + 0.0_iF; // 2 / pi |
---|
| 89 | const float _Complex _2_SQRT_PI = (float)M_2_SQRTPI + 0.0_iF; // 2 / sqrt(pi) |
---|
| 90 | |
---|
| 91 | const double _Complex PI = M_PI + 0.0_iD; // pi |
---|
| 92 | const double _Complex PI_2 = M_PI_2 + 0.0_iD; // pi / 2 |
---|
| 93 | const double _Complex PI_4 = M_PI_4 + 0.0_iD; // pi / 4 |
---|
| 94 | const double _Complex _1_PI = M_1_PI + 0.0_iD; // 1 / pi |
---|
| 95 | const double _Complex _2_PI = M_2_PI + 0.0_iD; // 2 / pi |
---|
| 96 | const double _Complex _2_SQRT_PI = M_2_SQRTPI + 0.0_iD; // 2 / sqrt(pi) |
---|
| 97 | |
---|
| 98 | const long double _Complex PI = M_PIl + 0.0_iL; // pi |
---|
| 99 | const long double _Complex PI_2 = M_PI_2l + 0.0_iL; // pi / 2 |
---|
| 100 | const long double _Complex PI_4 = M_PI_4l + 0.0_iL; // pi / 4 |
---|
| 101 | const long double _Complex _1_PI = M_1_PIl + 0.0_iL; // 1 / pi |
---|
| 102 | const long double _Complex _2_PI = M_2_PIl + 0.0_iL; // 2 / pi |
---|
| 103 | const long double _Complex _2_SQRT_PI = M_2_SQRTPIl + 0.0_iL; // 2 / sqrt(pi) |
---|
| 104 | |
---|
| 105 | const float E = (float)M_E; // e |
---|
| 106 | const float LOG2_E = (float)M_LOG2E; // log_2(e) |
---|
| 107 | const float LOG10_E = (float)M_LOG10E; // log_10(e) |
---|
| 108 | const float LN_2 = (float)M_LN2; // log_e(2) |
---|
| 109 | const float LN_10 = (float)M_LN10; // log_e(10) |
---|
| 110 | const float SQRT_2 = (float)M_SQRT2; // sqrt(2) |
---|
| 111 | const float _1_SQRT_2 = (float)M_SQRT1_2; // 1 / sqrt(2) |
---|
| 112 | |
---|
| 113 | const double E = M_E; // e |
---|
| 114 | const double LOG2_E = M_LOG2E; // log_2(e) |
---|
| 115 | const double LOG10_E = M_LOG10E; // log_10(e) |
---|
| 116 | const double LN_2 = M_LN2; // log_e(2) |
---|
| 117 | const double LN_10 = M_LN10; // log_e(10) |
---|
| 118 | const double SQRT_2 = M_SQRT2; // sqrt(2) |
---|
| 119 | const double _1_SQRT_2 = M_SQRT1_2; // 1 / sqrt(2) |
---|
| 120 | |
---|
| 121 | const long double E = M_El; // e |
---|
| 122 | const long double LOG2_E = M_LOG2El; // log_2(e) |
---|
| 123 | const long double LOG10_E = M_LOG10El; // log_10(e) |
---|
| 124 | const long double LN_2 = M_LN2l; // log_e(2) |
---|
| 125 | const long double LN_10 = M_LN10l; // log_e(10) |
---|
| 126 | const long double SQRT_2 = M_SQRT2l; // sqrt(2) |
---|
| 127 | const long double _1_SQRT_2 = M_SQRT1_2l; // 1 / sqrt(2) |
---|
| 128 | |
---|
| 129 | const float _Complex E = M_E + 0.0_iF; // e |
---|
| 130 | const float _Complex LOG2_E = M_LOG2E + 0.0_iF; // log_2(e) |
---|
| 131 | const float _Complex LOG10_E = M_LOG10E + 0.0_iF; // log_10(e) |
---|
| 132 | const float _Complex LN_2 = M_LN2 + 0.0_iF; // log_e(2) |
---|
| 133 | const float _Complex LN_10 = M_LN10 + 0.0_iF; // log_e(10) |
---|
| 134 | const float _Complex SQRT_2 = M_SQRT2 + 0.0_iF; // sqrt(2) |
---|
| 135 | const float _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iF; // 1 / sqrt(2) |
---|
| 136 | |
---|
| 137 | const double _Complex E = M_E + 0.0_iD; // e |
---|
| 138 | const double _Complex LOG2_E = M_LOG2E + 0.0_iD; // log_2(e) |
---|
| 139 | const double _Complex LOG10_E = M_LOG10E + 0.0_iD; // log_10(e) |
---|
| 140 | const double _Complex LN_2 = M_LN2 + 0.0_iD; // log_e(2) |
---|
| 141 | const double _Complex LN_10 = M_LN10 + 0.0_iD; // log_e(10) |
---|
| 142 | const double _Complex SQRT_2 = M_SQRT2 + 0.0_iD; // sqrt(2) |
---|
| 143 | const double _Complex _1_SQRT_2 = M_SQRT1_2 + 0.0_iD; // 1 / sqrt(2) |
---|
| 144 | |
---|
| 145 | const long double _Complex E = M_El + 0.0_iL; // e |
---|
| 146 | const long double _Complex LOG2_E = M_LOG2El + 0.0_iL; // log_2(e) |
---|
| 147 | const long double _Complex LOG10_E = M_LOG10El + 0.0_iL; // log_10(e) |
---|
| 148 | const long double _Complex LN_2 = M_LN2l + 0.0_iL; // log_e(2) |
---|
| 149 | const long double _Complex LN_10 = M_LN10l + 0.0_iL; // log_e(10) |
---|
| 150 | const long double _Complex SQRT_2 = M_SQRT2l + 0.0_iL; // sqrt(2) |
---|
| 151 | const long double _Complex _1_SQRT_2 = M_SQRT1_2l + 0.0_iL; // 1 / sqrt(2) |
---|
[53ba273] | 152 | |
---|
| 153 | // Local Variables: // |
---|
| 154 | // mode: c // |
---|
| 155 | // tab-width: 4 // |
---|
| 156 | // End: // |
---|