github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/const22.gno (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  const (
     8  	ia = 1_000_000
     9  	ib = 1_00_00_00
    10  	ic = 1_000
    11  
    12  	fa = 1_000_000.000
    13  	fb = 1_000_000.000_000
    14  
    15  	// Imaginary number aren't supported at the moment
    16  	// ima = 100_000i
    17  	// imb = 1 + 100_000i
    18  
    19  	ha = 0x_16_32
    20  	hb = 0b_0110_1001
    21  	ho = 0o_644_755
    22  )
    23  
    24  func main() {
    25  	fmt.Printf("%d\n", ia)
    26  	fmt.Printf("%d\n", ib)
    27  	fmt.Printf("%d\n", ic)
    28  
    29  	fmt.Printf("%f\n", fa)
    30  	fmt.Printf("%f\n", fb)
    31  
    32  	fmt.Printf("%x", ha)
    33  	fmt.Printf("%x", hb)
    34  	fmt.Printf("%x", ho)
    35  }
    36  
    37  // Output:
    38  // 1000000
    39  // 1000000
    40  // 1000
    41  // 1000000.000000
    42  // 1000000.000000
    43  // 163269349ed