github.com/mdempsky/go@v0.0.0-20151201204031-5dd372bd1e70/test/fixedbugs/issue9036.go (about)

     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  
     9  package main
    10  
    11  import "fmt"
    12  
    13  const (
    14  	x1 = 1.1    // float
    15  	x2 = 1e10   // float
    16  	x3 = 0x1e10 // integer (e is a hex digit)
    17  	x4 = 0x1p10 // ERROR "malformed floating point constant"
    18  	x5 = 1p10   // ERROR "malformed floating point constant"
    19  	x6 = 0p0    // ERROR "malformed floating point constant"
    20  )
    21  
    22  func main() {
    23  	fmt.Printf("%g %T\n", x1, x1)
    24  	fmt.Printf("%g %T\n", x2, x2)
    25  	fmt.Printf("%g %T\n", x3, x3)
    26  	fmt.Printf("%g %T\n", x4, x4)
    27  	fmt.Printf("%g %T\n", x5, x5)
    28  	fmt.Printf("%g %T\n", x6, x6)
    29  }