Source file test/fixedbugs/issue9036.go
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 // Expects to see error messages on 'p' exponents 8 // for non-hexadecimal floats. 9 10 package main 11 12 import "fmt" 13 14 const ( 15 x1 = 1.1 // float 16 x2 = 1e10 // float 17 x3 = 0x1e10 // integer (e is a hex digit) 18 ) 19 20 const x4 = 0x1p10 // valid hexadecimal float 21 const x5 = 1p10 // ERROR "'p' exponent requires hexadecimal mantissa|invalid prefix" 22 const x6 = 0P0 // ERROR "'P' exponent requires hexadecimal mantissa|invalid prefix" 23 24 func main() { 25 fmt.Printf("%g %T\n", x1, x1) 26 fmt.Printf("%g %T\n", x2, x2) 27 fmt.Printf("%g %T\n", x3, x3) 28 fmt.Printf("%g %T\n", x4, x4) 29 fmt.Printf("%g %T\n", x5, x5) 30 fmt.Printf("%g %T\n", x6, x6) 31 } 32