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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [convert-bfp-fold.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-std=gnu99 -O" } */
2
 
3
/* N1150 5.2 Conversions among decimal floating types and between
4
   decimal floating types and generic floating types.
5
   C99 6.3.1.5(4) Conversions, arithmetic operands, real floating types.  */
6
 
7
_Decimal32 d32;
8
_Decimal64 d64;
9
_Decimal128 d128;
10
float sf;
11
double df;
12
long double tf;
13
 
14
extern void link_error (void);
15
 
16
int
17
main ()
18
{
19
  /* Conversions from decimal float to binary float. */
20
 
21
  /* Conversions from _Decimal32. */
22
  d32 = 2.0df;
23
  sf = d32;
24
  if (sf != 2.0f)
25
    link_error ();
26
 
27
  df = d32;
28
  if (df != 2.0)
29
    link_error ();
30
 
31
  tf = d32;
32
  if (tf != 2.0l)
33
    link_error ();
34
 
35
  /* Conversions from _Decimal64. */
36
  d64 = -7.0dd;
37
  sf = d64;
38
  if (sf != -7.0f)
39
    link_error ();
40
 
41
  df = d64;
42
  if (df != -7.0)
43
    link_error ();
44
 
45
  tf = d64;
46
  if (tf != -7.0l)
47
    link_error ();
48
 
49
  /* Conversions from _Decimal128. */
50
  d128 = 30.0dl;
51
  sf = d128;
52
  if (sf != 30.0f)
53
    link_error ();
54
 
55
  df = d128;
56
  if (df != 30.0)
57
    link_error ();
58
 
59
  df = d128;
60
  if (df != 30.0l)
61
    link_error ();
62
 
63
  /* Conversions from binary float to decimal float. */
64
  sf = 30.0f;
65
  d32 = sf;
66
  if (d32 != 30.0df)
67
    link_error ();
68
 
69
  d64 = sf;
70
  if (d64 != 30.0dd)
71
    link_error ();
72
 
73
  df = -2.0;
74
  d32 = df;
75
  if (d32 != -2.0df)
76
    link_error ();
77
 
78
  d64 = df;
79
  if (d64 != -2.0dd)
80
    link_error ();
81
 
82
  d128 = df;
83
  if (d128 != -2.0dl)
84
    link_error ();
85
 
86
  sf = 30.0f;
87
  d128 = sf;
88
  if (d128 != 30.0dl)
89
    link_error ();
90
 
91
  tf = -22.0l;
92
  d32 = tf;
93
  if (d32 != -22.0df)
94
    link_error ();
95
 
96
  d64 = tf;
97
  if (d64 != -22.0dd)
98
    link_error ();
99
 
100
  d128 = tf;
101
  if (d128 != -22.0dl)
102
    link_error ();
103
 
104
  /* 2**(-11) = 0.00048828125. */
105
  d128 = 0.000488281251dl;
106
  sf = d128;
107
  if (sf != 0.00048828125f)
108
    link_error ();
109
  /* 2**(-25) = 0.298023223876953125E-7.  */
110
  d128 = 2.98023223876953125E-8dl;
111
  df = d128;
112
  if (df < (2.9802322387695312e-08 - 0.00000000001)
113
      || df > (2.9802322387695312e-08 + 0.00000000001))
114
    link_error ();
115
 
116
  return 0;
117
}

powered by: WebSVN 2.1.0

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