]> Cypherpunks.ru repositories - gostls13.git/blob - test/float_lit3.go
cmd/gc: fix float32 const conversion and printing of big float consts
[gostls13.git] / test / float_lit3.go
1 // errorcheck
2
3 // Check flagging of invalid conversion of constant to float32/float64 near min/max boundaries.
4
5 // Copyright 2014 The Go Authors.  All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
8
9 package main
10
11 var x = []interface{}{
12         float32(-340282356779733661637539395458142568448), // ERROR "constant -3\.40282e\+38 overflows float32"
13         float32(-340282356779733661637539395458142568447),
14         float32(-340282326356119256160033759537265639424),
15         float32(340282326356119256160033759537265639424),
16         float32(340282356779733661637539395458142568447),
17         float32(340282356779733661637539395458142568448), // ERROR "constant 3\.40282e\+38 overflows float32"
18         -1e1000, // ERROR "constant -1\.00000e\+1000 overflows float64"
19         float64(-1.797693134862315907937289714053e+308), // ERROR "constant -1\.79769e\+308 overflows float64"
20         float64(-1.797693134862315807937289714053e+308),
21         float64(-1.797693134862315708145274237317e+308),
22         float64(-1.797693134862315608353258760581e+308),
23         float64(1.797693134862315608353258760581e+308),
24         float64(1.797693134862315708145274237317e+308),
25         float64(1.797693134862315807937289714053e+308),
26         float64(1.797693134862315907937289714053e+308), // ERROR "constant 1\.79769e\+308 overflows float64"
27         1e1000, // ERROR "constant 1\.00000e\+1000 overflows float64"
28 }