1 // errorcheck 2 3 // Copyright 2015 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. 6 7 package main 8 9 import "fmt" 10 11 func main() { 12 var g = 1e81391777742999 // ERROR "exponent too large" 13 // The next should only cause a problem when converted to float64 14 // by the assignment, but instead the compiler rejects it outright, 15 // rather than mishandle it. Specifically, when handled, 'var h' prints: 16 // issue11326.go:N: constant 0.93342e+536870911 overflows float64 17 // The rejection of 'var i' is just insurance. It seems to work correctly. 18 // See golang.org/issue/11326. 19 // var h = 1e2147483647 // should be "1.00000e+2147483647 overflows float64" 20 var h = 1e2147483647 // ERROR "exponent too large" 21 // var i = 1e214748364 // should be "1.00000e\+214748364 overflows float64" 22 var i = 1e214748364 // ERROR "exponent too large" 23 var j = 1e21474836 // ERROR "1.00000e\+21474836 overflows float64" 24 var k = 1e2147483 // ERROR "1.00000e\+2147483 overflows float64" 25 var l = 1e214748 // ERROR "1.00000e\+214748 overflows float64" 26 var m = 1e21474 // ERROR "1.00000e\+21474 overflows float64" 27 fmt.Println(g) 28 } 29