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.c] - Blame information for rev 853

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

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-std=gnu99" } */
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
volatile _Decimal32 d32;
8
volatile _Decimal64 d64;
9
volatile _Decimal128 d128;
10
volatile float sf;
11
volatile double df;
12
volatile long double tf;
13
 
14
extern void abort (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
    abort ();
26
 
27
  df = d32;
28
  if (df != 2.0)
29
    abort ();
30
 
31
  tf = d32;
32
  if (tf != 2.0l)
33
    abort ();
34
 
35
  /* Conversions from _Decimal64. */
36
  d64 = -7.0dd;
37
  sf = d64;
38
  if (sf != -7.0f)
39
    abort ();
40
 
41
  df = d64;
42
  if (df != -7.0)
43
    abort ();
44
 
45
  tf = d64;
46
  if (tf != -7.0l)
47
    abort ();
48
 
49
  /* Conversions from _Decimal128. */
50
  d128 = 30.0dl;
51
  sf = d128;
52
  if (sf != 30.0f)
53
    abort ();
54
 
55
  df = d128;
56
  if (df != 30.0)
57
    abort ();
58
 
59
  df = d128;
60
  if (df != 30.0l)
61
    abort ();
62
 
63
  /* Conversions from binary float to decimal float. */
64
  sf = 30.0f;
65
  d32 = sf;
66
  if (d32 != 30.0df)
67
    abort ();
68
 
69
  d64 = sf;
70
  if (d64 != 30.0dd)
71
    abort ();
72
 
73
  df = -2.0;
74
  d32 = df;
75
  if (d32 != -2.0df)
76
    abort ();
77
 
78
  d64 = df;
79
  if (d64 != -2.0dd)
80
    abort ();
81
 
82
  d128 = df;
83
  if (d128 != -2.0dl)
84
    abort ();
85
 
86
  sf = 30.0f;
87
  d128 = sf;
88
  if (d128 != 30.0dl)
89
    abort ();
90
 
91
  tf = -22.0l;
92
  d32 = tf;
93
  if (d32 != -22.0df)
94
    abort ();
95
 
96
  d64 = tf;
97
  if (d64 != -22.0dd)
98
    abort ();
99
 
100
  d128 = tf;
101
  if (d128 != -22.0dl)
102
    abort ();
103
 
104
  /* 2**(-11) = 0.00048828125. */
105
  d128 = 0.000488281251dl;
106
  sf = d128;
107
  if (sf != 0.00048828125f)
108
    abort ();
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
    abort ();
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.