Changeset 1831fd12 in rtems for testsuites/libtests/math/domath.c
- Timestamp:
- 05/24/12 05:15:40 (11 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 2a7b823
- Parents:
- 87c8d8ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuites/libtests/math/domath.c
r87c8d8ab r1831fd12 12 12 13 13 #ifdef HAVE_CONFIG_H 14 #include "config.h"14 #include "config.h" 15 15 #endif 16 16 17 #include <math.h> 18 #include <stdio.h> 19 20 #ifndef M_PI_2 21 #define M_PI_2 1.57079632679489661923 17 #ifdef NO_DOUBLE 18 #define PROVIDE_EMPTY_FUNC 22 19 #endif 23 20 24 #ifndef M_PI_4 25 #define M_PI_4 0.78539816339744830962 26 #endif 21 #define FTYPE double 22 #define PRI "%f" 27 23 28 extern void domath (void); 29 30 void 31 domath (void) 32 { 33 #ifndef NO_DOUBLE 34 double f1; 35 double f2; 36 37 int i1; 38 39 f1 = acos (0.0); 40 fprintf( stdout, "acos : %f\n", f1); 41 42 f1 = acosh (0.0); 43 fprintf( stdout, "acosh : %f\n", f1); 44 45 f1 = asin (1.0); 46 fprintf( stdout, "asin : %f\n", f1); 47 48 f1 = asinh (1.0); 49 fprintf( stdout, "asinh : %f\n", f1); 50 51 f1 = atan (M_PI_4); 52 fprintf( stdout, "atan : %f\n", f1); 53 54 f1 = atan2 (2.3, 2.3); 55 fprintf( stdout, "atan2 : %f\n", f1); 56 57 f1 = atanh (1.0); 58 fprintf( stdout, "atanh : %f\n", f1); 59 60 f1 = cbrt (27.0); 61 fprintf( stdout, "cbrt : %f\n", f1); 62 63 f1 = ceil (3.5); 64 fprintf( stdout, "ceil : %f\n", f1); 65 66 f1 = copysign (3.5, -2.5); 67 fprintf( stdout, "copysign : %f\n", f1); 68 69 f1 = cos (M_PI_2); 70 fprintf( stdout, "cos : %f\n", f1); 71 72 f1 = cosh (M_PI_2); 73 fprintf( stdout, "cosh : %f\n", f1); 74 75 f1 = erf (42.0); 76 fprintf( stdout, "erf : %f\n", f1); 77 78 f1 = erfc (42.0); 79 fprintf( stdout, "erfc : %f\n", f1); 80 81 f1 = exp (0.42); 82 fprintf( stdout, "exp : %f\n", f1); 83 84 f1 = exp2 (0.42); 85 fprintf( stdout, "exp2 : %f\n", f1); 86 87 f1 = expm1 (0.00042); 88 fprintf( stdout, "expm1 : %f\n", f1); 89 90 f1 = fabs (-1.123); 91 fprintf( stdout, "fabs : %f\n", f1); 92 93 f1 = fdim (1.123, 2.123); 94 fprintf( stdout, "fdim : %f\n", f1); 95 96 f1 = floor (0.5); 97 fprintf( stdout, "floor : %f\n", f1); 98 f1 = floor (-0.5); 99 fprintf( stdout, "floor : %f\n", f1); 100 101 f1 = fma (2.1, 2.2, 3.01); 102 fprintf( stdout, "fma : %f\n", f1); 103 104 f1 = fmax (-0.42, 0.42); 105 fprintf( stdout, "fmax : %f\n", f1); 106 107 f1 = fmin (-0.42, 0.42); 108 fprintf( stdout, "fmin : %f\n", f1); 109 110 f1 = fmod (42.0, 3.0); 111 fprintf( stdout, "fmod : %f\n", f1); 112 113 /* no type-specific variant */ 114 i1 = fpclassify(1.0); 115 fprintf( stdout, "fpclassify : %d\n", i1); 116 117 f1 = frexp (42.0, &i1); 118 fprintf( stdout, "frexp : %f\n", f1); 119 120 f1 = hypot (42.0, 42.0); 121 fprintf( stdout, "hypot : %f\n", f1); 122 123 i1 = ilogb (42.0); 124 fprintf( stdout, "ilogb : %d\n", i1); 125 126 /* no type-specific variant */ 127 i1 = isfinite(3.0); 128 fprintf( stdout, "isfinite : %d\n", i1); 129 130 /* no type-specific variant */ 131 i1 = isgreater(3.0, 3.1); 132 fprintf( stdout, "isgreater : %d\n", i1); 133 134 /* no type-specific variant */ 135 i1 = isgreaterequal(3.0, 3.1); 136 fprintf( stdout, "isgreaterequal : %d\n", i1); 137 138 /* no type-specific variant */ 139 i1 = isinf(3.0); 140 fprintf( stdout, "isinf : %d\n", i1); 141 142 /* no type-specific variant */ 143 i1 = isless(3.0, 3.1); 144 fprintf( stdout, "isless : %d\n", i1); 145 146 /* no type-specific variant */ 147 i1 = islessequal(3.0, 3.1); 148 fprintf( stdout, "islessequal : %d\n", i1); 149 150 /* no type-specific variant */ 151 i1 = islessgreater(3.0, 3.1); 152 fprintf( stdout, "islessgreater : %d\n", i1); 153 154 /* no type-specific variant */ 155 i1 = isnan(0.0); 156 fprintf( stdout, "isnan : %d\n", i1); 157 158 /* no type-specific variant */ 159 i1 = isnormal(3.0); 160 fprintf( stdout, "isnormal : %d\n", i1); 161 162 /* no type-specific variant */ 163 f1 = isunordered(1.0, 2.0); 164 fprintf( stdout, "isunordered : %d\n", i1); 165 166 f1 = j0 (1.2); 167 fprintf( stdout, "j0 : %f\n", f1); 168 169 f1 = j1 (1.2); 170 fprintf( stdout, "j1 : %f\n", f1); 171 172 f1 = jn (2,1.2); 173 fprintf( stdout, "jn : %f\n", f1); 174 175 f1 = ldexp (1.2,3); 176 fprintf( stdout, "ldexp : %f\n", f1); 177 178 f1 = lgamma (42.0); 179 fprintf( stdout, "lgamma : %f\n", f1); 180 181 f1 = llrint (-0.5); 182 fprintf( stdout, "llrint : %f\n", f1); 183 f1 = llrint (0.5); 184 fprintf( stdout, "llrint : %f\n", f1); 185 186 f1 = llround (-0.5); 187 fprintf( stdout, "lround : %f\n", f1); 188 f1 = llround (0.5); 189 fprintf( stdout, "lround : %f\n", f1); 190 191 f1 = log (42.0); 192 fprintf( stdout, "log : %f\n", f1); 193 194 f1 = log10 (42.0); 195 fprintf( stdout, "log10 : %f\n", f1); 196 197 f1 = log1p (42.0); 198 fprintf( stdout, "log1p : %f\n", f1); 199 200 f1 = log2 (42.0); 201 fprintf( stdout, "log2 : %f\n", f1); 202 203 f1 = logb (42.0); 204 fprintf( stdout, "logb : %f\n", f1); 205 206 f1 = lrint (-0.5); 207 fprintf( stdout, "lrint : %f\n", f1); 208 f1 = lrint (0.5); 209 fprintf( stdout, "lrint : %f\n", f1); 210 211 f1 = lround (-0.5); 212 fprintf( stdout, "lround : %f\n", f1); 213 f1 = lround (0.5); 214 fprintf( stdout, "lround : %f\n", f1); 215 216 f1 = modf (42.0,&f2); 217 fprintf( stdout, "lmodf : %f\n", f1); 218 219 f1 = nan (""); 220 fprintf( stdout, "nan : %f\n", f1); 221 222 f1 = nearbyint (1.5); 223 fprintf( stdout, "nearbyint : %f\n", f1); 224 225 f1 = nextafter (1.5,2.0); 226 fprintf( stdout, "nextafter : %f\n", f1); 227 228 f1 = pow (3.01, 2.0); 229 fprintf( stdout, "pow : %f\n", f1); 230 231 f1 = remainder (3.01,2.0); 232 fprintf( stdout, "remainder : %f\n", f1); 233 234 f1 = remquo (29.0,3.0,&i1); 235 fprintf( stdout, "remquo : %f\n", f1); 236 237 f1 = rint (0.5); 238 fprintf( stdout, "rint : %f\n", f1); 239 f1 = rint (-0.5); 240 fprintf( stdout, "rint : %f\n", f1); 241 242 f1 = round (0.5); 243 fprintf( stdout, "round : %f\n", f1); 244 f1 = round (-0.5); 245 fprintf( stdout, "round : %f\n", f1); 246 247 f1 = scalbln (1.2,3); 248 fprintf( stdout, "scalbln : %f\n", f1); 249 250 f1 = scalbn (1.2,3); 251 fprintf( stdout, "scalbn : %f\n", f1); 252 253 /* no type-specific variant */ 254 i1 = signbit(1.0); 255 fprintf( stdout, "signbit : %i\n", i1); 256 257 f1 = sin (M_PI_4); 258 fprintf( stdout, "sin : %f\n", f1); 259 260 f1 = sinh (M_PI_4); 261 fprintf( stdout, "sinh : %f\n", f1); 262 263 f1 = sqrt (9.0); 264 fprintf( stdout, "sqrt : %f\n", f1); 265 266 f1 = tan (M_PI_4); 267 fprintf( stdout, "tan : %f\n", f1); 268 269 f1 = tanh (M_PI_4); 270 fprintf( stdout, "tanh : %f\n", f1); 271 272 f1 = tgamma (2.1); 273 fprintf( stdout, "tgamma : %f\n", f1); 274 275 f1 = trunc (3.5); 276 fprintf( stdout, "trunc : %f\n", f1); 277 278 f1 = y0 (1.2); 279 fprintf( stdout, "y0 : %f\n", f1); 280 281 f1 = y1 (1.2); 282 fprintf( stdout, "y1 : %f\n", f1); 283 284 f1 = yn (3,1.2); 285 fprintf( stdout, "yn : %f\n", f1); 286 #endif 287 } 24 #include <domath.h>
Note: See TracChangeset
for help on using the changeset viewer.