github.com/solo-io/cue@v0.4.7/doc/tutorial/basics/2_types/75_bounddef.txt (about)

     1  cue eval -ic bound.cue
     2  cmp stdout expect-stdout-cue
     3  
     4  -- frontmatter.toml --
     5  title = "Predefined Bounds"
     6  description = ""
     7  
     8  -- text.md --
     9  CUE numbers have arbitrary precision.
    10  Also there is no unsigned integer type.
    11  
    12  CUE defines the following predefined identifiers to restrict the bounds of
    13  integers to common values.
    14  
    15  ```
    16  uint      >=0
    17  uint8     >=0 & <=255
    18  int8      >=-128 & <=127
    19  uint16    >=0 & <=65536
    20  int16     >=-32_768 & <=32_767
    21  rune      >=0 & <=0x10FFFF
    22  uint32    >=0 & <=4_294_967_296
    23  int32     >=-2_147_483_648 & <=2_147_483_647
    24  uint64    >=0 & <=18_446_744_073_709_551_615
    25  int64     >=-9_223_372_036_854_775_808 & <=9_223_372_036_854_775_807
    26  int128    >=-170_141_183_460_469_231_731_687_303_715_884_105_728 &
    27                <=170_141_183_460_469_231_731_687_303_715_884_105_727
    28  uint128   >=0 & <=340_282_366_920_938_463_463_374_607_431_768_211_455
    29  ```
    30  
    31  -- bound.cue --
    32  #positive: uint
    33  #byte:     uint8
    34  #word:     int32
    35  
    36  a: #positive & -1
    37  b: #byte & 128
    38  c: #word & 2_000_000_000
    39  
    40  -- expect-stdout-cue --
    41  a: _|_ // invalid value -1 (out of bound int & >=0)
    42  b: 128
    43  c: 2000000000