1 // $G $F.go && $L $F.$A && ./$A.out
3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
22 fhuge float64 = 1 << 100;
23 fhuge_1 float64 = chuge - 1;
24 f1 float64 = chuge >> 100;
29 func assert(t bool, s string) {
36 assert(c0 == 0, "c0");
37 assert(c1 == 1, "c1");
38 assert(chuge > chuge_1, "chuge");
39 assert(chuge_1 + 1 == chuge, "chuge 1");
40 assert(chuge + cm1 +1 == chuge, "cm1");
41 assert(c3div2 == 1, "3/2");
42 assert(c1e3 == 1000, "c1e3 int");
43 assert(c1e3 == 1e3, "c1e3 float");
45 // verify that all (in range) are assignable as ints
48 assert(i == c0, "i == c0");
50 assert(i == cm1, "i == cm1");
52 assert(i == c1, "i == c1");
54 assert(i == c3div2, "i == c3div2");
56 assert(i == c1e3, "i == c1e3");
58 // verify that all are assignable as floats
61 assert(f == c0, "f == c0");
63 assert(f == cm1, "f == cm1");
65 assert(f == chuge, "f == chuge");
67 assert(f == chuge_1, "f == chuge_1");
69 assert(f == c1, "f == c1");
71 assert(f == c3div2, "f == c3div2");
73 assert(f == c1e3, "f == c1e3");
77 assert(f0 == c0, "f0");
78 assert(f1 == c1, "f1");
79 assert(fhuge > fhuge_1, "fhuge");
80 assert(fhuge_1 + 1 == fhuge, "fhuge 1");
81 assert(fhuge + fm1 +1 == fhuge, "fm1");
82 assert(f3div2 == 1.5, "3./2.");
83 assert(f1e3 == 1000, "f1e3 int");
84 assert(f1e3 == 1.e3, "f1e3 float");
86 // verify that all (in range) are assignable as ints
89 assert(i == f0, "i == f0");
91 assert(i == fm1, "i == fm1");
93 // verify that all are assignable as floats
96 assert(f == f0, "f == f0");
98 assert(f == fm1, "f == fm1");
100 assert(f == fhuge, "f == fhuge");
102 assert(f == fhuge_1, "f == fhuge_1");
104 assert(f == f1, "f == f1");
106 assert(f == f3div2, "f == f3div2");
108 assert(f == f1e3, "f == f1e3");