OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [builtins-20.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Copyright (C) 2003  Free Software Foundation.
2
 
3
   Verify that built-in math function constant folding doesn't break
4
   anything and produces the expected results.
5
 
6
   Written by Roger Sayle, 8th June 2003.  */
7
 
8
/* { dg-do link } */
9
/* { dg-options "-O2 -ffast-math" } */
10
/* { dg-add-options c99_runtime } */
11
 
12
#include "builtins-config.h"
13
 
14
extern double cos (double);
15
extern double sin (double);
16
extern double tan (double);
17
extern double fabs (double);
18
extern double atan2 (double, double);
19
extern double copysign (double, double);
20
extern double fmin (double, double);
21
extern double fmax (double, double);
22
extern double hypot (double, double);
23
extern double pure (double) __attribute__ ((__pure__));
24
extern double carg (__complex__ double);
25
extern __complex__ double ccos (__complex__ double);
26
extern __complex__ double ctan (__complex__ double);
27
extern float cosf (float);
28
extern float sinf (float);
29
extern float tanf (float);
30
extern float fabsf (float);
31
extern float atan2f (float, float);
32
extern float copysignf (float, float);
33
extern float fminf (float, float);
34
extern float fmaxf (float, float);
35
extern float hypotf (float, float);
36
extern float puref (float) __attribute__ ((__pure__));
37
extern float cargf (__complex__ float);
38
extern __complex__ float ccosf (__complex__ float);
39
extern __complex__ float ctanf (__complex__ float);
40
extern long double cosl (long double);
41
extern long double sinl (long double);
42
extern long double tanl (long double);
43
extern long double fabsl (long double);
44
extern long double atan2l (long double, long double);
45
extern long double copysignl (long double, long double);
46
extern long double fminl (long double, long double);
47
extern long double fmaxl (long double, long double);
48
extern long double hypotl (long double, long double);
49
extern long double purel (long double) __attribute__ ((__pure__));
50
extern long double cargl (__complex__ long double);
51
extern __complex__ long double ccosl (__complex__ long double);
52
extern __complex__ long double ctanl (__complex__ long double);
53
 
54
extern void link_error(void);
55
 
56
void test1(double x)
57
{
58
  if (cos(x) != cos(-x))
59
    link_error ();
60
 
61
  if (cos(x) != cos(fabs(x)))
62
    link_error ();
63
 
64
  if (cos(x) != cos(-fabs(x)))
65
    link_error ();
66
 
67
  if (cos(tan(x)) != cos(tan(-fabs(x))))
68
    link_error ();
69
 
70
  if (sin(x)/cos(x) != tan(x))
71
    link_error ();
72
 
73
  if (cos(x)/sin(x) != 1.0/tan(x))
74
    link_error ();
75
 
76
  if (tan(x)*cos(x) != sin(x))
77
    link_error ();
78
 
79
  if (cos(x)*tan(x) != sin(x))
80
    link_error ();
81
 
82
  if (sin(x)/tan(x) != cos(x))
83
    link_error ();
84
 
85
  if (tan(x)/sin(x) != 1.0/cos(x))
86
    link_error ();
87
}
88
 
89
void test2(double x, double y)
90
{
91
  if (-tan(x-y) != tan(y-x))
92
    link_error ();
93
 
94
  if (-sin(x-y) != sin(y-x))
95
    link_error ();
96
 
97
  if (cos(-x*y) != cos(x*y))
98
    link_error ();
99
 
100
  if (cos(x*-y) != cos(x*y))
101
    link_error ();
102
 
103
  if (cos(-x/y) != cos(x/y))
104
    link_error ();
105
 
106
  if (cos(x/-y) != cos(x/y))
107
    link_error ();
108
 
109
  if (cos(-fabs(tan(x/-y))) != cos(tan(x/y)))
110
    link_error ();
111
 
112
  if (cos(y<10 ? -x : y) != cos(y<10 ? x : y))
113
    link_error ();
114
 
115
  if (cos(y<10 ? x : -y) != cos(y<10 ? x : y))
116
    link_error ();
117
 
118
  if (cos(y<10 ? -fabs(x) : tan(x<20 ? -x : -fabs(y)))
119
      != cos(y<10 ? x : tan(x<20 ? x : y)))
120
    link_error ();
121
 
122
  if (cos((y*=3, -x)) != cos((y*=3,x)))
123
    link_error ();
124
 
125
  if (cos((y*=2, -fabs(tan(x/-y)))) != cos((y*=2,tan(x/y))))
126
    link_error ();
127
 
128
  if (cos(copysign(x,y)) != cos(x))
129
    link_error ();
130
 
131
  if (cos(copysign(-fabs(x),y*=2)) != cos((y*=2,x)))
132
    link_error ();
133
 
134
  if (hypot (x, 0) != fabs(x))
135
    link_error ();
136
 
137
  if (hypot (0, x) != fabs(x))
138
    link_error ();
139
 
140
  if (hypot (x, x) != fabs(x) * __builtin_sqrt(2))
141
    link_error ();
142
 
143
  if (hypot (-x, y) != hypot (x, y))
144
    link_error ();
145
 
146
  if (hypot (x, -y) != hypot (x, y))
147
    link_error ();
148
 
149
  if (hypot (-x, -y) != hypot (x, y))
150
    link_error ();
151
 
152
  if (hypot (fabs(x), y) != hypot (x, y))
153
    link_error ();
154
 
155
  if (hypot (x, fabs(y)) != hypot (x, y))
156
    link_error ();
157
 
158
  if (hypot (fabs(x), fabs(y)) != hypot (x, y))
159
    link_error ();
160
 
161
  if (hypot (-fabs(-x), -fabs(fabs(fabs(-y)))) != hypot (x, y))
162
    link_error ();
163
 
164
  if (hypot (-x, 0) != fabs(x))
165
    link_error ();
166
 
167
  if (hypot (-x, x) != fabs(x) * __builtin_sqrt(2))
168
    link_error ();
169
 
170
  if (hypot (pure(x), -pure(x)) != fabs(pure(x)) * __builtin_sqrt(2))
171
    link_error ();
172
 
173
  if (hypot (tan(-x), tan(-fabs(y))) != hypot (tan(x), tan(y)))
174
    link_error ();
175
 
176
  if (fmin (fmax(x,y),y) != y)
177
    link_error ();
178
 
179
  if (fmin (fmax(y,x),y) != y)
180
    link_error ();
181
 
182
  if (fmin (x,fmax(x,y)) != x)
183
    link_error ();
184
 
185
  if (fmin (x,fmax(y,x)) != x)
186
    link_error ();
187
 
188
  if (fmax (fmin(x,y),y) != y)
189
    link_error ();
190
 
191
  if (fmax (fmin(y,x),y) != y)
192
    link_error ();
193
 
194
  if (fmax (x,fmin(x,y)) != x)
195
    link_error ();
196
 
197
  if (fmax (x,fmin(y,x)) != x)
198
    link_error ();
199
 
200
  if ((__complex__ double) x != -(__complex__ double) (-x))
201
    link_error ();
202
 
203
  if (x*1i != -(-x*1i))
204
    link_error ();
205
 
206
  if (x+(x-y)*1i != -(-x+(y-x)*1i))
207
    link_error ();
208
 
209
  if (x+(x-y)*1i != -(-x-(x-y)*1i))
210
    link_error ();
211
 
212
  if (ccos(tan(x)+sin(y)*1i) != ccos(-tan(-x)+-sin(-y)*1i))
213
    link_error ();
214
 
215
  if (ccos(tan(x)+sin(x-y)*1i) != ccos(-tan(-x)-sin(y-x)*1i))
216
    link_error ();
217
 
218
  if (-5+x*1i != -~(5+x*1i))
219
    link_error ();
220
 
221
  if (tan(x)+tan(y)*1i != -~(tan(-x)+tan(y)*1i))
222
    link_error ();
223
}
224
 
225
void test3(__complex__ double x, __complex__ double y, int i)
226
{
227
  if (carg(x) != atan2(__imag__ x, __real__ x))
228
    link_error ();
229
 
230
  if (ccos(x) != ccos(-x))
231
    link_error();
232
 
233
  if (ccos(ctan(x)) != ccos(ctan(-x)))
234
    link_error();
235
 
236
  if (ctan(x-y) != -ctan(y-x))
237
    link_error();
238
 
239
  if (ccos(x/y) != ccos(-x/y))
240
    link_error();
241
 
242
  if (ccos(x/y) != ccos(x/-y))
243
    link_error();
244
 
245
  if (ccos(x/ctan(y)) != ccos(-x/ctan(-y)))
246
    link_error();
247
 
248
  if (ccos(x*y) != ccos(-x*y))
249
    link_error();
250
 
251
  if (ccos(x*y) != ccos(x*-y))
252
    link_error();
253
 
254
  if (ccos(ctan(x)*y) != ccos(ctan(-x)*-y))
255
    link_error();
256
 
257
  if (ccos(ctan(x/y)) != ccos(-ctan(x/-y)))
258
    link_error();
259
 
260
  if (ccos(i ? x : y) != ccos(i ? -x : y))
261
    link_error();
262
 
263
  if (ccos(i ? x : y) != ccos(i ? x : -y))
264
    link_error();
265
 
266
  if (ccos(i ? x : ctan(y/x)) != ccos(i ? -x : -ctan(-y/x)))
267
    link_error();
268
 
269
  if (~x != -~-x)
270
    link_error();
271
 
272
  if (ccos(~x) != ccos(-~-x))
273
    link_error();
274
 
275
  if (ctan(~(x-y)) != -ctan(~(y-x)))
276
    link_error();
277
 
278
  if (ctan(~(x/y)) != -ctan(~(x/-y)))
279
    link_error();
280
}
281
 
282
void test1f(float x)
283
{
284
  if (cosf(x) != cosf(-x))
285
    link_error ();
286
 
287
  if (cosf(x) != cosf(fabsf(x)))
288
    link_error ();
289
 
290
  if (cosf(x) != cosf(-fabsf(x)))
291
    link_error ();
292
 
293
  if (cosf(tanf(x)) != cosf(tanf(-fabsf(x))))
294
    link_error ();
295
 
296
#ifdef HAVE_C99_RUNTIME
297
  if (sinf(x)/cosf(x) != tanf(x))
298
    link_error ();
299
 
300
  if (cosf(x)/sinf(x) != 1.0f/tanf(x))
301
    link_error ();
302
 
303
  if (tanf(x)*cosf(x) != sinf(x))
304
    link_error ();
305
 
306
  if (cosf(x)*tanf(x) != sinf(x))
307
    link_error ();
308
 
309
  if (sinf(x)/tanf(x) != cosf(x))
310
    link_error ();
311
 
312
  if (tanf(x)/sinf(x) != 1.0f/cosf(x))
313
    link_error ();
314
#endif
315
}
316
 
317
void test2f(float x, float y)
318
{
319
  if (-tanf(x-y) != tanf(y-x))
320
    link_error ();
321
 
322
  if (-sinf(x-y) != sinf(y-x))
323
    link_error ();
324
 
325
  if (cosf(-x*y) != cosf(x*y))
326
    link_error ();
327
 
328
  if (cosf(x*-y) != cosf(x*y))
329
    link_error ();
330
 
331
  if (cosf(-x/y) != cosf(x/y))
332
    link_error ();
333
 
334
  if (cosf(x/-y) != cosf(x/y))
335
    link_error ();
336
 
337
  if (cosf(-fabsf(tanf(x/-y))) != cosf(tanf(x/y)))
338
    link_error ();
339
 
340
  if (cosf(y<10 ? -x : y) != cosf(y<10 ? x : y))
341
    link_error ();
342
 
343
  if (cosf(y<10 ? x : -y) != cosf(y<10 ? x : y))
344
    link_error ();
345
 
346
  if (cosf(y<10 ? -fabsf(x) : tanf(x<20 ? -x : -fabsf(y)))
347
      != cosf(y<10 ? x : tanf(x<20 ? x : y)))
348
    link_error ();
349
 
350
  if (cosf((y*=3, -x)) != cosf((y*=3,x)))
351
    link_error ();
352
 
353
  if (cosf((y*=2, -fabsf(tanf(x/-y)))) != cosf((y*=2,tanf(x/y))))
354
    link_error ();
355
 
356
  if (cosf(copysignf(x,y)) != cosf(x))
357
    link_error ();
358
 
359
  if (cosf(copysignf(-fabsf(x),y*=2)) != cosf((y*=2,x)))
360
    link_error ();
361
 
362
  if (hypotf (x, 0) != fabsf(x))
363
    link_error ();
364
 
365
  if (hypotf (0, x) != fabsf(x))
366
    link_error ();
367
 
368
  if (hypotf (x, x) != fabsf(x) * __builtin_sqrtf(2))
369
    link_error ();
370
 
371
  if (hypotf (-x, y) != hypotf (x, y))
372
    link_error ();
373
 
374
  if (hypotf (x, -y) != hypotf (x, y))
375
    link_error ();
376
 
377
  if (hypotf (-x, -y) != hypotf (x, y))
378
    link_error ();
379
 
380
  if (hypotf (fabsf(x), y) != hypotf (x, y))
381
    link_error ();
382
 
383
  if (hypotf (x, fabsf(y)) != hypotf (x, y))
384
    link_error ();
385
 
386
  if (hypotf (fabsf(x), fabsf(y)) != hypotf (x, y))
387
    link_error ();
388
 
389
  if (hypotf (-fabsf(-x), -fabsf(fabsf(fabsf(-y)))) != hypotf (x, y))
390
    link_error ();
391
 
392
  if (hypotf (-x, 0) != fabsf(x))
393
    link_error ();
394
 
395
  if (hypotf (-x, x) != fabsf(x) * __builtin_sqrtf(2))
396
    link_error ();
397
 
398
  if (hypotf (puref(x), -puref(x)) != fabsf(puref(x)) * __builtin_sqrtf(2))
399
    link_error ();
400
 
401
  if (hypotf (tanf(-x), tanf(-fabsf(y))) != hypotf (tanf(x), tanf(y)))
402
    link_error ();
403
 
404
  if (fminf (fmaxf(x,y),y) != y)
405
    link_error ();
406
 
407
  if (fminf (fmaxf(y,x),y) != y)
408
    link_error ();
409
 
410
  if (fminf (x,fmaxf(x,y)) != x)
411
    link_error ();
412
 
413
  if (fminf (x,fmaxf(y,x)) != x)
414
    link_error ();
415
 
416
  if (fmaxf (fminf(x,y),y) != y)
417
    link_error ();
418
 
419
  if (fmaxf (fminf(y,x),y) != y)
420
    link_error ();
421
 
422
  if (fmaxf (x,fminf(x,y)) != x)
423
    link_error ();
424
 
425
  if (fmaxf (x,fminf(y,x)) != x)
426
    link_error ();
427
 
428
  if ((__complex__ float) x != -(__complex__ float) (-x))
429
    link_error ();
430
 
431
  if (x+(x-y)*1i != -(-x+(y-x)*1i))
432
    link_error ();
433
 
434
  if (x+(x-y)*1i != -(-x-(x-y)*1i))
435
    link_error ();
436
 
437
  if (ccosf(tanf(x)+sinf(y)*1i) != ccosf(-tanf(-x)+-sinf(-y)*1i))
438
    link_error ();
439
 
440
  if (ccosf(tanf(x)+sinf(x-y)*1i) != ccosf(-tanf(-x)-sinf(y-x)*1i))
441
    link_error ();
442
 
443
  if (-5+x*1i != -~(5+x*1i))
444
    link_error ();
445
 
446
  if (tanf(x)+tanf(y)*1i != -~(tanf(-x)+tanf(y)*1i))
447
    link_error ();
448
}
449
 
450
void test3f(__complex__ float x, __complex__ float y, int i)
451
{
452
  if (ccosf(x) != ccosf(-x))
453
    link_error();
454
 
455
  if (ccosf(ctanf(x)) != ccosf(ctanf(-x)))
456
    link_error();
457
 
458
  if (ctanf(x-y) != -ctanf(y-x))
459
    link_error();
460
 
461
  if (ccosf(x/y) != ccosf(-x/y))
462
    link_error();
463
 
464
  if (ccosf(x/y) != ccosf(x/-y))
465
    link_error();
466
 
467
  if (ccosf(x/ctanf(y)) != ccosf(-x/ctanf(-y)))
468
    link_error();
469
 
470
  if (ccosf(x*y) != ccosf(-x*y))
471
    link_error();
472
 
473
  if (ccosf(x*y) != ccosf(x*-y))
474
    link_error();
475
 
476
  if (ccosf(ctanf(x)*y) != ccosf(ctanf(-x)*-y))
477
    link_error();
478
 
479
  if (ccosf(ctanf(x/y)) != ccosf(-ctanf(x/-y)))
480
    link_error();
481
 
482
  if (ccosf(i ? x : y) != ccosf(i ? -x : y))
483
    link_error();
484
 
485
  if (ccosf(i ? x : y) != ccosf(i ? x : -y))
486
    link_error();
487
 
488
  if (ccosf(i ? x : ctanf(y/x)) != ccosf(i ? -x : -ctanf(-y/x)))
489
    link_error();
490
 
491
  if (~x != -~-x)
492
    link_error();
493
 
494
  if (ccosf(~x) != ccosf(-~-x))
495
    link_error();
496
 
497
  if (ctanf(~(x-y)) != -ctanf(~(y-x)))
498
    link_error();
499
 
500
  if (ctanf(~(x/y)) != -ctanf(~(x/-y)))
501
    link_error();
502
 
503
#ifdef HAVE_C99_RUNTIME
504
  if (cargf(x) != atan2f(__imag__ x, __real__ x))
505
    link_error ();
506
#endif
507
}
508
 
509
void test1l(long double x)
510
{
511
  if (cosl(x) != cosl(-x))
512
    link_error ();
513
 
514
  if (cosl(x) != cosl(fabsl(x)))
515
    link_error ();
516
 
517
  if (cosl(x) != cosl(-fabsl(x)))
518
    link_error ();
519
 
520
  if (cosl(tanl(x)) != cosl(tanl(-fabsl(x))))
521
    link_error ();
522
 
523
#ifdef HAVE_C99_RUNTIME
524
  if (sinl(x)/cosl(x) != tanl(x))
525
    link_error ();
526
 
527
  if (cosl(x)/sinl(x) != 1.0l/tanl(x))
528
    link_error ();
529
 
530
  if (tanl(x)*cosl(x) != sinl(x))
531
    link_error ();
532
 
533
  if (cosl(x)*tanl(x) != sinl(x))
534
    link_error ();
535
 
536
  if (sinl(x)/tanl(x) != cosl(x))
537
    link_error ();
538
 
539
  if (tanl(x)/sinl(x) != 1.0l/cosl(x))
540
    link_error ();
541
#endif
542
}
543
 
544
void test2l(long double x, long double y)
545
{
546
  if (-tanl(x-y) != tanl(y-x))
547
    link_error ();
548
 
549
  if (-sinl(x-y) != sinl(y-x))
550
    link_error ();
551
 
552
  if (cosl(-x*y) != cosl(x*y))
553
    link_error ();
554
 
555
  if (cosl(x*-y) != cosl(x*y))
556
    link_error ();
557
 
558
  if (cosl(-x/y) != cosl(x/y))
559
    link_error ();
560
 
561
  if (cosl(x/-y) != cosl(x/y))
562
    link_error ();
563
 
564
  if (cosl(-fabsl(tanl(x/-y))) != cosl(tanl(x/y)))
565
    link_error ();
566
 
567
  if (cosl(y<10 ? -x : y) != cosl(y<10 ? x : y))
568
    link_error ();
569
 
570
  if (cosl(y<10 ? x : -y) != cosl(y<10 ? x : y))
571
    link_error ();
572
 
573
  if (cosl(y<10 ? -fabsl(x) : tanl(x<20 ? -x : -fabsl(y)))
574
      != cosl(y<10 ? x : tanl(x<20 ? x : y)))
575
    link_error ();
576
 
577
  if (cosl((y*=3, -x)) != cosl((y*=3,x)))
578
    link_error ();
579
 
580
  if (cosl((y*=2, -fabsl(tanl(x/-y)))) != cosl((y*=2,tanl(x/y))))
581
    link_error ();
582
 
583
  if (cosl(copysignl(x,y)) != cosl(x))
584
    link_error ();
585
 
586
  if (cosl(copysignl(-fabsl(x),y*=2)) != cosl((y*=2,x)))
587
    link_error ();
588
 
589
  if (hypotl (x, 0) != fabsl(x))
590
    link_error ();
591
 
592
  if (hypotl (0, x) != fabsl(x))
593
    link_error ();
594
 
595
  if (hypotl (x, x) != fabsl(x) * __builtin_sqrtl(2))
596
    link_error ();
597
 
598
  if (hypotl (-x, y) != hypotl (x, y))
599
    link_error ();
600
 
601
  if (hypotl (x, -y) != hypotl (x, y))
602
    link_error ();
603
 
604
  if (hypotl (-x, -y) != hypotl (x, y))
605
    link_error ();
606
 
607
  if (hypotl (fabsl(x), y) != hypotl (x, y))
608
    link_error ();
609
 
610
  if (hypotl (x, fabsl(y)) != hypotl (x, y))
611
    link_error ();
612
 
613
  if (hypotl (fabsl(x), fabsl(y)) != hypotl (x, y))
614
    link_error ();
615
 
616
  if (hypotl (-fabsl(-x), -fabsl(fabsl(fabsl(-y)))) != hypotl (x, y))
617
    link_error ();
618
 
619
  if (hypotl (-x, 0) != fabsl(x))
620
    link_error ();
621
 
622
  if (hypotl (-x, x) != fabsl(x) * __builtin_sqrtl(2))
623
    link_error ();
624
 
625
  if (hypotl (purel(x), -purel(x)) != fabsl(purel(x)) * __builtin_sqrtl(2))
626
    link_error ();
627
 
628
  if (hypotl (tanl(-x), tanl(-fabsl(y))) != hypotl (tanl(x), tanl(y)))
629
    link_error ();
630
 
631
  if (fminl (fmaxl(x,y),y) != y)
632
    link_error ();
633
 
634
  if (fminl (fmaxl(y,x),y) != y)
635
    link_error ();
636
 
637
  if (fminl (x,fmaxl(x,y)) != x)
638
    link_error ();
639
 
640
  if (fminl (x,fmaxl(y,x)) != x)
641
    link_error ();
642
 
643
  if (fmaxl (fminl(x,y),y) != y)
644
    link_error ();
645
 
646
  if (fmaxl (fminl(y,x),y) != y)
647
    link_error ();
648
 
649
  if (fmaxl (x,fminl(x,y)) != x)
650
    link_error ();
651
 
652
  if (fmaxl (x,fminl(y,x)) != x)
653
    link_error ();
654
 
655
  if ((__complex__ long double) x != -(__complex__ long double) (-x))
656
    link_error ();
657
 
658
  if (x+(x-y)*1i != -(-x+(y-x)*1i))
659
    link_error ();
660
 
661
  if (x+(x-y)*1i != -(-x-(x-y)*1i))
662
    link_error ();
663
 
664
  if (ccosl(tanl(x)+sinl(y)*1i) != ccosl(-tanl(-x)+-sinl(-y)*1i))
665
    link_error ();
666
 
667
  if (ccosl(tanl(x)+sinl(x-y)*1i) != ccosl(-tanl(-x)-sinl(y-x)*1i))
668
    link_error ();
669
 
670
  if (-5+x*1i != -~(5+x*1i))
671
    link_error ();
672
 
673
  if (tanl(x)+tanl(y)*1i != -~(tanl(-x)+tanl(y)*1i))
674
    link_error ();
675
}
676
 
677
void test3l(__complex__ long double x, __complex__ long double y, int i)
678
{
679
  if (ccosl(x) != ccosl(-x))
680
    link_error();
681
 
682
  if (ccosl(ctanl(x)) != ccosl(ctanl(-x)))
683
    link_error();
684
 
685
  if (ctanl(x-y) != -ctanl(y-x))
686
    link_error();
687
 
688
  if (ccosl(x/y) != ccosl(-x/y))
689
    link_error();
690
 
691
  if (ccosl(x/y) != ccosl(x/-y))
692
    link_error();
693
 
694
  if (ccosl(x/ctanl(y)) != ccosl(-x/ctanl(-y)))
695
    link_error();
696
 
697
  if (ccosl(x*y) != ccosl(-x*y))
698
    link_error();
699
 
700
  if (ccosl(x*y) != ccosl(x*-y))
701
    link_error();
702
 
703
  if (ccosl(ctanl(x)*y) != ccosl(ctanl(-x)*-y))
704
    link_error();
705
 
706
  if (ccosl(ctanl(x/y)) != ccosl(-ctanl(x/-y)))
707
    link_error();
708
 
709
  if (ccosl(i ? x : y) != ccosl(i ? -x : y))
710
    link_error();
711
 
712
  if (ccosl(i ? x : y) != ccosl(i ? x : -y))
713
    link_error();
714
 
715
  if (ccosl(i ? x : ctanl(y/x)) != ccosl(i ? -x : -ctanl(-y/x)))
716
    link_error();
717
 
718
  if (~x != -~-x)
719
    link_error();
720
 
721
  if (ccosl(~x) != ccosl(-~-x))
722
    link_error();
723
 
724
  if (ctanl(~(x-y)) != -ctanl(~(y-x)))
725
    link_error();
726
 
727
  if (ctanl(~(x/y)) != -ctanl(~(x/-y)))
728
    link_error();
729
 
730
#ifdef HAVE_C99_RUNTIME
731
  if (cargl(x) != atan2l(__imag__ x, __real__ x))
732
    link_error ();
733
#endif
734
}
735
 
736
int main()
737
{
738
  test1 (1.0);
739
  test2 (1.0, 2.0);
740
 
741
  test1f (1.0f);
742
  test2f (1.0f, 2.0f);
743
 
744
  test1l (1.0l);
745
  test2l (1.0l, 2.0l);
746
 
747
  return 0;
748
}
749
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.