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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [c-c++-common/] [dfp/] [cast.c] - Blame information for rev 725

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 686 jeremybenn
/* C99 6.5.4 Cast operators.
2
   Test valid casts involving decimal float.  */
3
 
4
#include "dfp-dbg.h"
5
 
6
_Decimal32 d32;
7
_Decimal64 d64;
8
_Decimal128 d128;
9
 
10
static float f = 2.f;
11
static double d = 2.l;
12
 
13
int
14
main (void)
15
{
16
  /* Casts between DFP types.  */
17
  d32 = 1.2df;
18
  d64 = 1.2dd;
19
  d128 = 1.2dl;
20
 
21
  if (d32 != (_Decimal32) d64)
22
    FAILURE
23
  if (d32 != (_Decimal32) d128)
24
    FAILURE
25
 
26
  if (d64 != (_Decimal64) d32)
27
    FAILURE
28
  if (d64 != (_Decimal64) d128)
29
    FAILURE
30
 
31
  if (d128 != (_Decimal128) d32)
32
    FAILURE
33
  if (d128 != (_Decimal128) d64)
34
    FAILURE
35
 
36
  /* Casts between generic and decimal floating point types.  Use a
37
     value that we can assume can be represented exactly in all
38
     representations. */
39
 
40
  d32 = 2.0df;
41
  d64 = 2.0dd;
42
  d128 = 2.0dl;
43
 
44
  /* To generic floating types.  */
45
  if ((float) d32 != 2.0f)
46
    FAILURE
47
  if ((double) d32 != 2.0l)
48
    FAILURE
49
  if ((float) d64 != 2.0f)
50
    FAILURE
51
  if ((double) d64 != 2.0l)
52
    FAILURE
53
  if ((float) d128 != 2.0f)
54
    FAILURE
55
  if ((double) d128 != 2.0l)
56
    FAILURE
57
 
58
  /* float to decimal floating types.  */
59
  if (d32 != (_Decimal32) f)
60
    FAILURE
61
  if (d64 != (_Decimal64) f)
62
    FAILURE
63
  if (d128 != (_Decimal128) f)
64
    FAILURE
65
 
66
  /* double to decimal floating types.  */
67
  if (d32 != (_Decimal32) d)
68
    FAILURE
69
  if (d64 != (_Decimal64) d)
70
    FAILURE
71
  if (d128 != (_Decimal128) d)
72
    FAILURE
73
 
74
  FINISH
75
}

powered by: WebSVN 2.1.0

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